From e41e57eda6ec52c388bbbcb2d55c2fb15cb56346 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Fri, 20 Aug 1999 10:06:47 +0000 Subject: [PATCH] (delete): Return nil when argument 'list' is nil. --- poe-18.el | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) 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. -- 1.7.10.4