aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2014-01-31 23:54:29 -0800
committerLars Ingebrigtsen2014-01-31 23:54:29 -0800
commit79278d031316b704b56b7990b0c127874787252b (patch)
tree8e5204387220b7566d352cd08d6aea1f057aae28
parentcc477daa01c1770b5deb5bfca9fe8bdafa3941e2 (diff)
downloademacs-79278d031316b704b56b7990b0c127874787252b.tar.gz
emacs-79278d031316b704b56b7990b0c127874787252b.zip
* subr.el (butlast): Document what an omitted N means.
* subr.el (butlast): Document what an omitted N means. (nbutlast): Ditto. Fixes: debbugs:13437
-rw-r--r--lisp/subr.el7
1 files changed, 5 insertions, 2 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index e3cc4b05f3f..3101cc8b6f0 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -364,12 +364,15 @@ If N is bigger than the length of LIST, return LIST."
364 (nthcdr (1- (safe-length list)) list)))) 364 (nthcdr (1- (safe-length list)) list))))
365 365
366(defun butlast (list &optional n) 366(defun butlast (list &optional n)
367 "Return a copy of LIST with the last N elements removed." 367 "Return a copy of LIST with the last N elements removed.
368If N is omitted or nil, the last element is removed from the
369copy."
368 (if (and n (<= n 0)) list 370 (if (and n (<= n 0)) list
369 (nbutlast (copy-sequence list) n))) 371 (nbutlast (copy-sequence list) n)))
370 372
371(defun nbutlast (list &optional n) 373(defun nbutlast (list &optional n)
372 "Modifies LIST to remove the last N elements." 374 "Modifies LIST to remove the last N elements.
375If N is omitted or nil, remove the last element."
373 (let ((m (length list))) 376 (let ((m (length list)))
374 (or n (setq n 1)) 377 (or n (setq n 1))
375 (and (< n m) 378 (and (< n m)