# HG changeset patch # User Richard M. Stallman # Date 872363442 0 # Node ID 892a0977245716825c04102830a54521b1cb78ac # Parent f5fd22f3462c0ac15ac8be819d2d7eb25a43bbba (last): New function. diff -r f5fd22f3462c -r 892a09772457 lisp/subr.el --- a/lisp/subr.el Sat Aug 23 18:55:52 1997 +0000 +++ b/lisp/subr.el Sat Aug 23 19:10:42 1997 +0000 @@ -78,6 +78,13 @@ (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.