From 637c49359561277ee2269fcf82ca005c173c4232 Mon Sep 17 00:00:00 2001 From: David Aspinall Date: Wed, 29 Jan 2003 17:13:19 +0000 Subject: Add remassoc for FSF. --- generic/proof-compat.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/generic/proof-compat.el b/generic/proof-compat.el index f3c5753b..b9b6b1a7 100644 --- a/generic/proof-compat.el +++ b/generic/proof-compat.el @@ -348,6 +348,7 @@ The returned value is one of the following symbols: ;; Emulate a useful builtin from XEmacs. (or (fboundp 'remassq) +;; NB: Emacs has assoc package with assq-delete-all function (defun remassq (key alist) "Delete any elements of ALIST whose car is `eq' to KEY. The modified ALIST is returned." @@ -359,6 +360,18 @@ The modified ALIST is returned." (setq alist (cdr alist))) (nreverse newalist)))) +(or (fboundp 'remassoc) +(defun remassoc (key alist) + "Delete any elements of ALIST whose car is `eq' to KEY. +The modified ALIST is returned." +;; The builtin version deletes by side-effect, but don't bother here. + (let (newalist) + (while alist + (unless (equal key (caar alist)) + (setq newalist (cons (car alist) newalist))) + (setq alist (cdr alist))) + (nreverse newalist)))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; -- cgit v1.2.3