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 | e8c32c9941ea6d9c7ae11964140a97a9e0567309 (patch) | |
tree | 3c5c2c3f7ce532c9cdfd0f564f47f9b8e489cfb3 /lisp | |
parent | d370591d58e78adbbcb788d0aa0cc9de3fcdbff7 (diff) | |
download | emacs-e8c32c9941ea6d9c7ae11964140a97a9e0567309.tar.gz emacs-e8c32c9941ea6d9c7ae11964140a97a9e0567309.tar.bz2 emacs-e8c32c9941ea6d9c7ae11964140a97a9e0567309.zip |
(last): New function.
Diffstat (limited to 'lisp')
-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. |