From 856a2afe43c1f50179c42ac8147b0d1a87c12d33 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 10 Aug 2019 11:07:25 -0400 Subject: [PATCH] Add delete! convenience macro And polish delq!'s docstring. --- core/core-lib.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/core-lib.el b/core/core-lib.el index 9f3e6df41..2b08cafaa 100644 --- a/core/core-lib.el +++ b/core/core-lib.el @@ -230,13 +230,19 @@ This is a variadic `push'." `(setq ,sym (nconc ,sym ,@lists))) (defmacro delq! (elt list &optional fetcher) - "Delete ELT from LIST in-place." + "`delq' ELT from LIST in-place. + +If FETCHER is a function, ELT is used as the key in LIST (an alist)." `(setq ,list (delq ,(if fetcher `(funcall ,fetcher ,elt ,list) elt) ,list))) +(defmacro delete! (elt list) + "Delete ELT from LIST in-place." + `(setq ,list (delete ,elt ,list))) + (defmacro add-transient-hook! (hook-or-function &rest forms) "Attaches a self-removing function to HOOK-OR-FUNCTION.