[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: keyboard-escape-quit
From: |
Drew Adams |
Subject: |
RE: keyboard-escape-quit |
Date: |
Sun, 21 Mar 2010 22:41:26 -0700 |
> > Does it work with `query-replace' for you, or is that part
> > of the doc just wrong? And again, I don't understand some of that
> > q-r code. Whereas the code for deactivating the region is
> > straightforward, the code for exiting `query-replace' with
> > ESC ESC ESC is not (to me).
>
> Yes, it works with `query-replace' for me, but that's because
> I've rebound `keyboard-escape-quit' to the single ESC :-) But
> when I try with `emacs -Q', the first ESC exits `query-replace'.
> Could you please try typing ESC with `query-replace' in Emacs 20.
> Maybe some relatively recent change broke this feature.
Emacs 20, 22, and 23, including pretest 23.1.92, all behave the same (emacs -Q
on Windows).
But actually it is not that the first ESC exits. I misspoke a bit. What I said I
saw in the code is what actually happens. The first ESC is simply pushed back
onto the `unread-command-events', as is any other key/char that is not
recognized by query-replace. Eventually, with ESC ESC ESC (3 ESC's being pushed
onto `unread-command-events'), `keyboard-escape-quit' is called, and it sees
that `last-command' is `mode-exited', so it returns nil and `query-replace'
exits.
If you wait after hitting ESC, you'll see "ESC" appear in the echo area. If you
then hit `0' (another unrecognized key), you'll see "ESC 0 ", and so on. As long
as you hit an unrecognized key (e.g. `0'), it'll just be added to the echo area:
"ESC 0 0 0 0"....
If you hit left arrow after the first ESC, then you'll see "ESC left" in the
echo area and you will really have exited, since ESC <left> is bound. Same thing
for ESC ESC ESC. But if you use `ESC ESC right' then you'll see "ESC ESC <right>
is undefined" in the echo area. (Not sure why the difference in behavior there -
haven't tried to figure it out.)
So I guess the doc is not totally incorrect wrt ESC ESC ESC for query-replace.
But the q-r code seems more complex than it should need to be in this regard,
and the behavior seems a bit inconsistent (or not obvious, let's put it that
way). But as I said before, I'm probably missing something - it's not real clear
to me.
Seems like `keyboard-escape-quit' could just do something similar to what it
does for `transient-mark-mode': have an explicit test for some `query-replace'
state. Or perhaps `perform-replace' could just set `buffer-quit-function'.
Dunno.
- Re: AW: delete-selection-mode, (continued)
- Re: AW: delete-selection-mode, Stefan Monnier, 2010/03/18
- RE: AW: delete-selection-mode, Drew Adams, 2010/03/18
- Re: AW: delete-selection-mode, Juri Linkov, 2010/03/19
- Re: AW: delete-selection-mode, Miles Bader, 2010/03/19
- RE: AW: delete-selection-mode, Drew Adams, 2010/03/19
- keyboard-escape-quit (was: delete-selection-mode), Juri Linkov, 2010/03/20
- RE: keyboard-escape-quit (was: delete-selection-mode), Drew Adams, 2010/03/21
- Re: keyboard-escape-quit, Juri Linkov, 2010/03/21
- RE: keyboard-escape-quit, Drew Adams, 2010/03/21
- Re: keyboard-escape-quit, Juri Linkov, 2010/03/21
- RE: keyboard-escape-quit,
Drew Adams <=
- Re: keyboard-escape-quit, Stefan Monnier, 2010/03/22
- Re: AW: delete-selection-mode, Stefan Monnier, 2010/03/20
- Re: AW: delete-selection-mode, Juri Linkov, 2010/03/18
- Re: AW: delete-selection-mode, David Kastrup, 2010/03/19
- Re: AW: delete-selection-mode, Chong Yidong, 2010/03/19
- Re: AW: delete-selection-mode, Stefan Monnier, 2010/03/19
- Re: AW: delete-selection-mode, Michael Albinus, 2010/03/19
- Re: AW: delete-selection-mode, Miles Bader, 2010/03/19
- Bell (was: delete-selection-mode), Juri Linkov, 2010/03/19
- RE: Bell (was: delete-selection-mode), Drew Adams, 2010/03/19