changeset 5302:d907b978082e

(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.
author Richard M. Stallman <rms@gnu.org>
date Thu, 23 Dec 1993 04:43:01 +0000
parents 7caf06258d7b
children 8e6ba05e1271
files lisp/subr.el
diffstat 1 files changed, 2 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/subr.el	Thu Dec 23 04:42:26 1993 +0000
+++ b/lisp/subr.el	Thu Dec 23 04:43:01 1993 +0000
@@ -486,10 +486,7 @@
     (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 @@
     (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))))