Change add-transient-hook! to take hook suffix as 2nd arg
By default, transient hooks are defined as doom-transient-hook-N, where N is a counter. This makes debugging them difficult. Now, you may specify an id for the second argument. e.g. (add-transient-hook! 'find-file-hook load-evil (require 'evil)) Will define doom|transient-hook-load-evil, which is easier to debug and remove, if necessary.
This commit is contained in:
parent
af079e5f6f
commit
6b8520d189
1 changed files with 6 additions and 3 deletions
|
@ -110,9 +110,12 @@ invoked, then never again.
|
||||||
|
|
||||||
HOOK can be a quoted hook or a sharp-quoted function (which will be advised)."
|
HOOK can be a quoted hook or a sharp-quoted function (which will be advised)."
|
||||||
(declare (indent 1))
|
(declare (indent 1))
|
||||||
(let ((append (eq (car forms) :after))
|
(let ((append (if (eq (car forms) :after) (pop forms)))
|
||||||
(fn (intern (format "doom-transient-hook-%s" (cl-incf doom--transient-counter)))))
|
(fn (intern (format "doom|transient-hook-%s"
|
||||||
`(when ,hook
|
(if (not (symbolp (car forms)))
|
||||||
|
(cl-incf doom--transient-counter)
|
||||||
|
(pop forms))))))
|
||||||
|
`(progn
|
||||||
(fset ',fn
|
(fset ',fn
|
||||||
(lambda (&rest _)
|
(lambda (&rest _)
|
||||||
,@forms
|
,@forms
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue