summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1993-12-23 04:43:01 +0000
committerRichard M. Stallman <rms@gnu.org>1993-12-23 04:43:01 +0000
commitf48c1d8d7cb0278edbfcaf45ecbf3e93f3f653ed (patch)
tree67c07bbbb8ec96baaf73e2b65ba1326f2eb6d9f0
parentd226f0a6b1f16eb0beb9935de75e9987d0ace15f (diff)
downloademacs-f48c1d8d7cb0278edbfcaf45ecbf3e93f3f653ed.tar.gz
(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.
-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."
(if (or (not (listp old)) (eq (car old) 'lambda))
(set hook (list old))))
(or (if (consp function)
- ;; Clever way to tell whether a given lambda-expression
- ;; is equal to anything in the hook.
- (let ((tail (assoc (cdr function) (symbol-value hook))))
- (equal function tail))
+ (member function (symbol-value hook))
(memq function (symbol-value hook)))
(set hook
(if append
@@ -508,7 +505,7 @@ list of hooks to run in HOOK, then nothing is done. See `add-hook'."
(let ((hook-value (symbol-value hook)))
(if (consp hook-value)
(setq hook-value (delete function hook-value))
- (if (eq hook-value function)
+ (if (equal hook-value function)
(setq hook-value nil)))
(set hook hook-value))))