From: Leo Liu Date: Wed, 18 Sep 2013 01:27:00 +0000 (+0800) Subject: * subr.el (add-hook): Robustify to handle closure as well. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~1569 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9f25cb774999615410049cbe9382537e7e6ef074;p=emacs.git * subr.el (add-hook): Robustify to handle closure as well. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 94987adcfb6..7b2ed1fe6a1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2013-09-18 Leo Liu + + * subr.el (add-hook): Robustify to handle closure as well. + 2013-09-17 Glenn Morris * simple.el (messages-buffer-mode-map): Unbind "g". diff --git a/lisp/subr.el b/lisp/subr.el index f8b5d605f91..adf3f9a97f2 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1366,7 +1366,7 @@ function, it is changed to a list of functions." (setq local t))) (let ((hook-value (if local (symbol-value hook) (default-value hook)))) ;; If the hook value is a single function, turn it into a list. - (when (or (not (listp hook-value)) (eq (car hook-value) 'lambda)) + (when (or (not (listp hook-value)) (functionp hook-value)) (setq hook-value (list hook-value))) ;; Do the actual addition if necessary (unless (member function hook-value)