Fix void-variable sym errors
And remove trailing hyphen on anonymous transient hooks.
This commit is contained in:
parent
e9b750cc74
commit
c42600d771
1 changed files with 4 additions and 3 deletions
|
@ -227,13 +227,14 @@ advised)."
|
||||||
(let ((append (if (eq (car forms) :after) (pop forms)))
|
(let ((append (if (eq (car forms) :after) (pop forms)))
|
||||||
(fn (if (symbolp (car forms))
|
(fn (if (symbolp (car forms))
|
||||||
(intern (format "doom|transient-hook-%s" (pop forms)))
|
(intern (format "doom|transient-hook-%s" (pop forms)))
|
||||||
(make-symbol "doom|transient-hook-"))))
|
(make-symbol "doom|transient-hook"))))
|
||||||
`(let ((sym ,hook-or-function))
|
`(let ((sym ,hook-or-function))
|
||||||
(fset ',fn
|
(fset ',fn
|
||||||
(lambda (&rest _)
|
(lambda (&rest _)
|
||||||
,@forms
|
,@forms
|
||||||
(cond ((functionp sym) (advice-remove sym #',fn))
|
(let ((sym ,hook-or-function))
|
||||||
((symbolp sym) (remove-hook sym #',fn)))
|
(cond ((functionp sym) (advice-remove sym #',fn))
|
||||||
|
((symbolp sym) (remove-hook sym #',fn))))
|
||||||
(unintern ',fn nil)))
|
(unintern ',fn nil)))
|
||||||
(cond ((functionp sym)
|
(cond ((functionp sym)
|
||||||
(advice-add ,hook-or-function ,(if append :after :before) #',fn))
|
(advice-add ,hook-or-function ,(if append :after :before) #',fn))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue