From: Eshel Yaron Date: Sun, 5 Jan 2025 12:17:02 +0000 (+0100) Subject: Turn alist-set into a macro X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=61ff7267cccb7b1f7efa24e0b221a89ad7d729d7;p=emacs.git Turn alist-set into a macro --- diff --git a/lisp/subr.el b/lisp/subr.el index 3a8a0ae5f20..a810c3940ea 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1006,9 +1006,9 @@ Example: (assoc key alist testfn)))) (if x (cdr x) default))) -(defun alist-set (key alist value &optional testfn) +(defmacro alist-set (key alist value &optional testfn) "Associate VALUE with KEY in ALIST, comparing keys with TESTFN." - (setf (alist-get key alist nil nil testfn) value)) + `(setf (alist-get ,key ,alist nil nil ,testfn) ,value)) (defun remove (elt seq) "Return a copy of SEQ with all occurrences of ELT removed.