From 61ff7267cccb7b1f7efa24e0b221a89ad7d729d7 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Sun, 5 Jan 2025 13:17:02 +0100 Subject: [PATCH] Turn alist-set into a macro --- lisp/subr.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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. -- 2.39.5