summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-08-23 19:10:42 +0000
committerRichard M. Stallman <rms@gnu.org>1997-08-23 19:10:42 +0000
commitb2ebb6a13050ca39a8f0938b32903635eef23be8 (patch)
tree23204827b0891a40d78df1f96869ead8e72a3699 /lisp
parent6d65e8b1bd87305efc1e06e118292a19026d9196 (diff)
downloademacs-b2ebb6a13050ca39a8f0938b32903635eef23be8.tar.gz
(last): New function.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/subr.el7
1 files changed, 7 insertions, 0 deletions
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.