Mercurial > emacs
comparison lisp/subr.el @ 23294:ce2cac0f1682
(remove-hook): Check list values to avoid errors.
author | Dave Love <fx@gnu.org> |
---|---|
date | Mon, 21 Sep 1998 17:57:46 +0000 |
parents | 173e15236628 |
children | 62f74712cbd6 |
comparison
equal
deleted
inserted
replaced
23293:34dc05f50ea3 | 23294:ce2cac0f1682 |
---|---|
651 nil ;Do nothing. | 651 nil ;Do nothing. |
652 (if (or local | 652 (if (or local |
653 ;; Detect the case where make-local-variable was used on a hook | 653 ;; Detect the case where make-local-variable was used on a hook |
654 ;; and do what we used to do. | 654 ;; and do what we used to do. |
655 (and (local-variable-p hook) | 655 (and (local-variable-p hook) |
656 (not (memq t (symbol-value hook))))) | 656 (consp (symbol-value hook)) |
657 (not (memq t (symbol-value hook))))) | |
657 (let ((hook-value (symbol-value hook))) | 658 (let ((hook-value (symbol-value hook))) |
658 (if (consp hook-value) | 659 (if (consp hook-value) |
659 (if (member function hook-value) | 660 (if (member function hook-value) |
660 (setq hook-value (delete function (copy-sequence hook-value)))) | 661 (setq hook-value (delete function (copy-sequence hook-value)))) |
661 (if (equal hook-value function) | 662 (if (equal hook-value function) |
662 (setq hook-value nil))) | 663 (setq hook-value nil))) |
663 (set hook hook-value)) | 664 (set hook hook-value)) |
664 (let ((hook-value (default-value hook))) | 665 (let ((hook-value (default-value hook))) |
665 (if (consp hook-value) | 666 (if (and (consp hook-value) (not (functionp hook-value))) |
666 (if (member function hook-value) | 667 (if (member function hook-value) |
667 (setq hook-value (delete function (copy-sequence hook-value)))) | 668 (setq hook-value (delete function (copy-sequence hook-value)))) |
668 (if (equal hook-value function) | 669 (if (equal hook-value function) |
669 (setq hook-value nil))) | 670 (setq hook-value nil))) |
670 (set-default hook hook-value))))) | 671 (set-default hook hook-value))))) |