From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Derek Upham <sand@blarg.net>
Cc: emacs-devel@gnu.org
Subject: Re: read_char() does not detect, handle special-event-map buffer changes
Date: Mon, 11 Feb 2013 14:22:06 -0500 [thread overview]
Message-ID: <jwvip5yy8b4.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87haln1ks1.fsf@priss.frightenedpiglet.com> (Derek Upham's message of "Thu, 07 Feb 2013 20:39:42 -0800")
> Did you see my comment in the original email? read_char() is already
> trying to detect changed keymaps.
> if (current_buffer != prev_buffer)
> {
> /* The command may have changed the keymaps. Pretend there
> is input in another keyboard and return. This will
> recalculate keymaps. */
> c = make_number (-2);
> goto exit;
> }
> else
> goto retry;
> The bug is happening because the test is flawed: current_buffer and
> prev_buffer are the same, so Emacs doesn't think it needs to recalculate
> anything. It loops back to the top of read_char() and reads another
> character with the same keymap.
I know, but I'm still weary of the possible side-effects. The change
I was proposing (to delay computation of the set of active keymaps to
after we got the first event) also has the advantage that it is not
specific to special-event-map, so it's desirable in any case.
> This removes a flawed optimization and returns a documented value.
The main issue is that it's not clear what should happen if you switch
buffers in the middle (rather than before the beginning) of
a key sequence. And I'd rather not have to think about it ;-)
> It doesn't touch read_key_sequence, so that risk goes away.
I've just installed a patch (in trunk) which touches read_key_sequence
intrusively (in case you still had doubts whether I was a masochist).
This should hopefully fix your problem (at least it fixes the
sigusr1-handler test case you sent). It also cleans up the code a bit.
Hopefully it doesn't introduce too many new problems.
Stefan
next prev parent reply other threads:[~2013-02-11 19:22 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-04 8:36 read_char() does not detect, handle special-event-map buffer changes Derek Upham
2013-02-07 6:33 ` Derek Upham
2013-02-07 14:50 ` Derek Upham
2013-02-07 16:25 ` Stefan Monnier
2013-02-08 4:39 ` Derek Upham
2013-02-08 7:35 ` Michael Albinus
2013-02-08 15:32 ` Derek Upham
2013-02-08 16:11 ` Michael Albinus
2013-02-09 5:31 ` Derek Upham
2013-02-11 19:22 ` Stefan Monnier [this message]
2013-02-12 5:29 ` Derek Upham
2013-02-12 14:02 ` 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=jwvip5yy8b4.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
--cc=sand@blarg.net \
/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).