aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorRichard M. Stallman1993-12-23 04:43:01 +0000
committerRichard M. Stallman1993-12-23 04:43:01 +0000
commitf48c1d8d7cb0278edbfcaf45ecbf3e93f3f653ed (patch)
tree67c07bbbb8ec96baaf73e2b65ba1326f2eb6d9f0 /lisp
parentd226f0a6b1f16eb0beb9935de75e9987d0ace15f (diff)
downloademacs-f48c1d8d7cb0278edbfcaf45ecbf3e93f3f653ed.tar.gz
emacs-f48c1d8d7cb0278edbfcaf45ecbf3e93f3f653ed.zip
(remove-hook): Use equal to see if hook is just that fcn.
(add-hook): Use member to see if a lambda expr is already in the list.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/subr.el7
1 files changed, 2 insertions, 5 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index f21ec98c823..9d6e4ac3228 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -486,10 +486,7 @@ function, it is changed to a list of functions."
486 (if (or (not (listp old)) (eq (car old) 'lambda)) 486 (if (or (not (listp old)) (eq (car old) 'lambda))
487 (set hook (list old)))) 487 (set hook (list old))))
488 (or (if (consp function) 488 (or (if (consp function)
489 ;; Clever way to tell whether a given lambda-expression 489 (member function (symbol-value hook))
490 ;; is equal to anything in the hook.
491 (let ((tail (assoc (cdr function) (symbol-value hook))))
492 (equal function tail))
493 (memq function (symbol-value hook))) 490 (memq function (symbol-value hook)))
494 (set hook 491 (set hook
495 (if append 492 (if append
@@ -508,7 +505,7 @@ list of hooks to run in HOOK, then nothing is done. See `add-hook'."
508 (let ((hook-value (symbol-value hook))) 505 (let ((hook-value (symbol-value hook)))
509 (if (consp hook-value) 506 (if (consp hook-value)
510 (setq hook-value (delete function hook-value)) 507 (setq hook-value (delete function hook-value))
511 (if (eq hook-value function) 508 (if (equal hook-value function)
512 (setq hook-value nil))) 509 (setq hook-value nil)))
513 (set hook hook-value)))) 510 (set hook hook-value))))
514 511