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


View this message in rfc822 format

From: Drew Adams <drew.adams <at> oracle.com>
To: Thibault Polge <thibault <at> thb.lt>, 45393 <at> debbugs.gnu.org
Subject: bug#45393: 27.1; Make remove-hook (interactive
Date: Wed, 23 Dec 2020 08:55:22 -0800 (PST)
[Message part 1 (text/plain, inline)]
1. I think this is a fine idea.

For one thing, it'll help with the gotcha of
someone misguidedly using a lambda form as a
hook function (which requires using the same
form for removal).  Instead of having to type
the lambda form exactly for `remove-hook', it
can be retrieved from the history.

2. Please add a space char at the end of the
"Function:" prompt.

3. The doc string should maybe start with a
description of the interactive use.  I think
that's typical.  And that description should
describe each arg (instead of the interactive
description just referring to the Lisp
description).

On the other hand, 90% of the uses will not
be interactive, so maybe that general rule
shouldn't be followed here?

4. I suggest doing the same for `add-hook',
and letting `remove-hook' use the last hook
added interactively as default when reading
the hook.

Attached is some quick-and-dirty code that
does that, to show what I mean.  If the idea
is accepted then we can work out a patch.

When `add-hook' is used interactively (only),
the hook var and function are recorded in
vars `last-add-hook-var' and `hook-history'.
[throw-add-remove-hook.el (application/octet-stream, attachment)]

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.