From: Richard M. Stallman Date: Sat, 23 Aug 1997 19:10:42 +0000 (+0000) Subject: (last): New function. X-Git-Tag: emacs-20.1~456 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e8c32c9941ea6d9c7ae11964140a97a9e0567309;p=emacs.git (last): New function. --- diff --git a/lisp/subr.el b/lisp/subr.el index a93cd3f8b52..513a63a2f21 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -78,6 +78,13 @@ BODY should be a list of lisp expressions." (defsubst cddr (x) "Return the cdr of the cdr of X." (cdr (cdr x))) + +(defun last (x) + "Return the last element of the list X. +If X is nil, return nil." + (while (cdr x) + (setq x (cdr x))) + x) ;;;; Keymap support.