bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#45393: 27.1; Make remove-hook (interactive


From: Juri Linkov
Subject: bug#45393: 27.1; Make remove-hook (interactive
Date: Mon, 04 Jan 2021 19:39:58 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>> The attached patch makes `remove-hook` interactive.
>
> Looks good; applied to Emacs 28 (after some minor white-space changes to
> make the lines shorter than 80 characters).

It's difficult to use this feature without a default value.
Here's the patch that adds it:

diff --git a/lisp/subr.el b/lisp/subr.el
index 1acc3c3250..ad0c812ed3 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1749,7 +1749,11 @@ remove-hook
 functions have the same representation under `princ', the first
 one will be removed."
   (interactive
-   (let* ((hook (intern (completing-read "Hook variable: " obarray #'boundp 
t)))
+   (let* ((default (and (symbolp (variable-at-point))
+                        (symbol-name (variable-at-point))))
+          (hook (intern (completing-read
+                         (format-prompt "Hook variable" default)
+                         obarray #'boundp t nil nil default)))
           (local
            (and
             (local-variable-p hook)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]