lisp/subr.el (last): Deal with dotted lists (reported in bug#7174).

This commit is contained in:
Glenn Morris 2010-10-14 01:43:39 +02:00 committed by Juanma Barranquero
parent 88f427d57c
commit 10e4702abc
2 changed files with 5 additions and 1 deletions

View file

@ -1,3 +1,7 @@
2010-10-13 Glenn Morris <rgm@gnu.org>
* subr.el (last): Deal with dotted lists (reported in bug#7174).
2010-10-13 Stephen Berman <stephen.berman@gmx.net>
* subr.el (last): Use `safe-length' instead of `length' (bug#7206).

View file

@ -289,7 +289,7 @@ If LIST is nil, return nil.
If N is non-nil, return the Nth-to-last link of LIST.
If N is bigger than the length of LIST, return LIST."
(if n
(and (> n 0)
(and (>= n 0)
(let ((m (safe-length list)))
(if (< n m) (nthcdr (- m n) list) list)))
(and list