diff options
author | Richard M. Stallman <rms@gnu.org> | 1997-08-23 19:10:42 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1997-08-23 19:10:42 +0000 |
commit | b2ebb6a13050ca39a8f0938b32903635eef23be8 (patch) | |
tree | 23204827b0891a40d78df1f96869ead8e72a3699 /lisp/subr.el | |
parent | 6d65e8b1bd87305efc1e06e118292a19026d9196 (diff) | |
download | emacs-b2ebb6a13050ca39a8f0938b32903635eef23be8.tar.gz |
(last): New function.
Diffstat (limited to 'lisp/subr.el')
-rw-r--r-- | lisp/subr.el | 7 |
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. |