mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-03 12:27:26 -05:00
Fix remove-hook! macro
This commit is contained in:
@ -138,7 +138,8 @@ Examples:
|
|||||||
Body forms can access the hook's arguments through the let-bound variable
|
Body forms can access the hook's arguments through the let-bound variable
|
||||||
`args'."
|
`args'."
|
||||||
(declare (indent defun) (debug t))
|
(declare (indent defun) (debug t))
|
||||||
(let (hook append-p local-p)
|
(let ((hook-fn (if (boundp 'hook-fn) hook-fn))
|
||||||
|
hook append-p local-p)
|
||||||
(while (keywordp (car args))
|
(while (keywordp (car args))
|
||||||
(pcase (pop args)
|
(pcase (pop args)
|
||||||
(:append (setq append-p t))
|
(:append (setq append-p t))
|
||||||
@ -157,8 +158,10 @@ Body forms can access the hook's arguments through the let-bound variable
|
|||||||
`(quote ,fn)
|
`(quote ,fn)
|
||||||
`(lambda (&rest args) ,@args)))
|
`(lambda (&rest args) ,@args)))
|
||||||
(dolist (hook hooks)
|
(dolist (hook hooks)
|
||||||
(push `(,(if (boundp 'hook-fn) hook-fn 'add-hook)
|
(push (cond ((eq hook-fn 'remove-hook)
|
||||||
',hook ,fn ,append-p ,local-p)
|
`(remove-hook ',hook ,fn ,local-p))
|
||||||
|
(t
|
||||||
|
`(add-hook ',hook ,fn ,append-p ,local-p)))
|
||||||
forms)))
|
forms)))
|
||||||
`(progn ,@(nreverse forms)))))
|
`(progn ,@(nreverse forms)))))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user