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

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

[elpa] externals/compat c177ff5e83 17/84: Reuse ntake in take definition


From: ELPA Syncer
Subject: [elpa] externals/compat c177ff5e83 17/84: Reuse ntake in take definition
Date: Tue, 3 Jan 2023 08:57:31 -0500 (EST)

branch: externals/compat
commit c177ff5e83e26ee721a9e5c33b6d7e6b2dc110fa
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>

    Reuse ntake in take definition
---
 compat-29.el | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/compat-29.el b/compat-29.el
index 0ac82bbe76..5ec5680311 100644
--- a/compat-29.el
+++ b/compat-29.el
@@ -65,6 +65,7 @@ the properties at POSITION."
 If N is zero or negative, return nil.
 If N is greater or equal to the length of LIST, return LIST unmodified.
 Otherwise, return LIST after truncating it."
+  :realname compat--ntake-elisp
   (and (> n 0) (let ((cons (nthcdr (1- n) list)))
                  (when cons (setcdr cons nil))
                  list)))
@@ -73,10 +74,7 @@ Otherwise, return LIST after truncating it."
   "Return the first N elements of LIST.
 If N is zero or negative, return nil.
 If N is greater or equal to the length of LIST, return LIST (or a copy)."
-  (setq list (copy-sequence list))      ;FIXME: only copy as much as necessary
-  (and (> n 0) (let ((cons (nthcdr (1- n) list)))
-                 (when cons (setcdr cons nil))
-                 list)))
+  (compat--ntake-elisp n (copy-sequence list)))      ;FIXME: only copy as much 
as necessary
 
 ;;;; Defined in subr.el
 



reply via email to

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