From: ueno Date: Thu, 14 Dec 2000 10:55:02 +0000 (+0000) Subject: * alist.el (del-alist): Simplified. X-Git-Tag: apel-10_3~41 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=203c90150b8c7da7ecf23b433196773d4f3f7eae;p=elisp%2Fapel.git * alist.el (del-alist): Simplified. --- diff --git a/ChangeLog b/ChangeLog index 32d9d27..c0e2f71 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2000-12-14 Daiki Ueno + + * alist.el (del-alist): Simplified. + 2000-12-14 Mikio Nakajima * pym.el (static-if): Put t on edebug spec instead of if. diff --git a/alist.el b/alist.el index 4b656de..485107e 100644 --- a/alist.el +++ b/alist.el @@ -40,19 +40,10 @@ return a new alist whose car is the new pair and cdr is ALIST." (defun del-alist (key alist) "Delete an element whose car equals KEY from ALIST. Return the modified ALIST." - (if (equal key (car (car alist))) - (cdr alist) - (let ((pr alist) - (r (cdr alist))) - (catch 'tag - (while (not (null r)) - (if (equal key (car (car r))) - (progn - (rplacd pr (cdr r)) - (throw 'tag alist))) - (setq pr r) - (setq r (cdr r))) - alist)))) + (let ((pair (assoc item alist))) + (if pair + (delq pair alist) + alist))) ;;;###autoload (defun set-alist (symbol key value)