GNU bug report logs - #78916
31.0.50; C-g fails to exit loop

Previous Next

Package: emacs;

Reported by: Mike Kupfer <kupfer <at> rawbw.com>

Date: Fri, 27 Jun 2025 21:37:02 UTC

Severity: normal

Found in version 31.0.50

Full log


Message #137 received at 78916 <at> debbugs.gnu.org (full text, mbox):

From: Pip Cet <pipcet <at> protonmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 78916 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, kupfer <at> rawbw.com
Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop
Date: Sun, 06 Jul 2025 11:12:49 +0000
"Stefan Monnier" <monnier <at> iro.umontreal.ca> writes:

>>>> (However, there are other good reason not to apply this patch, and
>>>> simply fix read-key to optionally allow quitting instead.
>>>
>>> The way I see it, part of this bug-report points out a bug in Q&R which
>>> applies not just to `C-g` but also to `C-]`, i.e. to any key bound to
>>> `quit` in `query-replace-map`, so what you suggest would just
>>> re-circumvent that bug for the `C-g` case, leaving the other case broken.
>>
>> Serious question: doesn't it apply to ESC, too?  It's exit-prefix, not
>> quit, but rereading it over and over again also breaks Mike's loop, I
>> think.
>
> ESC is bound to `exit-prefix` which is documented as:
>
>     ‘exit-prefix’
>          Like ‘exit’, but add the key that was pressed to
>          ‘unread-command-events’ (*note Event Input Misc::).
>
> so it looks OK to me: maybe it's not the behavior Mike would prefer, but
> at least it's in line with what the doc says.

I think I'm terminally confused now.

I'm fine with ESC and C-] behaving in whatever way seems best to the
rest of you.

They're not mentioned in query-replace-help, and they're not mentioned
in emacs.info, so the only way to get an idea (correct or incorrect) of
how they behave is to read some Lisp (inspect a variable, at least) as
well as some of the documentation, right?

So I no longer think there are good reasons not to apply this patch;
some further work seems necessary (see below), but fixing this bug
should have priority.

We might want to consider offering a customization option to disable the
entire "unhandled commands cause an exit and get reread" behavior.  It
seems extremely surprising to me, and it means any addition to
query-replace-map will break someone's muscle memory.

I'm still thinking about whether it's really the right thing to give
read-key a "quit" argument; we might want to invoke keyboard-quit
instead (this would require fixing the interrupted-timer thing), or we
might want to use new functions (read-key-sequence already has five
optional arguments, making it painful to use from Lisp even with eldoc).

Pip





This bug report was last modified 25 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.