From: Robert Weiner <rsw@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: Problem quitting properly from transient keymap with one keystroke
Date: Fri, 20 Oct 2017 12:04:51 -0400 [thread overview]
Message-ID: <CA+OMD9gyTHjdapgsPAKgfhrvMiDyTLc30_nHTkAjssa_YHyBfQ@mail.gmail.com> (raw)
In-Reply-To: <jwvmv4ln9ih.fsf-monnier+gmane.emacs.devel@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 2104 bytes --]
On Fri, Oct 20, 2017 at 11:13 AM, Stefan Monnier <monnier@iro.umontreal.ca>
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
[-- Attachment #2: Type: text/html, Size: 4718 bytes --]
next prev parent reply other threads:[~2017-10-20 16:04 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-19 3:13 Problem quitting properly from transient keymap with one keystroke Bob Weiner
2017-10-19 15:40 ` Robert Weiner
2017-10-20 12:24 ` Stefan Monnier
2017-10-20 12:27 ` Stefan Monnier
2017-10-20 14:45 ` Robert Weiner
2017-10-20 15:13 ` Stefan Monnier
2017-10-20 16:04 ` Robert Weiner [this message]
2017-10-20 17:34 ` Stefan Monnier
2017-10-20 17:51 ` Robert Weiner
2017-10-20 12:42 ` Oleh Krehel
2017-10-20 14:32 ` Robert Weiner
2017-10-20 14:36 ` Robert Weiner
2017-10-20 14:44 ` Stefan Monnier
2017-10-20 15:26 ` Oleh Krehel
2017-10-20 17:30 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CA+OMD9gyTHjdapgsPAKgfhrvMiDyTLc30_nHTkAjssa_YHyBfQ@mail.gmail.com \
--to=rsw@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=rswgnu@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).