Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop

From: Stefan Monnier <[email-masked]>
Date: Fri, 04 Jul 2025 14:06:13 -0400

> LGTM, thanks.

Hmm... I'm getting cold feet.

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'