From: yamaoka Date: Fri, 20 Aug 1999 10:06:47 +0000 (+0000) Subject: (delete): Return nil when argument 'list' is nil. X-Git-Tag: of-tm-8_3~4 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e41e57eda6ec52c388bbbcb2d55c2fb15cb56346;p=elisp%2Fapel.git (delete): Return nil when argument 'list' is nil. --- diff --git a/poe-18.el b/poe-18.el index 88ae916..9b021bf 100644 --- a/poe-18.el +++ b/poe-18.el @@ -63,15 +63,16 @@ it is simply using a different list. Therefore, write `(setq foo (delete element foo))' to be sure of changing the value of `foo'. \[poe-18.el; EMACS 19 emulating function]" - (if (equal elt (car list)) - (cdr list) - (let ((rest list) - (rrest (cdr list))) - (while (and rrest (not (equal elt (car rrest)))) - (setq rest rrest - rrest (cdr rrest))) - (setcdr rest (cdr rrest)) - list))) + (if list + (if (equal elt (car list)) + (cdr list) + (let ((rest list) + (rrest (cdr list))) + (while (and rrest (not (equal elt (car rrest)))) + (setq rest rrest + rrest (cdr rrest))) + (setcdr rest (cdr rrest)) + list)))) (defun member (elt list) "Return non-nil if ELT is an element of LIST. Comparison done with EQUAL.