(assq-delete-all): New compiler macro for Emacs 20.
authorKatsumi Yamaoka <yamaoka@jpl.org>
Tue, 13 May 2003 00:05:08 +0000 (00:05 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Tue, 13 May 2003 00:05:08 +0000 (00:05 +0000)
lisp/ChangeLog
lisp/dgnushack.el

index cc069bb..0499206 100644 (file)
@@ -1,3 +1,7 @@
+2003-05-13  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * dgnushack.el (assq-delete-all): New compiler macro for Emacs 20.
+
 2003-05-12  Katsumi Yamaoka  <yamaoka@jpl.org>
 
        * lpath.el: Fbind find-coding-system.
index 0b88fd1..1064b5f 100644 (file)
 
 ;; Define compiler macros for the functions provided by cl in old Emacsen.
 (unless (featurep 'xemacs)
+  (define-compiler-macro assq-delete-all (&whole form key alist)
+    (if (>= emacs-major-version 21)
+       form
+      `(let* ((key ,key)
+             (alist ,alist)
+             (tail alist))
+        (while tail
+          (if (and (consp (car tail)) (eq (car (car tail)) key))
+              (setq alist (delq (car tail) alist)))
+          (setq tail (cdr tail)))
+        alist)))
+
   (define-compiler-macro butlast (&whole form x &optional n)
     (if (>= emacs-major-version 21)
        form