Skip to content

Commit

Permalink
core: fix potential undefined function error with transient hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
syl20bnr committed Jul 4, 2018
1 parent ba2f692 commit a861177
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/core-hooks.el
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@ If FUNC is a lambda you must give it a name with FNAME. "
,(if (functionp hook)
`(advice-remove ',hook ',hfunc)
`(remove-hook ',hook ',hfunc))
(fmakunbound ',hfunc)
,(when fname `(fmakunbound ',fname)))))
;; instead of unbinding we reset the
;; 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)
`((advice-add ',hook :before ',hfunc))
`((add-hook ',hook ',hfunc)))))
Expand Down

0 comments on commit a861177

Please sign in to comment.