Add delete! convenience macro
And polish delq!'s docstring.
This commit is contained in:
parent
0169f8e3f6
commit
856a2afe43
1 changed files with 7 additions and 1 deletions
|
@ -230,13 +230,19 @@ This is a variadic `push'."
|
||||||
`(setq ,sym (nconc ,sym ,@lists)))
|
`(setq ,sym (nconc ,sym ,@lists)))
|
||||||
|
|
||||||
(defmacro delq! (elt list &optional fetcher)
|
(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
|
`(setq ,list
|
||||||
(delq ,(if fetcher
|
(delq ,(if fetcher
|
||||||
`(funcall ,fetcher ,elt ,list)
|
`(funcall ,fetcher ,elt ,list)
|
||||||
elt)
|
elt)
|
||||||
,list)))
|
,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)
|
(defmacro add-transient-hook! (hook-or-function &rest forms)
|
||||||
"Attaches a self-removing function to HOOK-OR-FUNCTION.
|
"Attaches a self-removing function to HOOK-OR-FUNCTION.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue