GNU bug report logs - #45393
27.1; Make remove-hook (interactive

Previous Next

Package: emacs;

Reported by: Thibault Polge <thibault <at> thb.lt>

Date: Wed, 23 Dec 2020 13:23:02 UTC

Severity: normal

Tags: fixed

Found in version 27.1

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #18 received at 45393 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Thibault Polge <thibault <at> thb.lt>, 45393 <at> debbugs.gnu.org
Subject: Re: bug#45393: 27.1; Make remove-hook (interactive
Date: Mon, 04 Jan 2021 19:39:58 +0200
[Message part 1 (text/plain, inline)]
>> 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:

[remove-hook-default.patch (text/x-diff, inline)]
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)

This bug report was last modified 4 years and 197 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.