emacs-devel
[Top][All Lists]
Advanced

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

Re: Problem quitting properly from transient keymap with one keystroke


From: Robert Weiner
Subject: Re: Problem quitting properly from transient keymap with one keystroke
Date: Fri, 20 Oct 2017 12:04:51 -0400

On Fri, Oct 20, 2017 at 11:13 AM, Stefan Monnier <address@hidden> wrote:
>> > I can't just add a post-command-hook that calls the transient map
>> > disable function because calling (keyboard-quit) from the
>> > post-command-hook triggers an error and I imagine that is not a proper
>> > usage scenario.
>> Why do you need a post-command-hook?
> HyControl uses post-command-hook to persist a prefix-argument value across
> commands and to continually display a help message in the minibuffer until
> exit.

But neither of those activities seem related to calling the exit
function or calling keyboard-quit.

​I thought you were just asking about how this library used post-command-hook with set-transient-map.

When {C-g} is pressed, we want to execute some actions and then terminate the transient map.  We could
do this in the {C-g} key binding itself rather than in post-command-hook.  I just tested and that does
indeed solve the problem.  Thanks much.

​​

​​
> ​​Just curious, why does set-transient-map use pre-command-hook instead of
​​
> post-command-hook​ to test whether or not to keep the transient-map
​​
> enabled?
​​

​​
Because we need to know which is the next command before we know whether
​​
to exit or not: E.g. after hitting C-u we don't know yet whether to
​​
exit, it's only once the user hits the next key that we know whether to
​​
exit (e.g. she pressed `a`) or stay (e.g. she pressed `5`).
​​

​​
And when she presses `a`, we need to exit *before* running the command
​​
bound to `a`: sometimes it could be OK to linger on until the end of
​​
the command bound to `a`, but not in general.

​I understand.  Would it be possible to make the exit function run on both pre- and post-command hook so that it could use the results of the command​ when needed and eliminate the need in many cases to call the quit function manually?  Or would that cause problems?

Bob


reply via email to

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