Add :defer support to add-hook! macro
See add-hook's DEPTH argument (replaces APPEND in Emacs 27+).
This commit is contained in:
parent
10f9ec44a0
commit
d44c57f01a
1 changed files with 3 additions and 1 deletions
|
@ -510,10 +510,12 @@ This macro accepts, in order:
|
|||
append-p
|
||||
local-p
|
||||
remove-p
|
||||
depth
|
||||
forms)
|
||||
(while (keywordp (car rest))
|
||||
(pcase (pop rest)
|
||||
(:append (setq append-p t))
|
||||
(:depth (setq depth (pop rest)))
|
||||
(:local (setq local-p t))
|
||||
(:remove (setq remove-p t))))
|
||||
(let ((first (car-safe (car rest))))
|
||||
|
@ -535,7 +537,7 @@ This macro accepts, in order:
|
|||
(dolist (func func-forms)
|
||||
(push (if remove-p
|
||||
`(remove-hook ',hook #',func ,local-p)
|
||||
`(add-hook ',hook #',func ,append-p ,local-p))
|
||||
`(add-hook ',hook #',func ,(or depth append-p) ,local-p))
|
||||
forms)))
|
||||
(macroexp-progn
|
||||
(append defn-forms
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue