emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/xr 51ce3792c2 1/2: Use `take` when available


From: ELPA Syncer
Subject: [elpa] externals/xr 51ce3792c2 1/2: Use `take` when available
Date: Sun, 25 Sep 2022 05:58:19 -0400 (EDT)

branch: externals/xr
commit 51ce3792c2f32e415298df8f073743a10ea63f57
Author: Mattias EngdegÄrd <mattiase@acm.org>
Commit: Mattias EngdegÄrd <mattiase@acm.org>

    Use `take` when available
---
 xr.el | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/xr.el b/xr.el
index ea1854a817..13044c4c35 100644
--- a/xr.el
+++ b/xr.el
@@ -1786,9 +1786,12 @@ If ESCAPE-PRINTABLE, also escape \\ and \", otherwise 
don't."
         xdigit)))
    string 'fixedcase 'literal))
 
-(defun xr--take (n list)
-  "The N first elements of LIST."
-  (butlast list (- (length list) n)))
+(defalias 'xr--take
+  (if (fboundp 'take)
+      #'take
+    (lambda (n list)
+      "The N first elements of LIST."
+      (cl-loop repeat n for x in list collect x))))
 
 (defun xr--rx-list-to-string (rx plain-prefix)
   "Print the list `rx' to a string, unformatted.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]