core: fix potential undefined function error with transient hooks
Fixes #10930
This commit is contained in:
parent
ba2f692366
commit
a861177c4a
|
@ -53,8 +53,11 @@ If FUNC is a lambda you must give it a name with FNAME. "
|
||||||
,(if (functionp hook)
|
,(if (functionp hook)
|
||||||
`(advice-remove ',hook ',hfunc)
|
`(advice-remove ',hook ',hfunc)
|
||||||
`(remove-hook ',hook ',hfunc))
|
`(remove-hook ',hook ',hfunc))
|
||||||
(fmakunbound ',hfunc)
|
;; instead of unbinding we reset the
|
||||||
,(when fname `(fmakunbound ',fname)))))
|
;; functions to be the `ignore' function.
|
||||||
|
;; see: https://github.com/syl20bnr/spacemacs/issues/10930
|
||||||
|
(fset ',hfunc 'ignore)
|
||||||
|
,(when fname `(fset ',fname 'ignore)))))
|
||||||
(if (functionp hook)
|
(if (functionp hook)
|
||||||
`((advice-add ',hook :before ',hfunc))
|
`((advice-add ',hook :before ',hfunc))
|
||||||
`((add-hook ',hook ',hfunc)))))
|
`((add-hook ',hook ',hfunc)))))
|
||||||
|
|
Loading…
Reference in a new issue