From f4e5bca55691985ad31a7d156c118d7a7dae3a95 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 1 Oct 1994 04:36:28 +0000 Subject: [PATCH] (add-hook, remove-hook): If the hook was made local in the old way, always modify the local value. --- lisp/subr.el | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lisp/subr.el b/lisp/subr.el index a29d4e177a8..3c4308bf8c2 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -652,7 +652,11 @@ function, it is changed to a list of functions." (let ((old (symbol-value hook))) (if (or (not (listp old)) (eq (car old) 'lambda)) (set hook (list old)))) - (if local + (if (or local + ;; Detect the case where make-local-variable was used on a hook + ;; and do what we used to do. + (and (local-variable-p hook) + (not (memq t (symbol-value hook))))) ;; Alter the local value only. (or (if (consp function) (member function (symbol-value hook)) @@ -687,7 +691,11 @@ To make a hook variable buffer-local, always use (null (symbol-value hook)) ;value is nil, or (null function)) ;function is nil, then nil ;Do nothing. - (if local + (if (or local + ;; Detect the case where make-local-variable was used on a hook + ;; and do what we used to do. + (and (local-variable-p hook) + (not (memq t (symbol-value hook))))) (let ((hook-value (symbol-value hook))) (if (consp hook-value) (if (member function hook-value)