changeset 110972:dff76f22a051

lisp/subr.el (last): Deal with dotted lists (reported in bug#7174).
author Juanma Barranquero <lekktu@gmail.com>
date Thu, 14 Oct 2010 01:43:39 +0200
parents 80846b446563
children 8955f6658bfa
files lisp/ChangeLog lisp/subr.el
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Thu Oct 14 01:15:03 2010 +0200
+++ b/lisp/ChangeLog	Thu Oct 14 01:43:39 2010 +0200
@@ -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).
--- a/lisp/subr.el	Thu Oct 14 01:15:03 2010 +0200
+++ b/lisp/subr.el	Thu Oct 14 01:43:39 2010 +0200
@@ -289,7 +289,7 @@
 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