]> git.eshelyaron.com Git - emacs.git/commitdiff
Turn alist-set into a macro
authorEshel Yaron <me@eshelyaron.com>
Sun, 5 Jan 2025 12:17:02 +0000 (13:17 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sun, 5 Jan 2025 12:18:52 +0000 (13:18 +0100)
lisp/subr.el

index 3a8a0ae5f202f44a889d2863e5a0ec3693fbb02f..a810c3940eab9be45b97a79c637b24c397dac22e 100644 (file)
@@ -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.