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: Drew Adams
Subject: bug#45393: 27.1; Make remove-hook (interactive
Date: Wed, 23 Dec 2020 08:55:22 -0800 (PST)

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'.

Attachment: throw-add-remove-hook.el
Description: Binary data


reply via email to

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