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 #128 received at 78916 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 78916 <at> debbugs.gnu.org, kupfer <at> rawbw.com
Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop
Date: Sat, 05 Jul 2025 10:37:50 -0400
>> Having grep'd further for `query-replace-map` in *.el and *.texi files,
>> I'm beginning to think we should let those sleeping dogs lie: other uses
>> follow the pattern of `y-or-n-p` of not supporting "arbitrary" commands.
>> Most uses I found are in Emacs, but some are in third party packages, so
>> there's a non-trivial backward compatibility issue in changing the
>> bindings from `quit` to something like `keyboard-quit`.
>> 
>> So maybe the simpler patch below is preferable.
>> 
>> 
>>         Stefan
>> 
>> 
>> diff --git a/lisp/replace.el b/lisp/replace.el
>> index 9939273594f..130c19763f2 100644
>> --- a/lisp/replace.el
>> +++ b/lisp/replace.el
>> @@ -3328,6 +3331,7 @@ perform-replace
>>  			 (replace-dehighlight)
>>  			 (save-excursion (recursive-edit))
>>  			 (setq replaced t))
>> +			((eq def 'quit) (keyboard-quit))
>>                          ((commandp def t)
>>                           (call-interactively def))
>>  			;; Note: we do not need to treat `exit-prefix'
> But if the key that causes 'quit' can be re-read and re-executed after
> exiting the replace, shouldn't we do that?

No, the documented behavior of the `quit` binding is to "Perform a quit
right away", and as Mike's example shows, we don't know that unreading
will do the right thing for us.

> Because AFAIU the above will not make C-] behave as intended.

Depends what you mean by "as intended".

> IOW, C-g might require special handling if it is bound to 'quit', but
> other keys should be given back to the event queue.  Right?

IMO, if users want to give it back to the event queue, then they should
not give it a binding at all.

My point is that these bindings are used in more places than Q&R, so we
can't just change the bindings so easily.


        Stefan





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.