From a861177c4aef04ee390bc381cbaa8521fb459186 Mon Sep 17 00:00:00 2001 From: syl20bnr Date: Wed, 4 Jul 2018 15:38:15 -0400 Subject: [PATCH] core: fix potential undefined function error with transient hooks Fixes #10930 --- core/core-hooks.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/core-hooks.el b/core/core-hooks.el index 186aa26a3..1724d6ea3 100644 --- a/core/core-hooks.el +++ b/core/core-hooks.el @@ -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)))))