Add delete! convenience macro

And polish delq!'s docstring.
This commit is contained in:
Henrik Lissner 2019-08-10 11:07:25 -04:00
parent 0169f8e3f6
commit 856a2afe43
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -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.