aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Aspinall2003-01-29 17:13:19 +0000
committerDavid Aspinall2003-01-29 17:13:19 +0000
commit637c49359561277ee2269fcf82ca005c173c4232 (patch)
tree27f25dd65f813275a709aa4bc50a92f3c3cd0b44
parent327b1ca058ab8294f81c01a8d0487ab6f4f4c85a (diff)
Add remassoc for FSF.
-rw-r--r--generic/proof-compat.el13
1 files changed, 13 insertions, 0 deletions
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))))
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;