changeset 29062:a11f776c0efc

(remove-hook): Don't turn the hook's value into a list.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sun, 21 May 2000 23:23:40 +0000
parents 879e653bd683
children 594a655b83cf
files lisp/subr.el
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/subr.el	Sun May 21 19:51:14 2000 +0000
+++ b/lisp/subr.el	Sun May 21 23:23:40 2000 +0000
@@ -733,11 +733,10 @@
     (unless (and (consp (symbol-value hook)) (memq t (symbol-value hook)))
       (setq local t)))
   (let ((hook-value (if local (symbol-value hook) (default-value hook))))
-    ;; If the hook value is a single function, turn it into a list.
-    (when (or (not (listp hook-value)) (eq (car hook-value) 'lambda))
-      (setq hook-value (list hook-value)))
-    ;; Do the actual removal if necessary
-    (setq hook-value (delete function (copy-sequence hook-value)))
+    ;; Remove the function, for both the list and the non-list cases.
+    (if (or (not (listp hook-value)) (eq (car hook-value) 'lambda))
+	(if (equal hook-value function) (setq hook-value nil))
+      (setq hook-value (delete function (copy-sequence hook-value))))
     ;; If the function is on the global hook, we need to shadow it locally
     ;;(when (and local (member function (default-value hook))
     ;;	       (not (member (cons 'not function) hook-value)))