aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1994-10-01 04:36:28 +0000
committerRichard M. Stallman1994-10-01 04:36:28 +0000
commitf4e5bca55691985ad31a7d156c118d7a7dae3a95 (patch)
tree70473c780b66d62fea05af09f791c59ca4d37eca
parenta8928dd22f52c72f3c6ff2878b5b2e1d52ca271a (diff)
downloademacs-f4e5bca55691985ad31a7d156c118d7a7dae3a95.tar.gz
emacs-f4e5bca55691985ad31a7d156c118d7a7dae3a95.zip
(add-hook, remove-hook): If the hook was made local
in the old way, always modify the local value.
-rw-r--r--lisp/subr.el12
1 files 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."
652 (let ((old (symbol-value hook))) 652 (let ((old (symbol-value hook)))
653 (if (or (not (listp old)) (eq (car old) 'lambda)) 653 (if (or (not (listp old)) (eq (car old) 'lambda))
654 (set hook (list old)))) 654 (set hook (list old))))
655 (if local 655 (if (or local
656 ;; Detect the case where make-local-variable was used on a hook
657 ;; and do what we used to do.
658 (and (local-variable-p hook)
659 (not (memq t (symbol-value hook)))))
656 ;; Alter the local value only. 660 ;; Alter the local value only.
657 (or (if (consp function) 661 (or (if (consp function)
658 (member function (symbol-value hook)) 662 (member function (symbol-value hook))
@@ -687,7 +691,11 @@ To make a hook variable buffer-local, always use
687 (null (symbol-value hook)) ;value is nil, or 691 (null (symbol-value hook)) ;value is nil, or
688 (null function)) ;function is nil, then 692 (null function)) ;function is nil, then
689 nil ;Do nothing. 693 nil ;Do nothing.
690 (if local 694 (if (or local
695 ;; Detect the case where make-local-variable was used on a hook
696 ;; and do what we used to do.
697 (and (local-variable-p hook)
698 (not (memq t (symbol-value hook)))))
691 (let ((hook-value (symbol-value hook))) 699 (let ((hook-value (symbol-value hook)))
692 (if (consp hook-value) 700 (if (consp hook-value)
693 (if (member function hook-value) 701 (if (member function hook-value)