From e4da9c1c34f9765b4d067886e8dd7c9a82cc8604 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 21 May 2000 23:24:18 +0000 Subject: [PATCH] (remove-hook): Don't turn the hook's value into a list. --- lisp/ChangeLog | 4 ++++ lisp/subr.el | 9 ++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1ebc720cae0..159a64ed380 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2000-05-21 Stefan Monnier + + * subr.el (remove-hook): Don't turn the hook's value into a list. + 2000-05-21 Dave Love * edmacro.el (edmacro-parse-keys): Return vector if any elements diff --git a/lisp/subr.el b/lisp/subr.el index 65d26d2007a..e33d2b027f5 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -733,11 +733,10 @@ To make a hook variable buffer-local, always use (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))) -- 2.39.5