comparison lisp/subr.el @ 9202:92d6de82426a

(add-hook, remove-hook): If the hook was made local in the old way, always modify the local value.
author Richard M. Stallman <rms@gnu.org>
date Sat, 01 Oct 1994 04:36:28 +0000
parents 70b00615cb75
children f03544494d1c
comparison
equal deleted inserted replaced
9201:3af00d95faac 9202:92d6de82426a
650 (or (default-boundp hook) (set-default hook nil)) 650 (or (default-boundp hook) (set-default hook nil))
651 ;; If the hook value is a single function, turn it into a list. 651 ;; If the hook value is a single function, turn it into a list.
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))
659 (memq function (symbol-value hook))) 663 (memq function (symbol-value hook)))
660 (set hook 664 (set hook
685 (if (or (not (boundp hook)) ;unbound symbol, or 689 (if (or (not (boundp hook)) ;unbound symbol, or
686 (not (default-boundp 'hook)) 690 (not (default-boundp 'hook))
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)
694 (setq hook-value (delete function (copy-sequence hook-value)))) 702 (setq hook-value (delete function (copy-sequence hook-value))))
695 (if (equal hook-value function) 703 (if (equal hook-value function)