From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 27 17:36:33 2025 Received: (at submit) by debbugs.gnu.org; 27 Jun 2025 21:36:33 +0000 Received: from localhost ([127.0.0.1]:43567 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uVGkK-000230-KG for submit@debbugs.gnu.org; Fri, 27 Jun 2025 17:36:33 -0400 Received: from lists.gnu.org ([2001:470:142::17]:56200) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uVGkH-00022Q-UK for submit@debbugs.gnu.org; Fri, 27 Jun 2025 17:36:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uVGkB-0005Py-PT for bug-gnu-emacs@gnu.org; Fri, 27 Jun 2025 17:36:23 -0400 Received: from shell1.rawbw.com ([198.144.192.42]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uVGk9-0002ST-Mc for bug-gnu-emacs@gnu.org; Fri, 27 Jun 2025 17:36:23 -0400 Received: from bach.localdomain (135-180-175-182.dsl.dynamic.sonic.net [135.180.175.182] (may be forged)) (authenticated bits=0) by shell1.rawbw.com (8.15.1/8.15.1) with ESMTPSA id 55RLa6Yt065692 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Fri, 27 Jun 2025 14:36:12 -0700 (PDT) (envelope-from kupfer@rawbw.com) X-Authentication-Warning: shell1.rawbw.com: Host 135-180-175-182.dsl.dynamic.sonic.net [135.180.175.182] (may be forged) claimed to be bach.localdomain From: Mike Kupfer To: bug-gnu-emacs@gnu.org Subject: 31.0.50; C-g fails to exit loop X-Mailer: MH-E 8.6+git; nmh 1.8-RC2; Emacs 31.0.50 X-Debbugs-Cc: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Date: Fri, 27 Jun 2025 14:36:06 -0700 Message-ID: <24453.1751060166@bach.localdomain> Received-SPF: pass client-ip=198.144.192.42; envelope-from=kupfer@rawbw.com; helo=shell1.rawbw.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --=-=-= Content-Type: text/plain Recipe from 'emacs -Q': 1. Save the test-data attachment to a file. --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=test-data Content-Description: test data ("bug#78903:" -100 739429 s) ("bug#78907:" -100 739428 s) ("bug#78902:" -100 739429 s) ("bug#78637:" -100 739429 s) ("bug#78897:" -100 739428 s) ("bug#78900:" -100 739428 s) --=-=-= Content-Type: text/plain 2. Evaluate the following defun: (defun do-test () (while (re-search-forward "bug#[[:digit:]]+:" nil t) (search-backward "(\"bug") (let (end (start (point))) (forward-sexp) (setq end (point)) (query-replace-regexp "\\(\"bug#[[:digit:]]+:\\).*\"" "\\1\"" nil start end)))) 3. Visit the test data file. With point at the start of the buffer, run the do-test function, and press space a couple times. Now press C-g. Expected behavior: The do-test function stops executing, and point is left at the same position where you pressed C-g. (This is the behavior I see with Emacs 30 and with a build derived from Emacs master 648453c04d9.) Observed behavior: point progresses through the remaining sexps, without giving you any query-replace prompt. When do-test has finished, point is now after '"bug#78900:"'. The git hash reported below by 'report-emacs-bug' includes a few Lisp changes that I believe are unrelated to the issue, and which are unchanged from the Emacs master build that works as expected. The corresponding git hash from master (for the buggy build) is a002ca79ee7. In GNU Emacs 31.0.50 (build 11, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw scroll bars) of 2025-06-26 built on bach Repository revision: 272a10db724bf17aa4af0e958d3b41c996d22c4a Repository branch: master-mdk Windowing system distributor 'The X.Org Foundation', version 11.0.12101007 System Description: Debian GNU/Linux 12 (bookworm) Configured using: 'configure --prefix=/usr/new --enable-checking' Configured features: CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM XPM LUCID ZLIB Important settings: value of $LC_TIME: C value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix Major mode: Shell Minor modes in effect: server-mode: t shell-dirtrack-mode: t delete-selection-mode: t display-time-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t minibuffer-regexp-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow mh-identity mh-tool-bar mh-letter mh-show goto-addr thingatpt gnus-cite mh-mime mh-acros mh-xface mh-utils emacsbug lisp-mnt files-x mdk-mail gnus-mh gnus-msg mh-comp mh-scan mh-gnus gnus-dup nnmh gnus-score score-mode gnus-art mm-uu mml2015 mm-view mml-smime smime gnutls dig gnus-sum shr pixel-fill kinsoku url-file svg dom gnus-group gnus-undo gnus-start gnus-dbus dbus xml gnus-cloud nnimap nnmail browse-url xdg url url-proxy url-privacy url-expand url-methods url-history url-cookie generate-lisp-file url-domsuf url-util url-parse auth-source cl-seq eieio eieio-core cl-macs json map byte-opt gv bytecomp byte-compile url-vars mail-source utf7 nnoo parse-time iso8601 gnus-spec gnus-int gnus-range gnus-win gnus nnheader range wid-edit mh-e mh-buffers mh-loaddefs message sendmail mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils mailheader server warnings timeclock noutline outline icons cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs advice shell pcomplete comint subr-x ansi-osc ansi-color ring xcscope delsel time vc cl-loaddefs cl-lib vc-dispatcher mdk-hacks rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd touch-screen tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind inotify dynamic-setting system-font-setting font-render-setting cairo x-toolkit x multi-tty move-toolbar make-network-process tty-child-frames emacs) Memory information: ((conses 16 179700 20237) (symbols 48 18865 0) (strings 32 55102 2372) (string-bytes 1 1569839) (vectors 16 32210) (vector-slots 8 312579 6626) (floats 8 225 15) (intervals 56 310 0) (buffers 984 13)) --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Jun 28 02:51:14 2025 Received: (at 78916) by debbugs.gnu.org; 28 Jun 2025 06:51:14 +0000 Received: from localhost ([127.0.0.1]:46406 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uVPP7-0002Wr-FN for submit@debbugs.gnu.org; Sat, 28 Jun 2025 02:51:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33186) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uVPP3-0002Vh-V3 for 78916@debbugs.gnu.org; Sat, 28 Jun 2025 02:51:11 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uVPOx-0000xT-H8; Sat, 28 Jun 2025 02:51:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=BB3yd7FqA0MqtApqpWEZRP91o35ffV405EGL0rG7VCA=; b=aWmLlRJkTMHM lOOrzsCuQmSp+z5ezinPYZHmVoyEFsLS5ctGu1zFVRDFf9KCAOklDQS31uSZCqitz0DQV/tCh4pFo iP/FCHOZNJoCdH+AhdCMNvz/ry+p9iNCtBWRLZlohzJcYVkZFxVk9oM4dblri8tW51t9YPje+FHWU YoN8cMoPri8RMGa1zeHieAKISoVuqooDWRtrQ1S16lzrFSAivCvR6H04m52CVGUuUsYvgumYGszb0 CjQ5gF2vKjOBpb4+Q2FQY/wCp2W3OatR+ULeE7HJmn+x2htflELSikHbgIa/YO1LW4GemJj3hmb68 ZK3EOc/1O0ur3B4I+J5OmA==; Date: Sat, 28 Jun 2025 09:51:00 +0300 Message-Id: <86y0tc8iln.fsf@gnu.org> From: Eli Zaretskii To: Mike Kupfer , Stefan Monnier In-Reply-To: <24453.1751060166@bach.localdomain> (message from Mike Kupfer on Fri, 27 Jun 2025 14:36:06 -0700) Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop References: <24453.1751060166@bach.localdomain> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Mike Kupfer > Date: Fri, 27 Jun 2025 14:36:06 -0700 > > Recipe from 'emacs -Q': > > 1. Save the test-data attachment to a file. > > 2. Evaluate the following defun: > > (defun do-test () > (while (re-search-forward "bug#[[:digit:]]+:" nil t) > (search-backward "(\"bug") > (let (end (start (point))) > (forward-sexp) > (setq end (point)) > (query-replace-regexp "\\(\"bug#[[:digit:]]+:\\).*\"" "\\1\"" > nil start end)))) > > 3. Visit the test data file. With point at the start of the buffer, run > the do-test function, and press space a couple times. Now press C-g. > > Expected behavior: > > The do-test function stops executing, and point is left at the same > position where you pressed C-g. (This is the behavior I see with > Emacs 30 and with a build derived from Emacs master 648453c04d9.) > > Observed behavior: > > point progresses through the remaining sexps, without giving you any > query-replace prompt. When do-test has finished, point is now after > '"bug#78900:"'. > > The git hash reported below by 'report-emacs-bug' includes a few Lisp > changes that I believe are unrelated to the issue, and which are > unchanged from the Emacs master build that works as expected. The > corresponding git hash from master (for the buggy build) is a002ca79ee7. I think the offending commit is this: commit 772c4f036c38efd2a81d3643ad0bd718033d3b7f Author: Stefan Monnier AuthorDate: Thu May 22 09:32:33 2025 -0400 Commit: Stefan Monnier CommitDate: Thu May 22 09:33:14 2025 -0400 (perform-replace): Make it work with F-keys in TTYs (bug#78113) * lisp/replace.el (perform-replace): Use `read-key`. * test/lisp/replace-tests.el (replace-tests-with-undo): Adjust accordingly. The build from commit cb1b65f3923d5dcb88767f6736603ffbc4272557, 3 commits before that, doesn't exhibit this problem. From debbugs-submit-bounces@debbugs.gnu.org Sat Jun 28 15:14:48 2025 Received: (at 78916) by debbugs.gnu.org; 28 Jun 2025 19:14:48 +0000 Received: from localhost ([127.0.0.1]:52083 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uVb0h-0004lB-91 for submit@debbugs.gnu.org; Sat, 28 Jun 2025 15:14:48 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:62448) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uVb0d-0004kO-9z for 78916@debbugs.gnu.org; Sat, 28 Jun 2025 15:14:45 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 00F3F80925; Sat, 28 Jun 2025 15:14:37 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1751138076; bh=3WgH3xs+OAH7h9fNoPfCLFrYB6CIq+xhtXagkU8SOSQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=ADb9YPmKad2ENc7sqlq5SezH91lccMt+mxAvLKR00N+c/4zkDnA82Qd+57FMq0HL3 rrzYoAYPVhEVDFTDecLqKYAbUkJiDh2LMA/hlWP9+splH0marSZcheh0BHhyTbIJ0U xrZjr8qWi+/oA8/lHgwVshFwdy2lAQMFPrugdPn5ueBnZQiWbyHXhyRSEeXXUMlzWy H1IKxnipS0u62y/qOVnZyuLcs2rG4krtukhcg0qFZZES/oQCgqoKlwdTqww6LBac5K NUEXZHdjlBAWSAgl9LXRyiPYgmzjp3bCz2QSgJ5C1zInqRL6HBe+hTOfk5oIaQVFd7 qxKt1w/l8kUxQ== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 19859801B1; Sat, 28 Jun 2025 15:14:36 -0400 (EDT) Received: from pastel (unknown [104.247.225.139]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id CFE7C1204C9; Sat, 28 Jun 2025 15:14:35 -0400 (EDT) From: Stefan Monnier To: Mike Kupfer Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop In-Reply-To: <24453.1751060166@bach.localdomain> Message-ID: References: <24453.1751060166@bach.localdomain> Date: Sat, 28 Jun 2025 15:14:34 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.309 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Mike, > 2. Evaluate the following defun: > > (defun do-test () > (while (re-search-forward "bug#[[:digit:]]+:" nil t) > (search-backward "(\"bug") > (let (end (start (point))) > (forward-sexp) > (setq end (point)) > (query-replace-regexp "\\(\"bug#[[:digit:]]+:\\).*\"" "\\1\"" > nil start end)))) > > 3. Visit the test data file. With point at the start of the buffer, run > the do-test function, and press space a couple times. Now press C-g. > > Expected behavior: > > The do-test function stops executing, and point is left at the same > position where you pressed C-g. (This is the behavior I see with > Emacs 30 and with a build derived from Emacs master 648453c04d9.) > > Observed behavior: > > point progresses through the remaining sexps, without giving you any > query-replace prompt. When do-test has finished, point is now after > '"bug#78900:"'. [ Thanks for your report. I think this is a great data-point for the recent discussion around making `read-event` consistently return `C-g` (instead of signaling `quit`). ] In `query-replace-map` we have: (define-key map "\C-g" 'quit) (define-key map "\C-]" 'quit) In Emacs<31 `C-g` gave what you describe as "Expected behavior", and `C-]` gave what you describe as "Observed behavior". In `master`, they now both behave in the same way. I think the fact that the behave the same way is good/right since they have the same binding in the keymap. So what do we want: - Both keys behave like the "old C-g". - Both keys behave like the "old C-]" (i.e. what we have now). - Reintroduce the difference of behavior between `C-g` and `C-]`, presumably by giving them different bindings in `query-replace-map. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Jun 28 19:28:45 2025 Received: (at 78916) by debbugs.gnu.org; 28 Jun 2025 23:28:46 +0000 Received: from localhost ([127.0.0.1]:52736 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uVeyR-0002jk-PF for submit@debbugs.gnu.org; Sat, 28 Jun 2025 19:28:45 -0400 Received: from shell1.rawbw.com ([198.144.192.42]:10623 ident=root) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uVeyN-0002iv-Ih for 78916@debbugs.gnu.org; Sat, 28 Jun 2025 19:28:40 -0400 Received: from bach.localdomain (135-180-175-182.dsl.dynamic.sonic.net [135.180.175.182] (may be forged)) (authenticated bits=0) by shell1.rawbw.com (8.15.1/8.15.1) with ESMTPSA id 55SNSWRF014178 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 28 Jun 2025 16:28:38 -0700 (PDT) (envelope-from kupfer@rawbw.com) X-Authentication-Warning: shell1.rawbw.com: Host 135-180-175-182.dsl.dynamic.sonic.net [135.180.175.182] (may be forged) claimed to be bach.localdomain From: Mike Kupfer To: Stefan Monnier Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop In-reply-to: References: <24453.1751060166@bach.localdomain> Comments: In-reply-to Stefan Monnier message dated "Sat, 28 Jun 2025 15:14:34 -0400." X-Mailer: MH-E 8.6+git; nmh 1.8-RC2; Emacs 31.0.50 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <34219.1751153312.1@bach.localdomain> Date: Sat, 28 Jun 2025 16:28:32 -0700 Message-ID: <34220.1751153312@bach.localdomain> X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Stefan Monnier wrote: > In `master`, they now both behave in the same way. I think the fact > that the behave the same way is good/right since they have the same > binding in the keymap. That makes sense. > So what do we want: > > - Both keys behave like the "old C-g". > - Both keys behave like the "old C-]" (i.e. what we have now). > - Reintroduce the difference of behavior between `C-g` and `C-]`, > presumably by giving them different bindings in `query-replace-map. Is there a use case for the current behavior? I definitely want to have the "old C-g" behavior available. I think it makes sense for C-g to provide that behavior. Different bindings in query-replace-map seems like a clean way to achieve that. thanks, mike From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 29 01:14:04 2025 Received: (at 78916) by debbugs.gnu.org; 29 Jun 2025 05:14:04 +0000 Received: from localhost ([127.0.0.1]:54015 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uVkMe-0007dh-9T for submit@debbugs.gnu.org; Sun, 29 Jun 2025 01:14:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59038) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uVkMb-0007c1-SK for 78916@debbugs.gnu.org; Sun, 29 Jun 2025 01:14:02 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uVkMW-00030V-5g; Sun, 29 Jun 2025 01:13:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=jGIH4SFmaFGajSwYKFoS43/byEVbmW/LIjai9U2B3nw=; b=IMnj8gP/hqds 8o5phFPpMJ7pwxSv9r4nMONEDx7Y0CVLF8dd4jsINRqTr4EZ0oEJdYm/iOuZ3Wu4UF3LdsXdeGDW0 fb+eXSwMb1M2yjBfelPpGGRkjwmc6KeHgGvcvOwcv/2KH+MuRqb6kTmvM/D53mWufFBXtsRxWIUQD PO7mFr427uDJf1Y0vsx8LJiuIs8N2dbSU5xR5uhiq8BWL5DU5UsHC32dbq/sw87dH2rZABuZgqjKo n2L0VPyHIEYJzkdh4UZv2K+70koCqGW3N1Ai3+NmTZcvMXG3/yt2SjQx82+9uJOKG2A6hkPfsmewi OoxPeWG5lkPwlR6CsxreRg==; Date: Sun, 29 Jun 2025 08:13:53 +0300 Message-Id: <86a55r5dv2.fsf@gnu.org> From: Eli Zaretskii To: Mike Kupfer In-Reply-To: <34220.1751153312@bach.localdomain> (message from Mike Kupfer on Sat, 28 Jun 2025 16:28:32 -0700) Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop References: <24453.1751060166@bach.localdomain> <34220.1751153312@bach.localdomain> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Cc: 78916@debbugs.gnu.org > From: Mike Kupfer > Comments: In-reply-to Stefan Monnier > message dated "Sat, 28 Jun 2025 15:14:34 -0400." > Date: Sat, 28 Jun 2025 16:28:32 -0700 > > Stefan Monnier wrote: > > > So what do we want: > > > > - Both keys behave like the "old C-g". > > - Both keys behave like the "old C-]" (i.e. what we have now). > > - Reintroduce the difference of behavior between `C-g` and `C-]`, > > presumably by giving them different bindings in `query-replace-map. > > Is there a use case for the current behavior? I definitely want to have > the "old C-g" behavior available. I think it makes sense for C-g to > provide that behavior. Agreed. From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 29 12:17:35 2025 Received: (at 78916) by debbugs.gnu.org; 29 Jun 2025 16:17:35 +0000 Received: from localhost ([127.0.0.1]:58357 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uVuij-0003Rb-Ut for submit@debbugs.gnu.org; Sun, 29 Jun 2025 12:17:35 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:58461) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uVuih-0003QM-OK for 78916@debbugs.gnu.org; Sun, 29 Jun 2025 12:17:32 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id ED738440945; Sun, 29 Jun 2025 12:17:25 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1751213840; bh=9NIfABBTcH7Hl2oTNI7HwPAyYZKAhkPXhjWbEQlGo0I=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=ZwKOFlwAP/WSL8AaS5Wdam2zeYQA9bOuW62vRZBoTUN8JHnJql5Iz86H4PZg3lTp2 SP4gs4WfMUBNM4U8FO/cansa3mW7kqaF1/Q1UO/3NNWiuJAYXSKthW4AASUvM1tWaX 4nOd8HVedj5etSEoxk9RbeAs9AbttK7apXKvb10Zx47irOpiOZeDVrw4/Y8W17JHZa aB+pNVgmUjN4tRKviwj5WTE1fFDmJ9ID/AYzpsKgHe58GkZNboXWJMcGGp3lrQ0ZR7 NvP9d9r1pW+TeaKhSBBy3dv/CXf+G1YdxNByyCHQLc/De+LXpURrZEqVoVivLHKPLk 0x9yXTF3hC6og== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id D944744018C; Sun, 29 Jun 2025 12:17:20 -0400 (EDT) Received: from pastel (unknown [104.247.225.139]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id ACCC112089B; Sun, 29 Jun 2025 12:17:20 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop In-Reply-To: <86a55r5dv2.fsf@gnu.org> Message-ID: References: <24453.1751060166@bach.localdomain> <34220.1751153312@bach.localdomain> <86a55r5dv2.fsf@gnu.org> Date: Sun, 29 Jun 2025 12:17:20 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.289 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, Mike Kupfer X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> > So what do we want: >> > >> > - Both keys behave like the "old C-g". >> > - Both keys behave like the "old C-]" (i.e. what we have now). >> > - Reintroduce the difference of behavior between `C-g` and `C-]`, >> > presumably by giving them different bindings in `query-replace-map. >> >> Is there a use case for the current behavior? I definitely want to have >> the "old C-g" behavior available. I think it makes sense for C-g to >> provide that behavior. > > Agreed. So IIUC the consensus is: - Both keys behave like the "old C-g". ? Stefan From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 29 13:34:35 2025 Received: (at 78916) by debbugs.gnu.org; 29 Jun 2025 17:34:35 +0000 Received: from localhost ([127.0.0.1]:58790 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uVvvH-0007U0-4U for submit@debbugs.gnu.org; Sun, 29 Jun 2025 13:34:35 -0400 Received: from shell1.rawbw.com ([198.144.192.42]:65389 ident=root) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uVvv9-0007Sh-AM for 78916@debbugs.gnu.org; Sun, 29 Jun 2025 13:34:33 -0400 Received: from bach.localdomain (135-180-175-182.dsl.dynamic.sonic.net [135.180.175.182] (may be forged)) (authenticated bits=0) by shell1.rawbw.com (8.15.1/8.15.1) with ESMTPSA id 55THYKHB016280 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 29 Jun 2025 10:34:25 -0700 (PDT) (envelope-from kupfer@rawbw.com) X-Authentication-Warning: shell1.rawbw.com: Host 135-180-175-182.dsl.dynamic.sonic.net [135.180.175.182] (may be forged) claimed to be bach.localdomain From: Mike Kupfer To: Stefan Monnier Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop In-reply-to: References: <24453.1751060166@bach.localdomain> <34220.1751153312@bach.localdomain> <86a55r5dv2.fsf@gnu.org> Comments: In-reply-to Stefan Monnier message dated "Sun, 29 Jun 2025 12:17:20 -0400." X-Mailer: MH-E 8.6+git; nmh 1.8-RC2; Emacs 31.0.50 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <19432.1751218460.1@bach.localdomain> Date: Sun, 29 Jun 2025 10:34:20 -0700 Message-ID: <19433.1751218460@bach.localdomain> X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, Eli Zaretskii X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Stefan Monnier wrote: > So IIUC the consensus is: > > - Both keys behave like the "old C-g". > > ? I'm fine with that. mike From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 30 08:07:39 2025 Received: (at 78916) by debbugs.gnu.org; 30 Jun 2025 12:07:39 +0000 Received: from localhost ([127.0.0.1]:41863 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uWDIQ-0004Nx-SV for submit@debbugs.gnu.org; Mon, 30 Jun 2025 08:07:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53236) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uWDIN-0004N2-LA for 78916@debbugs.gnu.org; Mon, 30 Jun 2025 08:07:36 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWDIG-0001iQ-LU; Mon, 30 Jun 2025 08:07:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=w1w4cq0WpjTAlxuox/nulR8md6RyPmcRBNJ5oKbfloY=; b=YUVZsrMp9cZ4 sGOPbn/4ol2r4LoOaXweo0FtEn/hfh0SiYpr8QoKRcefrYZm82xIBEVq83Npg0YIKsfaXgvKXPL/b HDH8yrcvfffq1T9/d7VmDGzEeuvNCS9FxWGXIQt8hF1YYXOVDlMTZ4fRm+j6Nzp7kMzNGu2bl+XwJ s0cNkgu/rGezK7pVda8Plt5wAP7Yp8VUax0V9dTNYlgQ/KU8nWycFe6tPa+Ag5xeszPuCSgljU0zK VR7bSRxSDA8WFAoPBOF7sptrWSgSj86o7daKjpb5l8sN1O4mcxtTkUTc/N4xtwHAJxDtKvdDFWRs7 SVbj5h5UUrNye93vLA7gcw==; Date: Mon, 30 Jun 2025 15:07:23 +0300 Message-Id: <86o6u54emc.fsf@gnu.org> From: Eli Zaretskii To: Mike Kupfer In-Reply-To: <19433.1751218460@bach.localdomain> (message from Mike Kupfer on Sun, 29 Jun 2025 10:34:20 -0700) Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop References: <24453.1751060166@bach.localdomain> <34220.1751153312@bach.localdomain> <86a55r5dv2.fsf@gnu.org> <19433.1751218460@bach.localdomain> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Mike Kupfer > cc: Eli Zaretskii , 78916@debbugs.gnu.org > Comments: In-reply-to Stefan Monnier > message dated "Sun, 29 Jun 2025 12:17:20 -0400." > Date: Sun, 29 Jun 2025 10:34:20 -0700 > > Stefan Monnier wrote: > > > So IIUC the consensus is: > > > > - Both keys behave like the "old C-g". > > > > ? > > I'm fine with that. Same, but does it mean 'C-g' will do the same as 'q'? If not, what is the difference between them? From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 30 12:01:21 2025 Received: (at 78916) by debbugs.gnu.org; 30 Jun 2025 16:01:21 +0000 Received: from localhost ([127.0.0.1]:46002 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uWGwZ-0001Kr-Oz for submit@debbugs.gnu.org; Mon, 30 Jun 2025 12:01:20 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:54554) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uWGwV-0001JN-ME for 78916@debbugs.gnu.org; Mon, 30 Jun 2025 12:01:17 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 14BDE100374; Mon, 30 Jun 2025 12:01:10 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1751299263; bh=Lt9FSt4WV4V8HYdVG2Ehsbfjow1gOVMyhH4v/VHes5U=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=ClsxMObrNx3F0SzyDASS9Zm9nUSbUu/LawV8eOqaprbG4qkkKe0Vahkly3+00Tayp Xxwgd3gdB+DAvC2h2rZA25T5uuaRLJ+KeuHQZ/tunjbjyYfSCkXz3/qnh4SsL/sCcZ P3jJWNKm+7s2tUkxO1U3c0aV9GMPtByTUSn0pHnlDeaMO0XZbGeAObo4HU2QY29ZgH zhsJOVqH41jhFFPuz2ugYKBW2ad5TiNfVkR4jcpAHd4Rv/h1mx6ge8zPFs48hByd/d 8GF+p0Z+pa2bctePoQTWAgWuNFTwqzF1DopgbnIo75s24K/FHC7nIfvL0640pRJ2ba WTCHmToTcrBQA== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 5F40610013E; Mon, 30 Jun 2025 12:01:03 -0400 (EDT) Received: from alfajor (bras-base-mtrlpq42zf4-grc-26-174-93-231-66.dsl.bell.ca [174.93.231.66]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 4A52212008F; Mon, 30 Jun 2025 12:01:03 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop In-Reply-To: <86o6u54emc.fsf@gnu.org> Message-ID: References: <24453.1751060166@bach.localdomain> <34220.1751153312@bach.localdomain> <86a55r5dv2.fsf@gnu.org> <19433.1751218460@bach.localdomain> <86o6u54emc.fsf@gnu.org> Date: Mon, 30 Jun 2025 12:01:02 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, Mike Kupfer X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.1 (---) >> > - Both keys behave like the "old C-g". >> > ? >> I'm fine with that. > Same, but does it mean 'C-g' will do the same as 'q'? If not, what is > the difference between them? Hmm... so `q` is bound to `exit` which consumes the key and exits the Q&R loop. In contrast `C-g` and `C-]` were bound to `quit` which is not handled exlicitly by the Q&R loop, instead it just pushes the event back on the `unread-commend-events` before exiting the loop, so in Mike's test case, `q` exits the inner Q&R and passes to the next, whereas `C-]` aborts all the subsequent Q&R calls after which it runs the global binding of `C-[`. I get the impression that the intention of the `replace.el` code when it pushes the event back on `unread-commend-events` is to make it run whichever binding is currently active "outside" (i.e. global or local keymap). IOW, we have many different ways to skin this cat and I'm not sure which is best. We can do something like: @@ -2491,7 +2491,7 @@ query-replace-map (define-key map [f1] 'help) (define-key map [help] 'help) (define-key map "?" 'help) - (define-key map "\C-g" 'quit) - (define-key map "\C-]" 'quit) + (define-key map "\C-g" #'keyboard-quit) + (define-key map "\C-]" #'keyboard-quit) (define-key map "\C-v" 'scroll-up) (define-key map "\M-v" 'scroll-down) or we can do something like: @@ -3328,6 +3328,9 @@ perform-replace (replace-dehighlight) (save-excursion (recursive-edit)) (setq replaced t)) + ((eq def 'quit) + ;; FIXME: Should we call `keyboard-quit'? + (signal 'quit nil)) ((commandp def t) (call-interactively def)) ;; Note: we do not need to treat `exit-prefix' or we can do something like: diff --git a/lisp/replace.el b/lisp/replace.el index 9939273594f..62cabb45c09 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -2491,7 +2491,7 @@ query-replace-map (define-key map [f1] 'help) (define-key map [help] 'help) (define-key map "?" 'help) - (define-key map "\C-g" 'quit) - (define-key map "\C-]" 'quit) + (define-key map "\C-g" 'normal-binding) + (define-key map "\C-]" 'normal-binding) (define-key map "\C-]" 'quit) (define-key map "\C-v" 'scroll-up) (define-key map "\M-v" 'scroll-down) @@ -3328,6 +3328,12 @@ perform-replace (replace-dehighlight) (save-excursion (recursive-edit)) (setq replaced t)) + ((eq def 'normal-binding) + (let ((cmd (key-binding (vector key)))) + (setq this-command cmd) + (setq keep-going nil) + (setq done t) + (execute-command cmd))) ((commandp def t) (call-interactively def)) ;; Note: we do not need to treat `exit-prefix' I lean towards the first option. Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 30 14:15:58 2025 Received: (at 78916) by debbugs.gnu.org; 30 Jun 2025 18:15:59 +0000 Received: from localhost ([127.0.0.1]:47849 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uWJ2q-0001P9-4t for submit@debbugs.gnu.org; Mon, 30 Jun 2025 14:15:58 -0400 Received: from mail-24416.protonmail.ch ([109.224.244.16]:57751) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uWJ2l-0001NE-7J for 78916@debbugs.gnu.org; Mon, 30 Jun 2025 14:15:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1751307343; x=1751566543; bh=uUyvMDU57u1ah2lCJVEuwVDUAauOsxN60HcUFDDT9jU=; h=Date:To:From:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=PcYvlTebaDReVFI6sj48XL5fbniid+V8qskOJpUyOtscM6ctV7KBpyjsNbWf+wS0M PZ+U++ocrOK++PzDGlUYbLgGCn7A1fUaTqY6/muLTWG73Q6ujb0BEr0TmZmZcklXTy yIQxqH3ATo+Si7e1qkhurypEMR1UBV/psc47vyT14kIxI4Q/1SVBq8VTfiOFWhEmim woLQHNTNmrIDUV4CNm1OT4cTTH1CCPQjOz6kokmtH0KB5hXsqyRraKBRRq5CfGT9vN t1uEwZQy7XIidRxMpZmDlApo3MscWJm/y9KSvro/eSGTWiZ7Zkwx2vRf8cXuKOjI/b ArkjOXDTO1lTw== Date: Mon, 30 Jun 2025 18:15:40 +0000 To: Eli Zaretskii , Stefan Monnier , 78916@debbugs.gnu.org, Mike Kupfer From: Pip Cet Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop Message-ID: <871pr1yu2g.fsf@protonmail.com> In-Reply-To: References: <24453.1751060166@bach.localdomain> <34220.1751153312@bach.localdomain> <86a55r5dv2.fsf@gnu.org> <19433.1751218460@bach.localdomain> <86o6u54emc.fsf@gnu.org> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: 95ce1d1160d30718843405320f947cf8561d5adf MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 78916 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) "Stefan Monnier via \"Bug reports for GNU Emacs, the Swiss army knife of te= xt editors\"" writes: >>> > - Both keys behave like the "old C-g". >>> > ? >>> I'm fine with that. >> Same, but does it mean 'C-g' will do the same as 'q'? If not, what is >> the difference between them? > > Hmm... so `q` is bound to `exit` which consumes the key and exits the > Q&R loop. In contrast `C-g` and `C-]` were bound to `quit` which is > not handled exlicitly by the Q&R loop, instead it just pushes the event > back on the `unread-commend-events` before exiting the loop, so in > Mike's test case, `q` exits the inner Q&R and passes to the next, > whereas `C-]` aborts all the subsequent Q&R calls after which it runs > the global binding of `C-[`. > I get the impression that the intention of the `replace.el` code when it > pushes the event back on `unread-commend-events` is to make it run > whichever binding is currently active "outside" (i.e. global or local > keymap). > > IOW, we have many different ways to skin this cat and I'm not sure which > is best. I'd just like to speak out in favor of making read-key take an extra argument to make it handle C-g the way read-event does; IIUC, the lack of this argument is the real problem here. If we don't, we should be very careful about replacing read-event by read-key, and revert most such changes. Switching from read-event to read-key should be possible without the (sometimes) undesirable change in C-g behavior. That doesn't mean we can't change the C-g/quit relationship at some future point; there's no consensus to change behavior now (not even to make C-g and C-] the same), so we shouldn't. (I still think it would be easiest to give up on a single C-g signaling a quit; if we move to requiring two C-g's, both of which are ordinary input up to the point where the second one triggers a quit, all the special cases go away.) Pip From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 30 15:00:19 2025 Received: (at 78916) by debbugs.gnu.org; 30 Jun 2025 19:00:20 +0000 Received: from localhost ([127.0.0.1]:48432 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uWJjl-0007HR-7c for submit@debbugs.gnu.org; Mon, 30 Jun 2025 15:00:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58314) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uWJjf-0007D5-6C for 78916@debbugs.gnu.org; Mon, 30 Jun 2025 15:00:13 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWJjY-0008RR-Tt; Mon, 30 Jun 2025 15:00:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=ZssOs3L7BTRHq7lWHIzsoXobiHfIG9bL64cQSjcXvy4=; b=YY+wBbe1MTK7 2VeGHc9g6jILDcu70iJD5xUYn+JKTyS8rp+ffl32rJRvA/h72deJp0pQw9pkk0VUS3b3YML5eEFhp WKXRc6Ma6N2eqqOo1bou5aLRPHNxp/4ye2B4exG4NgYy7Cf73HTLhQPY3wZnfkt1TEOKIMM6i4o3U 2WT5K39XaBSWFxNy3tP+Wxzap3ojPja5VJ8i4t1Ro4GH9kflk5jO2uplNiZyAuvrMcLTNjqRMoINW 44qB9czRM8z73F3dq/GX4+7dCdrZLsf6xlvCKo/MXO2Bph1TJdVsEYQkSgsu76fKfBV0aC29wkiKC sVKFIxcrEoTafxnLydTeNg==; Date: Mon, 30 Jun 2025 22:00:02 +0300 Message-Id: <86wm8t2gy5.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-Reply-To: (message from Stefan Monnier on Mon, 30 Jun 2025 12:01:02 -0400) Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop References: <24453.1751060166@bach.localdomain> <34220.1751153312@bach.localdomain> <86a55r5dv2.fsf@gnu.org> <19433.1751218460@bach.localdomain> <86o6u54emc.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Monnier > Cc: Mike Kupfer , 78916@debbugs.gnu.org > Date: Mon, 30 Jun 2025 12:01:02 -0400 > > >> > - Both keys behave like the "old C-g". > >> > ? > >> I'm fine with that. > > Same, but does it mean 'C-g' will do the same as 'q'? If not, what is > > the difference between them? > > Hmm... so `q` is bound to `exit` which consumes the key and exits the > Q&R loop. In contrast `C-g` and `C-]` were bound to `quit` which is > not handled exlicitly by the Q&R loop, instead it just pushes the event > back on the `unread-commend-events` before exiting the loop, so in > Mike's test case, `q` exits the inner Q&R and passes to the next, > whereas `C-]` aborts all the subsequent Q&R calls after which it runs > the global binding of `C-[`. I think I understand what you are saying about the difference between 'q' and 'C-g', but I don't see any nested query-replace in Mike's test case, or what did I miss? Or maybe I misunderstood what you mean by "the next"? In practice, typing 'q' stops query-replace and leaves point at the last match where Emacs asked me whether to replace. And 'C-g' does the same, AFAICT. If I'm right, then what would be an example where 'q' and 'C-g' would behave differently? In any case, this difference between 'q' and 'C-g' is not explained in the user manual. The manual uses different wording to describe them, but my interpretation of the text is that they have the same effect. From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 30 15:14:32 2025 Received: (at 78916) by debbugs.gnu.org; 30 Jun 2025 19:14:32 +0000 Received: from localhost ([127.0.0.1]:48634 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uWJxY-0000hm-2J for submit@debbugs.gnu.org; Mon, 30 Jun 2025 15:14:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40668) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uWJxT-0000gM-Bv for 78916@debbugs.gnu.org; Mon, 30 Jun 2025 15:14:29 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWJxM-0001XN-B1; Mon, 30 Jun 2025 15:14:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=Ei18USTmb+kx1oFgQInt1eOBvQ9UVOqW3EjXZHU/7/8=; b=kFYrU7KLfq7X mzU0zuLprylLtSEF86GBkwvlcJVrFKw6UJgn5m8ORqNKcRaN7+3JlOEKFnCtcDswEKhd65o1WSczV X1uInWehBsEfj7EFpbVgGhoPhxIcJgn7gqK64HWujB2YV4rGPiBiILUM1Rpo2qtW+/jKF10oiI8rs r3IHxXl34Unh5Pp6R/7MuXXe8DoSRbha/n19ninVzTs2DlmITwW9WLRC4Z9g8juYu+JESpkt22CWT k7TotcmnSLUPXP7Z1WhE23GGs0tWJoCZHIuq15kxKTZuqdo6FwRS11WJ2x++YFb4tllPFXuP9zaRx POcjiEjapXVURZrwFTA4mw==; Date: Mon, 30 Jun 2025 22:14:17 +0300 Message-Id: <86qzz12gae.fsf@gnu.org> From: Eli Zaretskii To: Pip Cet In-Reply-To: <871pr1yu2g.fsf@protonmail.com> (message from Pip Cet on Mon, 30 Jun 2025 18:15:40 +0000) Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop References: <24453.1751060166@bach.localdomain> <34220.1751153312@bach.localdomain> <86a55r5dv2.fsf@gnu.org> <19433.1751218460@bach.localdomain> <86o6u54emc.fsf@gnu.org> <871pr1yu2g.fsf@protonmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, monnier@iro.umontreal.ca, kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Mon, 30 Jun 2025 18:15:40 +0000 > From: Pip Cet > > (I still think it would be easiest to give up on a single C-g signaling > a quit; if we move to requiring two C-g's, both of which are ordinary > input up to the point where the second one triggers a quit, all the > special cases go away.) IMO, we will be lynched if we make such a change in Emacs. From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 30 15:41:01 2025 Received: (at 78916) by debbugs.gnu.org; 30 Jun 2025 19:41:01 +0000 Received: from localhost ([127.0.0.1]:48984 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uWKN7-0004HR-LF for submit@debbugs.gnu.org; Mon, 30 Jun 2025 15:41:00 -0400 Received: from mail-10630.protonmail.ch ([79.135.106.30]:53357) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uWKN3-0004Gd-Tz for 78916@debbugs.gnu.org; Mon, 30 Jun 2025 15:40:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1751312447; x=1751571647; bh=oBbqjLCNxllQxtVCVZsru1r2wLwP3NWxV7xu63UApYc=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=qKzcKc1ntRbZDtohvFnS7WTowefJdBjDHQhtE30WdkqwGgh044XjYKFEK794wR7Wx bz1169e2SG6JE77i5tKX9ZhLy8AHS4K02cHix2lvkyiTTwXMHI5AqCXHv1F+FsEaxP u/fL2TvxOy8ifQpLh2yLUqnyDoDc2byVkRviM8H4a+OSrNt3R/S0PREVc3KCvJNXUj Iabz3BVSdCPjxFmmcCnEwfGRgGzLBx65vXt6WquO3/YqU+tdkQT3/F1+U5FV1l1zBW /iDwJUL084g0cIiEQORrg/rde9t6VUMmoF1ywBdz8Ok4DsD49+NFRgQa4MwE168vOF LkO6loleyRo7A== Date: Mon, 30 Jun 2025 19:40:43 +0000 To: Eli Zaretskii From: Pip Cet Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop Message-ID: <87v7odxbk8.fsf@protonmail.com> In-Reply-To: References: <24453.1751060166@bach.localdomain> <34220.1751153312@bach.localdomain> <86a55r5dv2.fsf@gnu.org> <19433.1751218460@bach.localdomain> <86o6u54emc.fsf@gnu.org> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: 2f8a5f9b22df4b250bbb26bff48845f4584cdf8c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, Stefan Monnier , Mike Kupfer X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) Pip Cet writes: > "Stefan Monnier via \"Bug reports for GNU Emacs, the Swiss army knife of = text editors\"" writes: > >>>> > - Both keys behave like the "old C-g". >>>> > ? >>>> I'm fine with that. >>> Same, but does it mean 'C-g' will do the same as 'q'? If not, what is >>> the difference between them? >> >> Hmm... so `q` is bound to `exit` which consumes the key and exits the >> Q&R loop. In contrast `C-g` and `C-]` were bound to `quit` which is >> not handled exlicitly by the Q&R loop, instead it just pushes the event >> back on the `unread-commend-events` before exiting the loop, so in >> Mike's test case, `q` exits the inner Q&R and passes to the next, >> whereas `C-]` aborts all the subsequent Q&R calls after which it runs >> the global binding of `C-[`. > >> I get the impression that the intention of the `replace.el` code when it >> pushes the event back on `unread-commend-events` is to make it run >> whichever binding is currently active "outside" (i.e. global or local >> keymap). >> >> IOW, we have many different ways to skin this cat and I'm not sure which >> is best. > > I'd just like to speak out in favor of making read-key take an extra > argument to make it handle C-g the way read-event does; IIUC, the lack > of this argument is the real problem here. If we don't, we should be > very careful about replacing read-event by read-key, and revert most > such changes. This patch (which doesn't include documentation changes yet) would make (read-key prompt nil t) DTRT, I think. I've looked at a few callers of read-key and they should probably pass t as the can-quit argument, too, because most of them want to quit for C-g and try to do so, with varying degrees of success. I've yet to verify this fixes the original F-key issue which prompted the change to read-key in the first place. It does appear to fix the buggy behavior observed by the OP. >From dd850c5da3591e00dfd2fe1dd3e6d901a53e7176 Mon Sep 17 00:00:00 2001 From: Pip Cet Subject: [PATCH 1/3] Add optional 'can-quit' argument to 'read-key' (bug#78916) * lisp/subr.el (read-key): Add 'can-quit' argument and pass it on. * src/callint.c (Fcall_interactively): * src/keyboard.c (command_loop_1): (read_menu_command): Adjust accordingly. (read_key_sequence): Quit after read_char if can_quit is set. (read_key_sequence_vs): (Fread_key_sequence): (Fread_key_sequence_vector): Add extra argument. --- lisp/subr.el | 5 +++-- src/callint.c | 4 ++-- src/keyboard.c | 32 ++++++++++++++++++++------------ 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/lisp/subr.el b/lisp/subr.el index 69f6e4dbab8..b06d45d449f 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -3425,7 +3425,7 @@ read-key-full-map =20 (defvar read-key-delay 0.01) ;Fast enough for 100Hz repeat rate, hopefully= . =20 -(defun read-key (&optional prompt disable-fallbacks) +(defun read-key (&optional prompt disable-fallbacks can-quit) "Read a key from the keyboard, return the event thus read. Contrary to `read-event' this will not return a raw event but instead will obey the input decoding and translations usually done by `read-key-sequenc= e'. @@ -3505,7 +3505,8 @@ read-key map)) (let* ((keys (catch 'read-key (read-key-sequence-vector prompt nil t - nil nil t))) + nil nil t + can-quit))) (key (aref keys 0))) (if (and (> (length keys) 1) (memq key '(mode-line header-line tab-line diff --git a/src/callint.c b/src/callint.c index e0246e5d594..38ffa8804d3 100644 --- a/src/callint.c +++ b/src/callint.c @@ -538,7 +538,7 @@ DEFUN ("call-interactively", Fcall_interactively, Scall= _interactively, 1, 3, 0, =09=09=09=09Qface, Qminibuffer_prompt, callint_message); =09 args[i] =3D Fread_key_sequence (callint_message, =09=09=09=09=09 Qnil, Qnil, Qnil, Qnil, -=09=09=09=09=09 Qnil); +=09=09=09=09=09 Qnil, Qnil); =09 unbind_to (speccount1, Qnil); =09 visargs[i] =3D Fkey_description (args[i], Qnil); =20 @@ -569,7 +569,7 @@ DEFUN ("call-interactively", Fcall_interactively, Scall= _interactively, 1, 3, 0, =09=09=09=09Qface, Qminibuffer_prompt, callint_message); =09 args[i] =3D Fread_key_sequence_vector (callint_message, =09=09=09=09=09=09 Qnil, Qt, Qnil, Qnil, -=09=09=09=09=09=09 Qnil); +=09=09=09=09=09=09 Qnil, Qnil); =09 visargs[i] =3D Fkey_description (args[i], Qnil); =09 unbind_to (speccount1, Qnil); =20 diff --git a/src/keyboard.c b/src/keyboard.c index 8b2ebd215d2..93149910fa7 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -1311,7 +1311,7 @@ some_mouse_moved (void) =20 enum { READ_KEY_ELTS =3D 30 }; static int read_key_sequence (Lisp_Object *, Lisp_Object, - bool, bool, bool, bool, bool); + bool, bool, bool, bool, bool, bool); static void adjust_point_for_property (ptrdiff_t, bool); =20 static Lisp_Object @@ -1422,7 +1422,7 @@ command_loop_1 (void) raw_keybuf_count =3D 0; Lisp_Object keybuf[READ_KEY_ELTS]; int i =3D read_key_sequence (keybuf, Qnil, false, true, true, false, -=09=09=09=09 false); +=09=09=09=09 false, false); =20 /* A filter may have run while we were reading the input. */ if (! FRAME_LIVE_P (XFRAME (selected_frame))) @@ -1698,7 +1698,7 @@ read_menu_command (void) =20 Lisp_Object keybuf[READ_KEY_ELTS]; int i =3D read_key_sequence (keybuf, Qnil, false, true, true, true, -=09=09=09 false); +=09=09=09 false, false); =20 unbind_to (count, Qnil); =20 @@ -10544,7 +10544,7 @@ restore_reading_key_sequence (int old_reading_key_s= equence) read_key_sequence (Lisp_Object *keybuf, Lisp_Object prompt, =09=09 bool dont_downcase_last, bool can_return_switch_frame, =09=09 bool fix_current_buffer, bool prevent_redisplay, -=09=09 bool disable_text_conversion_p) +=09=09 bool disable_text_conversion_p, bool can_quit) { specpdl_ref count =3D SPECPDL_INDEX (); =20 @@ -10867,6 +10867,11 @@ read_key_sequence (Lisp_Object *keybuf, Lisp_Objec= t prompt, =09 key =3D read_char (prevent_redisplay ? -2 : NILP (prompt), =09=09 current_binding, last_nonmenu_event, &used_mouse_menu, NULL); +=09 if (can_quit && EQ (key, make_fixnum (quit_char))) +=09 { +=09=09Vquit_flag =3D Qt; +=09=09maybe_quit (); +=09 } =09 used_mouse_menu_history[t] =3D used_mouse_menu; =09 if ((FIXNUMP (key) && XFIXNUM (key) =3D=3D -2) /* wrong_kboard_jmpb= uf */ =09=09/* When switching to a new tty (with a new keyboard), @@ -11546,7 +11551,8 @@ read_key_sequence_vs (Lisp_Object prompt, Lisp_Obje= ct continue_echo, =09=09 Lisp_Object dont_downcase_last, =09=09 Lisp_Object can_return_switch_frame, =09=09 Lisp_Object cmd_loop, bool allow_string, -=09=09 bool disable_text_conversion) +=09=09 bool disable_text_conversion, +=09=09 bool can_quit) { specpdl_ref count =3D SPECPDL_INDEX (); =20 @@ -11574,7 +11580,7 @@ read_key_sequence_vs (Lisp_Object prompt, Lisp_Obje= ct continue_echo, Lisp_Object keybuf[READ_KEY_ELTS]; int i =3D read_key_sequence (keybuf, prompt, ! NILP (dont_downcase_last)= , =09=09=09 ! NILP (can_return_switch_frame), false, false, -=09=09=09 disable_text_conversion); +=09=09=09 disable_text_conversion, can_quit); =20 #if 0 /* The following is fine for code reading a key sequence and =09 then proceeding with a lengthy computation, but it's not good @@ -11596,7 +11602,7 @@ read_key_sequence_vs (Lisp_Object prompt, Lisp_Obje= ct continue_echo, =09=09 (i, keybuf))); } =20 -DEFUN ("read-key-sequence", Fread_key_sequence, Sread_key_sequence, 1, 6, = 0, +DEFUN ("read-key-sequence", Fread_key_sequence, Sread_key_sequence, 1, 7, = 0, doc: /* Read a sequence of keystrokes and return as a string or vec= tor. The sequence is sufficient to specify a non-prefix command in the current local and global maps. @@ -11650,23 +11656,25 @@ Second (optional) arg CONTINUE-ECHO, if non-nil, = means this key echos being sent. */) (Lisp_Object prompt, Lisp_Object continue_echo, Lisp_Object dont_downcas= e_last, Lisp_Object can_return_switch_frame, Lisp_Object cmd_loop, - Lisp_Object disable_text_conversion) + Lisp_Object disable_text_conversion, Lisp_Object can_quit) { return read_key_sequence_vs (prompt, continue_echo, dont_downcase_last, =09=09=09 can_return_switch_frame, cmd_loop, true, -=09=09=09 !NILP (disable_text_conversion)); +=09=09=09 !NILP (disable_text_conversion), +=09=09=09 !NILP (can_quit)); } =20 DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector, - Sread_key_sequence_vector, 1, 6, 0, + Sread_key_sequence_vector, 1, 7, 0, doc: /* Like `read-key-sequence' but always return a vector. */) (Lisp_Object prompt, Lisp_Object continue_echo, Lisp_Object dont_downcas= e_last, Lisp_Object can_return_switch_frame, Lisp_Object cmd_loop, - Lisp_Object disable_text_conversion) + Lisp_Object disable_text_conversion, Lisp_Object can_quit) { return read_key_sequence_vs (prompt, continue_echo, dont_downcase_last, =09=09=09 can_return_switch_frame, cmd_loop, false, -=09=09=09 !NILP (disable_text_conversion)); +=09=09=09 !NILP (disable_text_conversion), +=09=09=09 !NILP (can_quit)); } =0C /* Return true if input events are pending. */ --=20 2.50.0 >From 395ec08d4f5d31f2d6d6022fb40c4c90d44b8aeb Mon Sep 17 00:00:00 2001 From: Pip Cet Subject: [PATCH 2/3] Make C-g quit again in perform-replace (bug#78916) * lisp/replace.el (perform-replace): Pass 't' as 'can-quit' argument to 'read-key'. --- lisp/replace.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/replace.el b/lisp/replace.el index 9939273594f..1d115949599 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -3103,7 +3103,7 @@ perform-replace replacement-presentation)))) ;; Use `read-key' so that escape sequences on TTYs ;; are properly mapped back to the intended key. -=09=09 (setq key (read-key prompt))) +=09=09 (setq key (read-key prompt nil t))) =09=09 ;; Necessary in case something happens during =09=09 ;; read-event that clobbers the match data. =09=09 (set-match-data real-match-data) --=20 2.50.0 From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 30 16:15:33 2025 Received: (at 78916) by debbugs.gnu.org; 30 Jun 2025 20:15:34 +0000 Received: from localhost ([127.0.0.1]:49433 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uWKua-0000Xg-Qq for submit@debbugs.gnu.org; Mon, 30 Jun 2025 16:15:33 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:12689) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uWKuW-0000WK-0B for 78916@debbugs.gnu.org; Mon, 30 Jun 2025 16:15:30 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 7EDD410013E; Mon, 30 Jun 2025 16:15:22 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1751314521; bh=L3gmMnjAIKPIhtKVY73JZqn8oXgF81Y9oHx/o+mLyCM=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Tvh4dB5ApLZ2uYq7OLh4Na9nMCZ3epxUU+MxAhb4jk2mRjk/lPeYFK090hXbUZ2UI rmo6odKFYRz82wPKNEztjksS2eM6m2jSAmEyyCU58PYUH5bl4Xdy0WUYgJTYqh7tbF Z1oluyV3YrLGnsTYQ9GxtCLI+/zw7cw/V6iw61Tr0HTxmeUvbM3oX3znIn6+Ps7Ywc Sf4vOp70Ap4vCtnEX4KygZSDNHG4f59Gb4GsKZH+Q/TZqw0yHh9YB11306axr0fsCF Pmrgo7Lx8Y4uJOfokzRC1hHVnTdPErv3bNxynx0fv7Xg8OCzX/BrWLPtgsVWdO7fPi RfFNtglhRJAYg== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 7772310002E; Mon, 30 Jun 2025 16:15:21 -0400 (EDT) Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 63AA612045B; Mon, 30 Jun 2025 16:15:21 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop In-Reply-To: <86wm8t2gy5.fsf@gnu.org> Message-ID: References: <24453.1751060166@bach.localdomain> <34220.1751153312@bach.localdomain> <86a55r5dv2.fsf@gnu.org> <19433.1751218460@bach.localdomain> <86o6u54emc.fsf@gnu.org> <86wm8t2gy5.fsf@gnu.org> Date: Mon, 30 Jun 2025 16:15:17 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.096 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.1 (---) Eli Zaretskii [2025-06-30 22:00:02] wrote: >> From: Stefan Monnier >> Cc: Mike Kupfer , 78916@debbugs.gnu.org >> Date: Mon, 30 Jun 2025 12:01:02 -0400 >> >> >> > - Both keys behave like the "old C-g". >> >> > ? >> >> I'm fine with that. >> > Same, but does it mean 'C-g' will do the same as 'q'? If not, what is >> > the difference between them? >> >> Hmm... so `q` is bound to `exit` which consumes the key and exits the >> Q&R loop. In contrast `C-g` and `C-]` were bound to `quit` which is >> not handled exlicitly by the Q&R loop, instead it just pushes the event >> back on the `unread-commend-events` before exiting the loop, so in >> Mike's test case, `q` exits the inner Q&R and passes to the next, >> whereas `C-]` aborts all the subsequent Q&R calls after which it runs >> the global binding of `C-[`. > > I think I understand what you are saying about the difference between > 'q' and 'C-g', but I don't see any nested query-replace in Mike's test > case, or what did I miss? Or maybe I misunderstood what you mean by > "the next"? His Q&R call is inside a loop: (while (re-search-forward "bug#[[:digit:]]+:" nil t) (search-backward "(\"bug") (let (end (start (point))) (forward-sexp) (setq end (point)) (query-replace-regexp "\\(\"bug#[[:digit:]]+:\\).*\"" "\\1\"" nil start end)))) so when we exit one we enter the next (as long as there's another match for the main regexp, that is). > In practice, typing 'q' stops query-replace and leaves point at the > last match where Emacs asked me whether to replace. And 'C-g' does > the same, AFAICT. > If I'm right, then what would be an example where 'q' and 'C-g' would > behave differently? `C-g` (and `C-]`) behave just like "`q` followed by C-g/C-]". Usually hitting C-g or C-] right after `q` has no effect, which is why they are often perceived as doing the same, but in the above loop the difference becomes more significant. > In any case, this difference between 'q' and 'C-g' is not explained in > the user manual. The manual uses different wording to describe them, > but my interpretation of the text is that they have the same effect. So in effect we've had 3 "identical" yet subtly different behaviors for years: - The behavior of `q`: exit the Q&R and continue with whatever may follow. - The behavior of `C-]`: exit the Q&R and also continue with whatever may follow, but without consuming the `C-]` so next time we read a key we'll get this `C-]`. - The old behavior of `C-g` (which we definitely want to recover): abort the current command. Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 01 07:46:46 2025 Received: (at 78916) by debbugs.gnu.org; 1 Jul 2025 11:46:46 +0000 Received: from localhost ([127.0.0.1]:55413 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uWZRk-0000O1-0g for submit@debbugs.gnu.org; Tue, 01 Jul 2025 07:46:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47596) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uWZRf-0000MN-8j for 78916@debbugs.gnu.org; Tue, 01 Jul 2025 07:46:40 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWZRY-0003kv-CS; Tue, 01 Jul 2025 07:46:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=dzadoXt5o2pO9AJjAmrBCGojuPCDGSJE6mzZDs7KGlM=; b=n3Cf2bPfisE3 sI9WeCQrVkqfFRRCZP9k+L9MmQuTatHChc5SuDspKqIu+DLP6wUCzO15Mewi04NtVGUaTnsUJuEit MEoRtWO3lsAK7AczC78miwoegPbT77wvjD5G5GCxFe9aKSUgPsPBwgKb+Vs4Gxd9wx3iW5/P40imn WB3gQubL0y727XK/jEMlk5otnBtfb3GysIRe0crXO1rPZMCoicFjL5ivobCNiJcrSlgBS0LlPl+yF xW+5puA1ejIjPHRGHQ+po5VF70unk7Ea4ne/bGq23iUEfqoZEnjAewyQ2CE7CxF68+Ysb+xnpgHV4 WXcRiEK8pPxsw1iYokp3nw==; Date: Tue, 01 Jul 2025 14:46:27 +0300 Message-Id: <86ikkc2kx8.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-Reply-To: (message from Stefan Monnier on Mon, 30 Jun 2025 16:15:17 -0400) Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop References: <24453.1751060166@bach.localdomain> <34220.1751153312@bach.localdomain> <86a55r5dv2.fsf@gnu.org> <19433.1751218460@bach.localdomain> <86o6u54emc.fsf@gnu.org> <86wm8t2gy5.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Monnier > Cc: kupfer@rawbw.com, 78916@debbugs.gnu.org > Date: Mon, 30 Jun 2025 16:15:17 -0400 > > Eli Zaretskii [2025-06-30 22:00:02] wrote: > > >> From: Stefan Monnier > >> Cc: Mike Kupfer , 78916@debbugs.gnu.org > >> Date: Mon, 30 Jun 2025 12:01:02 -0400 > >> > >> >> > - Both keys behave like the "old C-g". > >> >> > ? > >> >> I'm fine with that. > >> > Same, but does it mean 'C-g' will do the same as 'q'? If not, what is > >> > the difference between them? > >> > >> Hmm... so `q` is bound to `exit` which consumes the key and exits the > >> Q&R loop. In contrast `C-g` and `C-]` were bound to `quit` which is > >> not handled exlicitly by the Q&R loop, instead it just pushes the event > >> back on the `unread-commend-events` before exiting the loop, so in > >> Mike's test case, `q` exits the inner Q&R and passes to the next, > >> whereas `C-]` aborts all the subsequent Q&R calls after which it runs > >> the global binding of `C-[`. > > > > I think I understand what you are saying about the difference between > > 'q' and 'C-g', but I don't see any nested query-replace in Mike's test > > case, or what did I miss? Or maybe I misunderstood what you mean by > > "the next"? > > His Q&R call is inside a loop: > > (while (re-search-forward "bug#[[:digit:]]+:" nil t) > (search-backward "(\"bug") > (let (end (start (point))) > (forward-sexp) > (setq end (point)) > (query-replace-regexp "\\(\"bug#[[:digit:]]+:\\).*\"" "\\1\"" > nil start end)))) > > so when we exit one we enter the next (as long as there's another match > for the main regexp, that is). OK, but then the issue here is not about query-replace-regexp at all, isn't it? It's about whether C-g is "re-read" after exiting query-replace-regexp, and when it is re-read, does it quit. Or am I missing something? > > In any case, this difference between 'q' and 'C-g' is not explained in > > the user manual. The manual uses different wording to describe them, > > but my interpretation of the text is that they have the same effect. > > So in effect we've had 3 "identical" yet subtly different behaviors for > years: > > - The behavior of `q`: exit the Q&R and continue with whatever may follow. > - The behavior of `C-]`: exit the Q&R and also continue with whatever > may follow, but without consuming the `C-]` so next time we read a key > we'll get this `C-]`. > - The old behavior of `C-g` (which we definitely want to recover): abort > the current command. If C-g is not consumed, it will produce the expected effect, right? If so, the problem seems to be that this is what's expected here, and it happened in the past because C-g would quite right away, so there was no need to re-read it. Right? From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 01 16:47:59 2025 Received: (at 78916) by debbugs.gnu.org; 1 Jul 2025 20:47:59 +0000 Received: from localhost ([127.0.0.1]:58955 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uWhtV-0001sA-JV for submit@debbugs.gnu.org; Tue, 01 Jul 2025 16:47:58 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:51172) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uWhtS-0001qe-B5 for 78916@debbugs.gnu.org; Tue, 01 Jul 2025 16:47:55 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 72943809A6; Tue, 1 Jul 2025 16:47:48 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1751402867; bh=abEqyWbcQYepKAIy318PaerTMj/zJ54XMSSV7sO9U4s=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=kBy6TP48M4B9SnMO7YOEgw9B88Tfofd6cXCYk8fw3wT5QXDzjIz8KR28pnquX5xFD IkEnlrLEcxFqAsWAvuOczdXc9oscOEiiNOp2wJpvIsJOQVgxIYWzrpx9XSvXlYQsEq DNnOFt4YJC4K9hdePz5MStG131OVuVqRfY4jlG6nndrLhws2DAdnU9LRtDVnwUDjkW DQWUpSGja+9XkzJqdaBWQiRQRWPrfUgQCr0T5YC4hHWHZz41Ys2KCNGilILwkHcmqf TyTsGVzIyxpjGXUEInmkkGRG2Munz7UdmyFFrmfpowJaQC9/gzqXith9QbbW50s1EA qPrpaSyleIXgg== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 9005680823; Tue, 1 Jul 2025 16:47:47 -0400 (EDT) Received: from alfajor (modemcable005.21-80-70.mc.videotron.ca [70.80.21.5]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 6749A120919; Tue, 1 Jul 2025 16:47:47 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop In-Reply-To: <86ikkc2kx8.fsf@gnu.org> Message-ID: References: <24453.1751060166@bach.localdomain> <34220.1751153312@bach.localdomain> <86a55r5dv2.fsf@gnu.org> <19433.1751218460@bach.localdomain> <86o6u54emc.fsf@gnu.org> <86wm8t2gy5.fsf@gnu.org> <86ikkc2kx8.fsf@gnu.org> Date: Tue, 01 Jul 2025 16:47:40 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.170 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> His Q&R call is inside a loop: >> >> (while (re-search-forward "bug#[[:digit:]]+:" nil t) >> (search-backward "(\"bug") >> (let (end (start (point))) >> (forward-sexp) >> (setq end (point)) >> (query-replace-regexp "\\(\"bug#[[:digit:]]+:\\).*\"" "\\1\"" >> nil start end)))) >> >> so when we exit one we enter the next (as long as there's another match >> for the main regexp, that is). > > OK, but then the issue here is not about query-replace-regexp at all, > isn't it? It's about whether C-g is "re-read" after exiting > query-replace-regexp, and when it is re-read, does it quit. Or am I > missing something? I think you're right. Which is why I think the intention was not to "unread it" but rather to give it its "normal" behavior (which the code tries to do by "unreading" the input, but failing to take into account that there's no guarantee exiting Q&R will get us back to a normal command loop). >> - The behavior of `q`: exit the Q&R and continue with whatever may follow. >> - The behavior of `C-]`: exit the Q&R and also continue with whatever >> may follow, but without consuming the `C-]` so next time we read a key >> we'll get this `C-]`. >> - The old behavior of `C-g` (which we definitely want to recover): abort >> the current command. > If C-g is not consumed, it will produce the expected effect, right? Hmm... it depends what happens when we exit Q&R and what you think is "the expected effect". > If so, the problem seems to be that this is what's expected here, I don't know what you're trying to say here. > and it happened in the past because C-g would quite right away, so > there was no need to re-read it. Right? I agree that we want to signal `quit` right away here (and I think both for `C-g` and for `C-]`) rather than "unread" them. The question is how we want to do it: - (signal 'quit nil) - call `keyboard-quit`. - call whatever is bound to `C-g` in the normal keymaps. [ With a subsidiary question of whether we do it by changing the code that handles a key bound to `quit` or whether we just change the binding to something else like `keyboard-quit`. ] Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 01 22:11:04 2025 Received: (at 78916) by debbugs.gnu.org; 2 Jul 2025 02:11:05 +0000 Received: from localhost ([127.0.0.1]:59832 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uWmw9-00073K-W8 for submit@debbugs.gnu.org; Tue, 01 Jul 2025 22:11:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55000) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uWmw0-00071I-Uh for 78916@debbugs.gnu.org; Tue, 01 Jul 2025 22:10:58 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWmvt-0003t5-1U; Tue, 01 Jul 2025 22:10:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=Date:References:Subject:In-Reply-To:To:From: mime-version; bh=13FQ1RfaWBl0vTEruc9DDx3onmr8qYSvvANHXQkJ+QY=; b=V7y2J/SoPcQj PXFkgrqDAg/giwBniHPfyhJCVBpPk1Ogshs6Sz1SIhTu95nzxeTUvC+jc7rQcSf3XrE14fK0BG55/ PKZXeRZVF8XjlQKkaiot8n+aYuzoAlJ0F5MJyplzt6YmENFFr8RRbvJRqavLyGLy6oATDXlLcxM1W RL/uBRVcq/leGhg3zAOjDxAywJ/pTuzx7LQbnb0FbmFD/qf62I2Bc2PFIqggYNmA/Q11oPHlIOtma LdjFpOPtKpwRJj4ekI46OtUT/I1bhMHKGHnM5F28Wyt36fjYYsEdLZKSsq1yL1gmzjQU0GH27EYnl dlB1c/F6PX/GkyPmPIl6ZA==; Received: from rms by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1uWmvs-0005e8-Aj; Tue, 01 Jul 2025 22:10:44 -0400 Content-Type: text/plain; charset=Utf-8 From: Richard Stallman To: Stefan Monnier In-Reply-To: (bug-gnu-emacs@gnu.org) Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop References: <24453.1751060166@bach.localdomain> <34220.1751153312@bach.localdomain> <86a55r5dv2.fsf@gnu.org> Message-Id: Date: Tue, 01 Jul 2025 22:10:44 -0400 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, eliz@gnu.org, kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: rms@gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] C-g and C-] are intentionally different. C-g quits out of commands, while C-] exis a recursive edit. The two commands exist because they are different, and both useful. We want to fix the bug that affects C-g. But what should C-] do here? Its definition is to quit out of the innermos recursive edit. But I don't think there is a recursive edit going on in this example. query-replace-regexp doesn't use a recursive edit to read the user's input. Quitting out of the current command seems like a reaosnable think for C-] to do when there is no recursive edit in progress. -- Dr Richard Stallman (https://stallman.org) Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org) From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 01 22:13:18 2025 Received: (at 78916) by debbugs.gnu.org; 2 Jul 2025 02:13:18 +0000 Received: from localhost ([127.0.0.1]:59839 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uWmyJ-0007ME-WA for submit@debbugs.gnu.org; Tue, 01 Jul 2025 22:13:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38492) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uWmyG-0007Kq-MY for 78916@debbugs.gnu.org; Tue, 01 Jul 2025 22:13:13 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWmyB-0004Tf-7C; Tue, 01 Jul 2025 22:13:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=Date:References:Subject:In-Reply-To:To:From: mime-version; bh=13FQ1RfaWBl0vTEruc9DDx3onmr8qYSvvANHXQkJ+QY=; b=RSm2bzXtvEKL OxwQw1hI+mdQT0pDAonoGqcQOIhDj7o9Mt0lzyykMvD+tZfWTkPkF4NfUH98IiVgox0n969U+wpYo LVKWXcKvWWD1K5sk/7Igs73vmeCEmma8M/u3Dobi32fJkvPocGFKXG2TJ42utMc6kwuZVJBZa6L+l MWIkchdN86Hgv6E/e40zAXUOta4MwPGfEwklNlG21Do/zvmxuGZLaPYa62yO0M56dgOvEVk7L3yLh WpDILpJAfQQXIco+Pkxo/Y3HyyazKFpSJb1BkeQDJK1+Hy36sQkkDBsuIMxO2uu+0gaGW86bHf99E 2A1Tpxpt6zyjz1Z5Cu/PrA==; Received: from rms by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1uWmy4-00060v-5S; Tue, 01 Jul 2025 22:13:00 -0400 Content-Type: text/plain; charset=Utf-8 From: Richard Stallman To: Stefan Monnier In-Reply-To: (bug-gnu-emacs@gnu.org) Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop References: <24453.1751060166@bach.localdomain> <34220.1751153312@bach.localdomain> <86a55r5dv2.fsf@gnu.org> Message-Id: Date: Tue, 01 Jul 2025 22:13:00 -0400 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, eliz@gnu.org, kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: rms@gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] C-g and C-] are intentionally different. C-g quits out of commands, while C-] exis a recursive edit. The two commands exist because they are different, and both useful. We want to fix the bug that affects C-g. But what should C-] do here? Its definition is to quit out of the innermos recursive edit. But I don't think there is a recursive edit going on in this example. query-replace-regexp doesn't use a recursive edit to read the user's input. Quitting out of the current command seems like a reaosnable think for C-] to do when there is no recursive edit in progress. -- Dr Richard Stallman (https://stallman.org) Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org) From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 02 07:37:27 2025 Received: (at 78916) by debbugs.gnu.org; 2 Jul 2025 11:37:27 +0000 Received: from localhost ([127.0.0.1]:35980 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uWvmI-0004hu-FS for submit@debbugs.gnu.org; Wed, 02 Jul 2025 07:37:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43680) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uWvmB-0004gG-Ix for 78916@debbugs.gnu.org; Wed, 02 Jul 2025 07:37:23 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWvm4-00067f-6r; Wed, 02 Jul 2025 07:37:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=sk1FMGSLB0L8r5RiEjpVhPNtsUM0nT3Wdil66aV9fis=; b=Ahxc9nmGCkXz HIFl1t91EXfpsYj8yVR0ymYocZk984CXM7mjBEFNrU4vLeO6hTjD22r7OKvIY0Gs5qDeR4s4cvB25 btsPCfScq6ADi4XDZ8MzkNpoggMS9EEiN9UbiyR9/US6GtkV5Z3Bhjq60Dm+RL6Cc+zM/cGFf5NF9 jPZTLJb7A1D5nRhWkCx0wExIgvb8JheUFcd/uAiuCT1Os6EituI88wjDnj03vfhWhnTWB+x7Mb2/1 o02t8ICWOTMP5ru3Ems3xQYP0a+jZQUYh9eoN6tj67hp/YG4++UB1cwgp0/2WFczJnnyGthjwwXbM O1E7ZMBPeQEqgMA8aZxqnA==; Date: Wed, 02 Jul 2025 14:37:08 +0300 Message-Id: <86seje2597.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-Reply-To: (message from Stefan Monnier on Tue, 01 Jul 2025 16:47:40 -0400) Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop References: <24453.1751060166@bach.localdomain> <34220.1751153312@bach.localdomain> <86a55r5dv2.fsf@gnu.org> <19433.1751218460@bach.localdomain> <86o6u54emc.fsf@gnu.org> <86wm8t2gy5.fsf@gnu.org> <86ikkc2kx8.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Monnier > Cc: kupfer@rawbw.com, 78916@debbugs.gnu.org > Date: Tue, 01 Jul 2025 16:47:40 -0400 > > > and it happened in the past because C-g would quite right away, so > > there was no need to re-read it. Right? > > I agree that we want to signal `quit` right away here (and I think both > for `C-g` and for `C-]`) rather than "unread" them. The question is how > we want to do it: > > - (signal 'quit nil) > - call `keyboard-quit`. > - call whatever is bound to `C-g` in the normal keymaps. If you explain the difference between the first tow, I could try making up my mind. > [ With a subsidiary question of whether we do it by changing the code > that handles a key bound to `quit` or whether we just change the > binding to something else like `keyboard-quit`. ] Currently 'quit' in replace.el is not handled, so it is a kind-of dummy binding. It doesn't have any code that handles it. Or what did I miss? From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 02 07:39:27 2025 Received: (at 78916) by debbugs.gnu.org; 2 Jul 2025 11:39:27 +0000 Received: from localhost ([127.0.0.1]:35989 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uWvoE-0004zE-Si for submit@debbugs.gnu.org; Wed, 02 Jul 2025 07:39:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55598) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uWvoB-0004y2-QA for 78916@debbugs.gnu.org; Wed, 02 Jul 2025 07:39:24 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWvo4-0006Nl-9a; Wed, 02 Jul 2025 07:39:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=gW3zIugj4B8WVV8Lm2pIftnsFMs+npN86XqFCtVv+jE=; b=hiyb2BWU7Rwc u2lfK6ouYVMUy0RDko8/+E5Y+ZUwmgVvyJ4j9Kq61EaV27txPCnq6s6YFKa7W5gH35T+vN/Oua5r0 NWiV4QWMyMTQQYHIf5QXRfQJ8B4d4iTl80HG8Vgnld4f5UZjtbwwrhKIAPf/aW46V3IZ11jTQ/aet p15pKAbWJDFSxwb57JXIqCWgPYh1SLeLsVAImvUC14vzkmAy/iYx79pCtONC5y1QULBk31svXfzr+ nc1F7+AnpfyVxIzTWNRUR9ZGBWRQuspcwl1H1g0Xl0c7rLJmlbWyhU8ZhRq0fNrsQ3jZSv6xoieXU C+xrYSEGzQsWmr6akZUCNA==; Date: Wed, 02 Jul 2025 14:39:07 +0300 Message-Id: <86qzyy255w.fsf@gnu.org> From: Eli Zaretskii To: rms@gnu.org In-Reply-To: (message from Richard Stallman on Tue, 01 Jul 2025 22:10:44 -0400) Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop References: <24453.1751060166@bach.localdomain> <34220.1751153312@bach.localdomain> <86a55r5dv2.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, monnier@iro.umontreal.ca, kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Richard Stallman > Cc: eliz@gnu.org, 78916@debbugs.gnu.org, kupfer@rawbw.com > Date: Tue, 01 Jul 2025 22:10:44 -0400 > > C-g and C-] are intentionally different. C-g quits out of commands, > while C-] exis a recursive edit. The two commands exist because > they are different, and both useful. That is true in general, but we are talking about the effects of these two inside query-replace, where they both are bound to the same function. > We want to fix the bug that affects C-g. But what should C-] do here? > > Its definition is to quit out of the innermos recursive edit. > But I don't think there is a recursive edit going on in this example. > query-replace-regexp doesn't use a recursive edit to read > the user's input. > > Quitting out of the current command seems like a reaosnable think > for C-] to do when there is no recursive edit in progress. Exactly. So in this case C-g and C-] are supposed to have the same effect, I think. From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 02 10:14:50 2025 Received: (at 78916) by debbugs.gnu.org; 2 Jul 2025 14:14:51 +0000 Received: from localhost ([127.0.0.1]:37536 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uWyEc-0002hZ-FR for submit@debbugs.gnu.org; Wed, 02 Jul 2025 10:14:50 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:12226) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uWyEZ-0002gm-Q9 for 78916@debbugs.gnu.org; Wed, 02 Jul 2025 10:14:48 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id B470C809D3; Wed, 2 Jul 2025 10:14:41 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1751465680; bh=VO8b1q3I9GYLmgmmXctHtuuDkuMh2KRGSn6gDBNn40U=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=iLfEtdrJPDKMr5hHD3138fPz0K/9HtvemQPhl9xdkITTm46SSa/vqdsqOcG3vsfKL paX8C1tWN1YPdDo5+BN0Xk036d+sL/EC4err9awLPOCV6/xQ3gldoagks8jvWw7EUH X62KLQICJ314OWFhE+3rRHhJhII588/ZaZQrW+ViRdm2qU0DKsACerjP+b7IsvPcUM NwyGmv9cPygnSpQHqt/TiAtDdOPllmJZWq/hvoF617ZTMZKY11UFIk+CyrG1x4IA0Y +rkAcFLLROv2gmeHXdMePRoACzaCFPqfVaymfWNSN6Getp/1OWPlQVcKO3ApGHCX1f LwHK4w6QvMuKQ== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 9CC1380672; Wed, 2 Jul 2025 10:14:40 -0400 (EDT) Received: from pastel (unknown [104.247.225.139]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 7115B120223; Wed, 2 Jul 2025 10:14:40 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop In-Reply-To: <86seje2597.fsf@gnu.org> Message-ID: References: <24453.1751060166@bach.localdomain> <34220.1751153312@bach.localdomain> <86a55r5dv2.fsf@gnu.org> <19433.1751218460@bach.localdomain> <86o6u54emc.fsf@gnu.org> <86wm8t2gy5.fsf@gnu.org> <86ikkc2kx8.fsf@gnu.org> <86seje2597.fsf@gnu.org> Date: Wed, 02 Jul 2025 10:14:39 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.299 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.1 (---) >> > and it happened in the past because C-g would quite right away, so >> > there was no need to re-read it. Right? >> >> I agree that we want to signal `quit` right away here (and I think both >> for `C-g` and for `C-]`) rather than "unread" them. The question is how >> we want to do it: >> >> - (signal 'quit nil) >> - call `keyboard-quit`. >> - call whatever is bound to `C-g` in the normal keymaps. > > If you explain the difference between the first tow, I could try > making up my mind. I know as much as you do in this respect (i.e. the difference is whatever `keyboard-quit` does before calling `(signal 'quit nil)`). Also: - (signal 'quit nil) is what C-g does/did when we use(d) `read-event`. - `keyboard-quit` is what `C-g` does when it's handled via the global-map. To me, the current situation sounds like a case where the `C-g` is received by an "interactive loop" so I'd leaning towards handling it via `keyboard-quit`, whereas (signal 'quit nil) is what is used when interrupting *running* code. >> [ With a subsidiary question of whether we do it by changing the code >> that handles a key bound to `quit` or whether we just change the >> binding to something else like `keyboard-quit`. ] > > Currently 'quit' in replace.el is not handled, so it is a kind-of > dummy binding. It doesn't have any code that handles it. Or what did > I miss? Yes, "any" other symbol would be handled in the same way, i.e. it's handled by the default code that unreads the event and exits the Q&R. Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 03 02:06:55 2025 Received: (at 78916) by debbugs.gnu.org; 3 Jul 2025 06:06:55 +0000 Received: from localhost ([127.0.0.1]:41996 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uXD5z-0006RH-9q for submit@debbugs.gnu.org; Thu, 03 Jul 2025 02:06:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52356) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uXD5u-0006QK-RA for 78916@debbugs.gnu.org; Thu, 03 Jul 2025 02:06:53 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uXD5n-0004Jq-7L; Thu, 03 Jul 2025 02:06:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=uFeYGcTkGrmH8CTlKospnrPueX4+urAwFtV4jESbcVA=; b=YDCoTJHUX73K KaRnVzxW9Ew3UmhqwhKjb4d4am+rGad0iOelnypvd/nAK6loqxRYWU9hcg281KgvAt7uDcxvtdFk1 Ivm2OhhkSuq1F6DwBQ4qibn2LxcO3vxCYyQFvGpyAYdZpC+vgCg0bwUlgE4b1zN1qkbzYryIVlJk1 v1IN8fjxZt5xERw8kNhNdC/eHaOCMDu2YmUmG5qXRoRcOiPjjUD2YJT2XsjWRsIiiv31EwDxeuSi9 sVMhbjr954uM1oZURcpLZLpHigAbbGZwIDdyRq7ViK+3Gc/s6CpRKDXyI/Sag7NGj++L0msUb/mZu 5t4vXx65gT3EoiCKHV0zxA==; Date: Thu, 03 Jul 2025 09:06:40 +0300 Message-Id: <867c0p24gf.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-Reply-To: (message from Stefan Monnier on Wed, 02 Jul 2025 10:14:39 -0400) Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop References: <24453.1751060166@bach.localdomain> <34220.1751153312@bach.localdomain> <86a55r5dv2.fsf@gnu.org> <19433.1751218460@bach.localdomain> <86o6u54emc.fsf@gnu.org> <86wm8t2gy5.fsf@gnu.org> <86ikkc2kx8.fsf@gnu.org> <86seje2597.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Monnier > Cc: kupfer@rawbw.com, 78916@debbugs.gnu.org > Date: Wed, 02 Jul 2025 10:14:39 -0400 > > >> > and it happened in the past because C-g would quite right away, so > >> > there was no need to re-read it. Right? > >> > >> I agree that we want to signal `quit` right away here (and I think both > >> for `C-g` and for `C-]`) rather than "unread" them. The question is how > >> we want to do it: > >> > >> - (signal 'quit nil) > >> - call `keyboard-quit`. > >> - call whatever is bound to `C-g` in the normal keymaps. > > > > If you explain the difference between the first tow, I could try > > making up my mind. > > I know as much as you do in this respect (i.e. the difference is > whatever `keyboard-quit` does before calling `(signal 'quit nil)`). > > Also: > > - (signal 'quit nil) is what C-g does/did when we use(d) `read-event`. > - `keyboard-quit` is what `C-g` does when it's handled via the global-map. > > To me, the current situation sounds like a case where the `C-g` is > received by an "interactive loop" so I'd leaning towards handling it via > `keyboard-quit`, whereas (signal 'quit nil) is what is used when > interrupting *running* code. I agree that calling keyboard-quit is better. From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 03 10:49:08 2025 Received: (at 78916) by debbugs.gnu.org; 3 Jul 2025 14:49:09 +0000 Received: from localhost ([127.0.0.1]:49498 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uXLFL-0001US-R0 for submit@debbugs.gnu.org; Thu, 03 Jul 2025 10:49:08 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:26378) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uXLFI-0001T5-C9 for 78916@debbugs.gnu.org; Thu, 03 Jul 2025 10:49:05 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id A155D4415B5; Thu, 3 Jul 2025 10:48:58 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1751554133; bh=OkBIONaE7WfL2O+ePPbzdoKp3w8Sa2bfBiH/BeAImwg=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=HoEEfPpyKo09dw6uV8fmS3TOWIAelZBClH6bNu1paEB10YKTtwQO5Mm2djonFIGHF eslxULfPPJDV2+XH6Qa9b9DN+6xr1WTEWLWIQj8qtzXwPRh7JXLcWWz+rPODbmkph+ hOthJClA7DdsMwvk8Pbb9v7dun3t3/OO5dGKde/Xcot/rizhts2uRLgVSfkea/47FS Z7b2YLBMzSJn0h2sdtWc2V5jn9tRScy9YRqIBUqj4x6uQSiP3HlBIxaUjUZHTSu0Lv fSSnegbXgbNUKCz5E4cU35Zw0DemRu7hEt2gSJ8Gia0nmBqpnl6bF2xgc07vwfwa8a Wzzmsbm5aCzCQ== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id E9DC74413D1; Thu, 3 Jul 2025 10:48:52 -0400 (EDT) Received: from pastel (unknown [104.247.225.139]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id BDD9D1204E6; Thu, 3 Jul 2025 10:48:52 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop In-Reply-To: <867c0p24gf.fsf@gnu.org> Message-ID: References: <24453.1751060166@bach.localdomain> <34220.1751153312@bach.localdomain> <86a55r5dv2.fsf@gnu.org> <19433.1751218460@bach.localdomain> <86o6u54emc.fsf@gnu.org> <86wm8t2gy5.fsf@gnu.org> <86ikkc2kx8.fsf@gnu.org> <86seje2597.fsf@gnu.org> <867c0p24gf.fsf@gnu.org> Date: Thu, 03 Jul 2025 10:48:51 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.285 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.1 (---) --=-=-= Content-Type: text/plain > I agree that calling keyboard-quit is better. So, I suggest the patch below. Stefan --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=replace.patch diff --git a/lisp/replace.el b/lisp/replace.el index 9939273594f..f61a6445c4b 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -2491,16 +2491,17 @@ query-replace-map (define-key map [f1] 'help) (define-key map [help] 'help) (define-key map "?" 'help) - (define-key map "\C-g" 'quit) - (define-key map "\C-]" 'quit) - (define-key map "\C-v" 'scroll-up) - (define-key map "\M-v" 'scroll-down) - (define-key map [next] 'scroll-up) - (define-key map [prior] 'scroll-down) - (define-key map [?\C-\M-v] 'scroll-other-window) - (define-key map [M-next] 'scroll-other-window) - (define-key map [?\C-\M-\S-v] 'scroll-other-window-down) - (define-key map [M-prior] 'scroll-other-window-down) + (define-key map "\C-g" #'keyboard-quit) + (define-key map "\C-]" #'keyboard-quit) + ;; FIXME: Should we use `scroll-(up|down)-command' here instead? + (define-key map "\C-v" #'scroll-up) + (define-key map "\M-v" #'scroll-down) + (define-key map [next] #'scroll-up) + (define-key map [prior] #'scroll-down) + (define-key map [?\C-\M-v] #'scroll-other-window) + (define-key map [M-next] #'scroll-other-window) + (define-key map [?\C-\M-\S-v] #'scroll-other-window-down) + (define-key map [M-prior] #'scroll-other-window-down) ;; Binding ESC would prohibit the M-v binding. Instead, callers ;; should check for ESC specially. ;; (define-key map "\e" 'exit-prefix) @@ -2509,11 +2510,13 @@ query-replace-map "Keymap of responses to questions posed by commands like `query-replace'. The \"bindings\" in this map are not commands; they are answers. The valid answers include `act', `skip', `act-and-show', -`act-and-exit', `exit', `exit-prefix', `recenter', `scroll-up', -`scroll-down', `scroll-other-window', `scroll-other-window-down', -`edit', `edit-replacement', `edit-replacement-exact-case', +`act-and-exit', `exit', `exit-prefix', `recenter', `edit', +`edit-replacement', `edit-replacement-exact-case', `delete-and-edit', `automatic', `backup', `undo', `undo-all', -`quit', and `help'. +and `help'. +This said, valid answers can also be interactive functions. +Functions that can make sense here include `scroll-up', `scroll-down', +`scroll-other-window', `scroll-other-window-down', and `keyboard-quit'. This keymap is used by `y-or-n-p' as well as `query-replace'.") diff --git a/lisp/subr.el b/lisp/subr.el index 69f6e4dbab8..0a1d676445b 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -4047,14 +4047,19 @@ y-or-n-p ((memq answer '(skip act)) nil) ((eq answer 'recenter) (recenter) t) + ;; Explicitly handle the other non-commands, to avoid + ;; conflicts with possible commands of the same name. + ((memq answer '( act-and-show act-and-exit exit edit + edit-replacement edit-replacement-exact-case + delete-and-edit automatic backup + undo undo-all help)) + t) ((eq answer 'scroll-up) (ignore-errors (scroll-up-command)) t) ((eq answer 'scroll-down) (ignore-errors (scroll-down-command)) t) - ((eq answer 'scroll-other-window) - (ignore-errors (scroll-other-window)) t) - ((eq answer 'scroll-other-window-down) - (ignore-errors (scroll-other-window-down)) t) + ((functionp answer) + (call-interactively answer) t) ((or (memq answer '(exit-prefix quit)) (eq key ?\e)) (signal 'quit nil) t) (t t))) --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 03 12:02:30 2025 Received: (at 78916) by debbugs.gnu.org; 3 Jul 2025 16:02:30 +0000 Received: from localhost ([127.0.0.1]:50335 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uXMOM-0002sC-A5 for submit@debbugs.gnu.org; Thu, 03 Jul 2025 12:02:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36146) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uXMOK-0002rj-A2 for 78916@debbugs.gnu.org; Thu, 03 Jul 2025 12:02:29 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uXMOE-00045n-EB; Thu, 03 Jul 2025 12:02:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=lWx7jOpmAq1niTOXeAryFwS8av6MVGIT8eGD9NtFvi8=; b=C1TqHe5EN5Ln aKJSmoySyjxhnyivgDCs8vOJBFtjaL+6ydhAwd+OfYs879pXrOa0j7lZaE4KBuYWNZl7I/eXVA4vT iQlN9O92Sj2wMu7vhDt6yWLtRWJ/4NkG16deR3B9gzA//WP40b4ZpiooLT15wW0CiG7KoqaXi2En4 GIJ9/GI+1cmNNCLcm5LFPgZQG9LPsVDOQ8RDQgs7oA4R5vFQJ9KxQdyXxCLxWhMw/7XaksTmSCM68 GbHRdre70pN7IoV2IR5FRcnX14u4qb9ahuH15/uahv7JjwRbV0Jy5NaLV4PTUg5uplfeyHoqr5YD7 SYwOfggN4nvK2nysj1AG0w==; Date: Thu, 03 Jul 2025 19:01:39 +0300 Message-Id: <86h5ztz2jg.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-Reply-To: (message from Stefan Monnier on Thu, 03 Jul 2025 10:48:51 -0400) Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop References: <24453.1751060166@bach.localdomain> <34220.1751153312@bach.localdomain> <86a55r5dv2.fsf@gnu.org> <19433.1751218460@bach.localdomain> <86o6u54emc.fsf@gnu.org> <86wm8t2gy5.fsf@gnu.org> <86ikkc2kx8.fsf@gnu.org> <86seje2597.fsf@gnu.org> <867c0p24gf.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Monnier > Cc: 78916@debbugs.gnu.org, kupfer@rawbw.com > Date: Thu, 03 Jul 2025 10:48:51 -0400 > > > I agree that calling keyboard-quit is better. > > So, I suggest the patch below. Thanks. > diff --git a/lisp/subr.el b/lisp/subr.el > index 69f6e4dbab8..0a1d676445b 100644 > --- a/lisp/subr.el > +++ b/lisp/subr.el > @@ -4047,14 +4047,19 @@ y-or-n-p > ((memq answer '(skip act)) nil) > ((eq answer 'recenter) > (recenter) t) > + ;; Explicitly handle the other non-commands, to avoid > + ;; conflicts with possible commands of the same name. > + ((memq answer '( act-and-show act-and-exit exit edit > + edit-replacement edit-replacement-exact-case > + delete-and-edit automatic backup > + undo undo-all help)) > + t) > ((eq answer 'scroll-up) > (ignore-errors (scroll-up-command)) t) > ((eq answer 'scroll-down) > (ignore-errors (scroll-down-command)) t) > - ((eq answer 'scroll-other-window) > - (ignore-errors (scroll-other-window)) t) > - ((eq answer 'scroll-other-window-down) > - (ignore-errors (scroll-other-window-down)) t) > + ((functionp answer) > + (call-interactively answer) t) Why not 'commandp'? From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 03 13:43:41 2025 Received: (at 78916) by debbugs.gnu.org; 3 Jul 2025 17:43:41 +0000 Received: from localhost ([127.0.0.1]:51347 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uXNyH-0000SC-0u for submit@debbugs.gnu.org; Thu, 03 Jul 2025 13:43:41 -0400 Received: from mail-24418.protonmail.ch ([109.224.244.18]:17157) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uXNyC-0000Qw-Ny for 78916@debbugs.gnu.org; Thu, 03 Jul 2025 13:43:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1751564610; x=1751823810; bh=tJPx3DZngcaEr9arcMI9UhbJvhVwipMsRPOgnO1F7/s=; h=Date:To:From:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=rLEG3mIAT+AzgN9FFb1vsLFfaGX6reJuhawzCQe3comcRElo5fyVXo0mWy0T8lQPB zbF8tXRUOaqtnHLWbuG8jD/gcaI8dN9lNaPjhjOzqCF5vyvqFFlPniNfjTzXaONzGh oGG1/vkD4rV28oDezG5BjBMHmQiEhPiFBgnDukxKXrA8P6GqG4X6FxVepTiygnJLsl Eeb4zs/bVhf2S1MUU97kbwvIsgK2vJZoYDG/Jmw6BanNxZ6lf6E2YyQL4EldiqFDnV Q+tzuJFG90fTVdv0OSq5SXtu9ssW3fhKJqX6IsARlVlEVeoJhTFyYw0wPzfzyC+YkH HmcXyFbrpQ/fQ== Date: Thu, 03 Jul 2025 17:43:25 +0000 To: Eli Zaretskii , Stefan Monnier , 78916@debbugs.gnu.org, kupfer@rawbw.com From: Pip Cet Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop Message-ID: <87tt3tw4p4.fsf@protonmail.com> In-Reply-To: References: <24453.1751060166@bach.localdomain> <86wm8t2gy5.fsf@gnu.org> <86ikkc2kx8.fsf@gnu.org> <86seje2597.fsf@gnu.org> <867c0p24gf.fsf@gnu.org> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: 6684413696862384874232d65ee185e4b1ccdfed MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 78916 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) "Stefan Monnier via \"Bug reports for GNU Emacs, the Swiss army knife of te= xt editors\"" writes: >> I agree that calling keyboard-quit is better. > > So, I suggest the patch below. I'd just like to note that this breaks badly if quitchar is changed. That doesn't mean we shouldn't apply this patch, it means we should remove the vestigial support for changing quitchar from keyboard.c (However, there are other good reason not to apply this patch, and simply fix read-key to optionally allow quitting instead. There is no reason to make Lisp users choose between having to handle quit themselves (which currently requires mucking about with low-level input details such as determining quitchar) and having to handle low-level events themselves. Most users don't want to do either thing. And we definitely need to fix (while t (message "%S" (read-key))) destroying your session. It's simply a bug in keyboard.c that this isn't recognized by the triple-C-g code in GUI sessions, or the double-C-g code in terminal sessions. IMHO, no further replacements of read-event by read-key should be performed until we've made the latter function less hostile to novice Lisp hackers.) Pip From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 03 15:23:47 2025 Received: (at 78916) by debbugs.gnu.org; 3 Jul 2025 19:23:47 +0000 Received: from localhost ([127.0.0.1]:51879 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uXPX8-0008Tk-PH for submit@debbugs.gnu.org; Thu, 03 Jul 2025 15:23:47 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:59017) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uXPX6-0008T6-Iq for 78916@debbugs.gnu.org; Thu, 03 Jul 2025 15:23:45 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 550DF442194; Thu, 3 Jul 2025 15:23:38 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1751570617; bh=XSYC5Lz5iNvdJobq9cvY/pREA5yaA7aG4JsWCCI2vPg=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=XBMD53CzstPrgiv0x7rswaYnJ5OHtq4pXyaBHUknoug6oLZfGgESykoAMA1HXzCrT y5T2hekTz/FwM+qbsNRaJjF6naS89KP2p/FCLvJ+NkpDW0Z0unfk4VVD+XF+uz1D8y H5H3++NH1AnPLhymQN6tMUFl1KkUNkdfm4Pfsm3EcxULFFcXyYI4Epm4TCVxMFQWkp 6nqSM4jN3xHKjlayitMDfbBiH76UC3h233uSMdC+fYrXgZLkbxy7/1V6nyYIc1fVyH Y0lbFOOT+CbIGMsH3S9Cump8SQfmF+fn9sYuBG11149N+Z/2q8qG+bwDBN8SsTPcbN N+oB4zfvK29Ng== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 63228442182; Thu, 3 Jul 2025 15:23:37 -0400 (EDT) Received: from alfajor (unknown [23.233.149.155]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 41D2212034B; Thu, 3 Jul 2025 15:23:37 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop In-Reply-To: <86h5ztz2jg.fsf@gnu.org> Message-ID: References: <24453.1751060166@bach.localdomain> <34220.1751153312@bach.localdomain> <86a55r5dv2.fsf@gnu.org> <19433.1751218460@bach.localdomain> <86o6u54emc.fsf@gnu.org> <86wm8t2gy5.fsf@gnu.org> <86ikkc2kx8.fsf@gnu.org> <86seje2597.fsf@gnu.org> <867c0p24gf.fsf@gnu.org> <86h5ztz2jg.fsf@gnu.org> Date: Thu, 03 Jul 2025 15:23:30 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.194 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.1 (---) >> - ((eq answer 'scroll-other-window) >> - (ignore-errors (scroll-other-window)) t) >> - ((eq answer 'scroll-other-window-down) >> - (ignore-errors (scroll-other-window-down)) t) >> + ((functionp answer) >> + (call-interactively answer) t) > > Why not 'commandp'? No strong reason: - `call-interactively` doesn't work on vectors and strings, only on functions. - I prefer an error about a function failing to be interactive than just ignoring the binding. But yeah, the second point also applies to strings and vectors, so maybe it should be (or (functionp answer) (commandp answer)) or even (or (functionp answer) (not (symbolp answer))) ? Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 03 15:27:08 2025 Received: (at 78916) by debbugs.gnu.org; 3 Jul 2025 19:27:08 +0000 Received: from localhost ([127.0.0.1]:51896 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uXPaN-0000UG-WE for submit@debbugs.gnu.org; Thu, 03 Jul 2025 15:27:08 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:22701) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uXPaL-0000TA-P6 for 78916@debbugs.gnu.org; Thu, 03 Jul 2025 15:27:06 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 6382D80A42; Thu, 3 Jul 2025 15:27:00 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1751570819; bh=WNJNcwq9DYphI1ky9KiaszAHHfZ1nLNcX5Jgdyxym7o=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=lrsON89wOHNgebsmuPnedsUkM1Hb0phtY27SCwp7hgF8WUW8C+2HejPNi28MKFIWH TvyUfzB/wxYrynN0qwmd5wmm/xMhm5zm1N+topRNUkcLy8u7MyeULjVX1OFWI1jEoQ J3geHnUYjyp/i/bkeQKrJmwlfEAatCzCdmGsoE2WHfGFx7lZM6arvDNVoRZiDaob3i Wypnfin6zwjugpwyqM7yiv9pTsEHZ7tqPyMP2AysC4zvsWPTRur3uM2muS8Utv33UG rgn2LqKiVJf1cY2jmZ8AW9k2V8gNXbZ3HtSoNDBa7b7tJ6jzU5WB+T/2V8qNSl7wN6 PjxFeTBhPsOSQ== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 585FF80995; Thu, 3 Jul 2025 15:26:59 -0400 (EDT) Received: from alfajor (unknown [23.233.149.155]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 2E2761202AB; Thu, 3 Jul 2025 15:26:59 -0400 (EDT) From: Stefan Monnier To: Pip Cet Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop In-Reply-To: <87tt3tw4p4.fsf@protonmail.com> Message-ID: References: <24453.1751060166@bach.localdomain> <86wm8t2gy5.fsf@gnu.org> <86ikkc2kx8.fsf@gnu.org> <86seje2597.fsf@gnu.org> <867c0p24gf.fsf@gnu.org> <87tt3tw4p4.fsf@protonmail.com> Date: Thu, 03 Jul 2025 15:26:59 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.198 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, Eli Zaretskii , kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.1 (---) > (However, there are other good reason not to apply this patch, and > simply fix read-key to optionally allow quitting instead. That wouldn't fix the `C-]` case. Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 04 02:09:00 2025 Received: (at 78916) by debbugs.gnu.org; 4 Jul 2025 06:09:00 +0000 Received: from localhost ([127.0.0.1]:56000 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uXZbY-0005yk-8r for submit@debbugs.gnu.org; Fri, 04 Jul 2025 02:09:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43568) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uXZbU-0005xn-Fq for 78916@debbugs.gnu.org; Fri, 04 Jul 2025 02:08:58 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uXZbO-0002Rc-VV; Fri, 04 Jul 2025 02:08:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=zGX0n5dq93DRtc/9TjlQxWl9MPBeH9lhCsowYIIR6n0=; b=e5PRnNwrftjc gCyghFeTYN/99VKncgUXyn9oveGQ99H8vmu6RHsI8QwwE5HJO1gkHh/cxnBzBKCjIQaMfPjJhwEmq IxLNxTCCHbTPXx9xWDBP+HLlY64FUCosxv2TZPoupf5zi5E2cEKTs29cXydqrFJHGS7Xs+bBJc5IF 2Fx26XeaI4uiTvC50uuQdk4xl5Xujv5WKuhBmFXtnfPkC49NQuXzQc35W72t7Y+q8sBokBc5+uS4S Aikm157mUFIaGiYrhMRKjppa9/vvBmY+7p8JBkS5u1xXnjrp6yZLCMNnVofQwXPOm55m3b0jrTx2O H8XhZyZeGkGYTJznegNUWQ==; Date: Fri, 04 Jul 2025 09:08:47 +0300 Message-Id: <86frfczdw0.fsf@gnu.org> From: Eli Zaretskii To: monnier@iro.umontreal.ca In-Reply-To: <86h5ztz2jg.fsf@gnu.org> (message from Eli Zaretskii on Thu, 03 Jul 2025 19:01:39 +0300) Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop References: <24453.1751060166@bach.localdomain> <34220.1751153312@bach.localdomain> <86a55r5dv2.fsf@gnu.org> <19433.1751218460@bach.localdomain> <86o6u54emc.fsf@gnu.org> <86wm8t2gy5.fsf@gnu.org> <86ikkc2kx8.fsf@gnu.org> <86seje2597.fsf@gnu.org> <867c0p24gf.fsf@gnu.org> <86h5ztz2jg.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Cc: 78916@debbugs.gnu.org, kupfer@rawbw.com > Date: Thu, 03 Jul 2025 19:01:39 +0300 > From: Eli Zaretskii > > > From: Stefan Monnier > > Cc: 78916@debbugs.gnu.org, kupfer@rawbw.com > > Date: Thu, 03 Jul 2025 10:48:51 -0400 > > > > > I agree that calling keyboard-quit is better. > > > > So, I suggest the patch below. > > Thanks. Actually, shouldn't C-] invoke abort-recursive-edit instead? Wouldn't 'quit in the previous version do that, when abort-recursive-edit's effect could be seen? From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 04 02:43:09 2025 Received: (at 78916) by debbugs.gnu.org; 4 Jul 2025 06:43:09 +0000 Received: from localhost ([127.0.0.1]:56181 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uXa8a-0001pP-GQ for submit@debbugs.gnu.org; Fri, 04 Jul 2025 02:43:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41968) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uXa8X-0001o4-PW for 78916@debbugs.gnu.org; Fri, 04 Jul 2025 02:43:06 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uXa8R-0000pN-Su; Fri, 04 Jul 2025 02:42:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=qPohYpVgzFN8DpPsiIIVwHgmPz/xfirYb3r6nnF4p1A=; b=YgQPt+jgFX5E wDBpsiNmp2YmS3exD1hzpg6k0j0xdjlqsXd3rAZzjM2cIcmn+2n9+IWdj705YxDRxZkA3n3Yg64QH FOaMD7PFxt7I5iUFXdZph3ZPLeOjEefUbe3SOb3QXlupx0SRgafshILnZaWxUNkhGdlLqZPKnRmZa PWrHyHGbneOix0xRPy0+yhjSvHg4TYH0YJNYn6ysJn6bzn13dhklIBL7ukkPyQiwQP7ugOjzRucPI 7wRJY6IB16jIBO0RtFGw9Nty7Zkvpn9P3tIt2A5NOeRxTnjVL0mW4xK6t15XhKiuZYgAE2LwxPVpo sfGK9YL0cFc8YHArr+55mg==; Date: Fri, 04 Jul 2025 09:42:55 +0300 Message-Id: <86a55kzcb4.fsf@gnu.org> From: Eli Zaretskii To: Pip Cet In-Reply-To: <87tt3tw4p4.fsf@protonmail.com> (message from Pip Cet on Thu, 03 Jul 2025 17:43:25 +0000) Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop References: <24453.1751060166@bach.localdomain> <86wm8t2gy5.fsf@gnu.org> <86ikkc2kx8.fsf@gnu.org> <86seje2597.fsf@gnu.org> <867c0p24gf.fsf@gnu.org> <87tt3tw4p4.fsf@protonmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, monnier@iro.umontreal.ca, kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Thu, 03 Jul 2025 17:43:25 +0000 > From: Pip Cet > > "Stefan Monnier via \"Bug reports for GNU Emacs, the Swiss army knife of text editors\"" writes: > > >> I agree that calling keyboard-quit is better. > > > > So, I suggest the patch below. > > I'd just like to note that this breaks badly if quitchar is changed. > That doesn't mean we shouldn't apply this patch, it means we should > remove the vestigial support for changing quitchar from keyboard.c I don't want to remove support for quit-char unless someone explains that it cannot work well. But it is well known that changing quit-char doesn't work well already. And if we decide to change all the bindings of C-g to be bound to quit-char instead, it should be trivial to fix this one as well, right? From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 04 02:59:29 2025 Received: (at 78916) by debbugs.gnu.org; 4 Jul 2025 06:59:29 +0000 Received: from localhost ([127.0.0.1]:56239 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uXaOO-0003hT-Sk for submit@debbugs.gnu.org; Fri, 04 Jul 2025 02:59:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52202) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uXaOL-0003gs-T1 for 78916@debbugs.gnu.org; Fri, 04 Jul 2025 02:59:26 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uXaOF-0007u2-H5; Fri, 04 Jul 2025 02:59:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=Z02vmOeXHgA5MuaTAVb86J6VYYjWsQ+6i0eUJANcJlY=; b=MB4LlGqlQFTi g0fOJO0uA7HoJwH1MiFGO7S8VGwFU/H0/f8glM4LrJI6WqI8g7rcB7CmBz8JBCdEF370y2ycjBVXt IQwFjQoBaiomFlCZO5gXfBuzeCLgl/Zgy7FT/usiwiHytCPHaQ+z9uiEomavl0aKWineA26JYi2sk ouDM6YaGERUC4U3kpqxrRkJRaVuQReVwKkP+XqioaFWX1QzdsqoQT1qoWHH2gtWtvzsytzmG/4fK2 DSmBJfLUdubtmI2dYrbaIYxvL7MlVFZ9kKsQz0qYA5U8CJEzyuIM/17hl5ybjYJyqFebn+XugXTyJ 1DLYpbXSz9xQWyN7E/jsWA==; Date: Fri, 04 Jul 2025 09:59:16 +0300 Message-Id: <867c0ozbjv.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-Reply-To: (message from Stefan Monnier on Thu, 03 Jul 2025 15:23:30 -0400) Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop References: <24453.1751060166@bach.localdomain> <34220.1751153312@bach.localdomain> <86a55r5dv2.fsf@gnu.org> <19433.1751218460@bach.localdomain> <86o6u54emc.fsf@gnu.org> <86wm8t2gy5.fsf@gnu.org> <86ikkc2kx8.fsf@gnu.org> <86seje2597.fsf@gnu.org> <867c0p24gf.fsf@gnu.org> <86h5ztz2jg.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Monnier > Cc: 78916@debbugs.gnu.org, kupfer@rawbw.com > Date: Thu, 03 Jul 2025 15:23:30 -0400 > > >> - ((eq answer 'scroll-other-window) > >> - (ignore-errors (scroll-other-window)) t) > >> - ((eq answer 'scroll-other-window-down) > >> - (ignore-errors (scroll-other-window-down)) t) > >> + ((functionp answer) > >> + (call-interactively answer) t) > > > > Why not 'commandp'? > > No strong reason: > > - `call-interactively` doesn't work on vectors and strings, only > on functions. > - I prefer an error about a function failing to be interactive than just > ignoring the binding. > > But yeah, the second point also applies to strings and vectors, so maybe > it should be (or (functionp answer) (commandp answer)) or even > (or (functionp answer) (not (symbolp answer))) ? Something like that, yes. From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 04 10:23:45 2025 Received: (at 78916) by debbugs.gnu.org; 4 Jul 2025 14:23:45 +0000 Received: from localhost ([127.0.0.1]:33083 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uXhKK-0007G0-0n for submit@debbugs.gnu.org; Fri, 04 Jul 2025 10:23:44 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:5791) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uXhKG-0007Eh-AK for 78916@debbugs.gnu.org; Fri, 04 Jul 2025 10:23:41 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id AF72710024D; Fri, 4 Jul 2025 10:23:34 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1751639009; bh=L5sC1IVoufhvC3YXquT9Aw0wj7v1F/suMMz6ehU+iaQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=aCoEOJyWfmi7dMevICSsYpfOF+wSghXz51BhVAv9grf0/vDrR/GBglwwjDv6heooI w0HmyrEBSuz4wD6FDG4meOMbqNDxQhWaayYhjcd96jLt7/L1Yg1zue/71e1AsjTyb4 T2cDp36cU2Zr9FjlKY/FmfumBOYeQpsnW90E5lvwZL+T4I8afslE8gFs+yh7g04Ff1 FNTG6tw3w4op+YzKgD+POhgAIdZR7ZtUcc3kvekOofXyQQOOnrz6FuYQjIwLtFWN8T Y65YtvK/UaKxdzspd+4dr4ZOysUor5u1+N6d4LosZN+nyPDTCQ54mM/qbxY5Die09x /4vk7ODwRGfUw== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 6D123100029; Fri, 4 Jul 2025 10:23:29 -0400 (EDT) Received: from pastel (unknown [104.247.225.139]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 3C8471208BC; Fri, 4 Jul 2025 10:23:29 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop In-Reply-To: <867c0ozbjv.fsf@gnu.org> Message-ID: References: <24453.1751060166@bach.localdomain> <34220.1751153312@bach.localdomain> <86a55r5dv2.fsf@gnu.org> <19433.1751218460@bach.localdomain> <86o6u54emc.fsf@gnu.org> <86wm8t2gy5.fsf@gnu.org> <86ikkc2kx8.fsf@gnu.org> <86seje2597.fsf@gnu.org> <867c0p24gf.fsf@gnu.org> <86h5ztz2jg.fsf@gnu.org> <867c0ozbjv.fsf@gnu.org> Date: Fri, 04 Jul 2025 10:23:28 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.295 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.1 (---) --=-=-= Content-Type: text/plain >> But yeah, the second point also applies to strings and vectors, so maybe >> it should be (or (functionp answer) (commandp answer)) or even >> (or (functionp answer) (not (symbolp answer))) ? > > Something like that, yes. Together with > Actually, shouldn't C-] invoke abort-recursive-edit instead? Wouldn't > 'quit in the previous version do that, when abort-recursive-edit's > effect could be seen? Gives me the patch below. Stefan --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=replace.patch diff --git a/lisp/replace.el b/lisp/replace.el index 9939273594f..4010162150d 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -2491,16 +2491,17 @@ query-replace-map (define-key map [f1] 'help) (define-key map [help] 'help) (define-key map "?" 'help) - (define-key map "\C-g" 'quit) - (define-key map "\C-]" 'quit) - (define-key map "\C-v" 'scroll-up) - (define-key map "\M-v" 'scroll-down) - (define-key map [next] 'scroll-up) - (define-key map [prior] 'scroll-down) - (define-key map [?\C-\M-v] 'scroll-other-window) - (define-key map [M-next] 'scroll-other-window) - (define-key map [?\C-\M-\S-v] 'scroll-other-window-down) - (define-key map [M-prior] 'scroll-other-window-down) + (define-key map "\C-g" #'keyboard-quit) + (define-key map "\C-]" #'abort-recursive-edit) + ;; FIXME: Should we use `scroll-(up|down)-command' here instead? + (define-key map "\C-v" #'scroll-up) + (define-key map "\M-v" #'scroll-down) + (define-key map [next] #'scroll-up) + (define-key map [prior] #'scroll-down) + (define-key map [?\C-\M-v] #'scroll-other-window) + (define-key map [M-next] #'scroll-other-window) + (define-key map [?\C-\M-\S-v] #'scroll-other-window-down) + (define-key map [M-prior] #'scroll-other-window-down) ;; Binding ESC would prohibit the M-v binding. Instead, callers ;; should check for ESC specially. ;; (define-key map "\e" 'exit-prefix) @@ -2509,11 +2510,13 @@ query-replace-map "Keymap of responses to questions posed by commands like `query-replace'. The \"bindings\" in this map are not commands; they are answers. The valid answers include `act', `skip', `act-and-show', -`act-and-exit', `exit', `exit-prefix', `recenter', `scroll-up', -`scroll-down', `scroll-other-window', `scroll-other-window-down', -`edit', `edit-replacement', `edit-replacement-exact-case', +`act-and-exit', `exit', `exit-prefix', `recenter', `edit', +`edit-replacement', `edit-replacement-exact-case', `delete-and-edit', `automatic', `backup', `undo', `undo-all', -`quit', and `help'. +and `help'. +This said, valid answers can also be interactive functions. +Functions that can make sense here include `scroll-up', `scroll-down', +`scroll-other-window', `scroll-other-window-down', and `keyboard-quit'. This keymap is used by `y-or-n-p' as well as `query-replace'.") diff --git a/lisp/subr.el b/lisp/subr.el index 69f6e4dbab8..3777ce07ac0 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -4047,17 +4047,20 @@ y-or-n-p ((memq answer '(skip act)) nil) ((eq answer 'recenter) (recenter) t) + ;; Explicitly handle the other non-commands, to avoid + ;; conflicts with possible commands of the same name. + ((memq answer '( act-and-show act-and-exit exit edit + edit-replacement edit-replacement-exact-case + delete-and-edit automatic backup + undo undo-all help)) + t) ((eq answer 'scroll-up) (ignore-errors (scroll-up-command)) t) ((eq answer 'scroll-down) (ignore-errors (scroll-down-command)) t) - ((eq answer 'scroll-other-window) - (ignore-errors (scroll-other-window)) t) - ((eq answer 'scroll-other-window-down) - (ignore-errors (scroll-other-window-down)) t) ((or (memq answer '(exit-prefix quit)) (eq key ?\e)) (signal 'quit nil) t) - (t t))) + (t (call-interactively answer) t))) (ding) (discard-input))) (t --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 04 10:33:34 2025 Received: (at 78916) by debbugs.gnu.org; 4 Jul 2025 14:33:35 +0000 Received: from localhost ([127.0.0.1]:33152 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uXhTn-0000JU-1h for submit@debbugs.gnu.org; Fri, 04 Jul 2025 10:33:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51070) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uXhTi-0000IT-Kz for 78916@debbugs.gnu.org; Fri, 04 Jul 2025 10:33:28 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uXhTc-0007rb-HO; Fri, 04 Jul 2025 10:33:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=W5nQ75UjcsAya08WQBVdftdsZbbrBi8aUZr/MgdR7Lg=; b=Pxi01DG2Fd/D alBEeYCByYyYhaxq8P4Stg2CzMrfDQfmq/iATjMGCZPEz/hammQo23SyRKFrfNvBufgYD0mZ2n4Ay 5Aq3cDa3JF1DNFfO5k8VGqxppmywTiU/27DzGxMotipcXm7HlAtxU2Df52C1FcBJlGWCaze8F6ytl 3MIWdD+6UWVm6bTDDM5gkL73brzyTx04Aa2WUCBUnVyhekPDV76MLtpSW3I86nH31hhFrb2EYp0/N r9gSY+qmmH5p5dFcPwvIZgydhhFJnsrwXul3rLPTa3KJn1+SJw0nnQZ3lnBsUNWmToVC3XgS7d8Dc tCE4iM3pS+2kR0DQHI2JdQ==; Date: Fri, 04 Jul 2025 17:32:54 +0300 Message-Id: <86ms9kxbzd.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-Reply-To: (message from Stefan Monnier on Fri, 04 Jul 2025 10:23:28 -0400) Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop References: <24453.1751060166@bach.localdomain> <34220.1751153312@bach.localdomain> <86a55r5dv2.fsf@gnu.org> <19433.1751218460@bach.localdomain> <86o6u54emc.fsf@gnu.org> <86wm8t2gy5.fsf@gnu.org> <86ikkc2kx8.fsf@gnu.org> <86seje2597.fsf@gnu.org> <867c0p24gf.fsf@gnu.org> <86h5ztz2jg.fsf@gnu.org> <867c0ozbjv.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Monnier > Cc: 78916@debbugs.gnu.org, kupfer@rawbw.com > Date: Fri, 04 Jul 2025 10:23:28 -0400 > > >> But yeah, the second point also applies to strings and vectors, so maybe > >> it should be (or (functionp answer) (commandp answer)) or even > >> (or (functionp answer) (not (symbolp answer))) ? > > > > Something like that, yes. > > Together with > > > Actually, shouldn't C-] invoke abort-recursive-edit instead? Wouldn't > > 'quit in the previous version do that, when abort-recursive-edit's > > effect could be seen? > > Gives me the patch below. LGTM, thanks. From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 04 14:06:25 2025 Received: (at 78916) by debbugs.gnu.org; 4 Jul 2025 18:06:25 +0000 Received: from localhost ([127.0.0.1]:35058 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uXkno-0005GV-KO for submit@debbugs.gnu.org; Fri, 04 Jul 2025 14:06:24 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:27157) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uXknl-0005Fe-29 for 78916@debbugs.gnu.org; Fri, 04 Jul 2025 14:06:22 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 771FF10024D; Fri, 4 Jul 2025 14:06:14 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1751652373; bh=OZECzrTICziZTi8kUYM/nf9a/zuafIjPsiq9txXyfFE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=ddNPrGXcv+T4d+54j6Vx6twhqT20WAamedvBwQRvncRNv5bJc5aSSt7bG9yygTA5k 9l2Ya4Au8kNRa1R8lnZsfYTueIJz6k4fcxazy8VzWqtlwujbXzc1f5Dle57B+xiZVC kD3cnPX/0RibhWBBx9lkr6IwN2Efl19BwtfiASS3ApqBQ5wIxvkefF6RcMO4laRNTB OOHUFNOdNMfjJ/OswIlDolrlfVFFSPeQo4kmMtqd3KDrkWLOwvtpiM9iGL2FwW/KoT kV0gU7Ac/hJ96YMrDWXtiuYxtDIgvg9paiUwxjyPevyMv1JDUW18x3fiDk4EjIkFn7 cM4tT/Of8+Rag== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id A5A50100029; Fri, 4 Jul 2025 14:06:13 -0400 (EDT) Received: from alfajor (bras-base-mtrlpq42zf4-grc-21-184-145-175-217.dsl.bell.ca [184.145.175.217]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 8992B1206AC; Fri, 4 Jul 2025 14:06:13 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop In-Reply-To: <86ms9kxbzd.fsf@gnu.org> Message-ID: References: <24453.1751060166@bach.localdomain> <34220.1751153312@bach.localdomain> <86a55r5dv2.fsf@gnu.org> <19433.1751218460@bach.localdomain> <86o6u54emc.fsf@gnu.org> <86wm8t2gy5.fsf@gnu.org> <86ikkc2kx8.fsf@gnu.org> <86seje2597.fsf@gnu.org> <867c0p24gf.fsf@gnu.org> <86h5ztz2jg.fsf@gnu.org> <867c0ozbjv.fsf@gnu.org> <86ms9kxbzd.fsf@gnu.org> Date: Fri, 04 Jul 2025 14:06:13 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.108 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.1 (---) > 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' From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 04 14:16:45 2025 Received: (at 78916) by debbugs.gnu.org; 4 Jul 2025 18:16:45 +0000 Received: from localhost ([127.0.0.1]:35087 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uXkxo-0006Yw-MR for submit@debbugs.gnu.org; Fri, 04 Jul 2025 14:16:45 -0400 Received: from mail-24416.protonmail.ch ([109.224.244.16]:42989) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uXkxl-0006XT-Cu for 78916@debbugs.gnu.org; Fri, 04 Jul 2025 14:16:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1751652994; x=1751912194; bh=pgAdS3f58io356oP2zlZmP9tMgy3b20MgiP0ffH/kf4=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=Yrqb72mICp7ze9/sUqjKTKxJbjrAtMzZVqYbpT8+jLI4jnTVSWPns+nOwu63TnAs0 v0sgpUKwOr0m5qe9J2sZ9VculRj+dfeum1SVn9JBw/12iQ5RwBlct8O6L8dc3XLywO kmz1D68ti8PRHj/wnchiAybqOfUxzRhVm+cdQdWUuT3Zxs081Gq9+MFdJ+TJHFaakc wFFNThK19okc7jELbLn78ee3hu+sf9z1bbitnA+uTVihXvKhf+3hE9kk1b3eRtSoPM ewD7slvhijgghNBxwpDhsuz5oIbhqshquwotxpN//lnurpLNTbzMEuDotUQWqCiKJ3 NqaG9QkxEG+8A== Date: Fri, 04 Jul 2025 18:16:29 +0000 To: Stefan Monnier From: Pip Cet Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop Message-ID: <87a55jx1my.fsf@protonmail.com> In-Reply-To: References: <24453.1751060166@bach.localdomain> <86ikkc2kx8.fsf@gnu.org> <86seje2597.fsf@gnu.org> <867c0p24gf.fsf@gnu.org> <87tt3tw4p4.fsf@protonmail.com> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: 6f171aa42a11e6d16761a36aab95636c3123f071 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, Eli Zaretskii , kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) "Stefan Monnier" writes: >> (However, there are other good reason not to apply this patch, and >> simply fix read-key to optionally allow quitting instead. > > That wouldn't fix the `C-]` case. I'm not sure it's that important. It's not documented in query-replace-help, and I'm not really sure whether it should behave like C-g or ESC (or should ESC be fixed, too?) or any unbound key (like "r"). But, sure, if we want to change the behavior of C-], that requires a change beyond making C-g quit in our read-key call, because C-] is ordinary input (and the binding in the map is relevant), unlike C-g. The C-g case is documented (because C-g is documented for all of Emacs, and exceptions are noted) and will behave inconsistently (interrupting a timer in read-key will cause read-key to signal quit; if there's no timer, we look up the key and perform a (keyboard-quit)) in the current proposal. That may or may not be acceptable; adding the may-quit option to read-key would fix the problem for most callers, including this one, so it's a better solution. Pip From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 04 14:28:52 2025 Received: (at 78916) by debbugs.gnu.org; 4 Jul 2025 18:28:53 +0000 Received: from localhost ([127.0.0.1]:35116 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uXl9Y-00084H-2C for submit@debbugs.gnu.org; Fri, 04 Jul 2025 14:28:52 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:13696) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uXl9V-00083D-JP for 78916@debbugs.gnu.org; Fri, 04 Jul 2025 14:28:50 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 2FF788089D; Fri, 4 Jul 2025 14:28:44 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1751653723; bh=G3lAOGQ0qUWgKk/WSYFsxM7DZJvYdS1cCwIA4jfRdlg=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=AtooaHPZ6Oe5oaQqIl53N+sgGclTzyS9N3wTNY/auBZ+VHrIXt8vCE9HocKbto9Si SVH/TXBYjonlQFKtO8E5mP7VW969hChgZ9Zj2DOLGZ5xsYhbrjqFHY3bztNWcxxN5Y /fIhwEqQW7iuw87xx7vYJ9DF8VbU0TTqrvxFziiuBc6NezegfJ++uctMLa7C2UlSH+ zU3V2eTaWVtKTTewFKjBvS04o1oUwxBnBlSgV8Eoyq+Zq6+kEAjqe0GYrJwFhXX2um ccsewAsF/9bOSx9zaZuhCOUaeRfmzZHn+mLHfiiymycaTMjWWa3IR79xt5APzIrSIR mVfMxAkVL3c1Q== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 454F280898; Fri, 4 Jul 2025 14:28:43 -0400 (EDT) Received: from alfajor (bras-base-mtrlpq42zf4-grc-21-184-145-175-217.dsl.bell.ca [184.145.175.217]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 2F066120504; Fri, 4 Jul 2025 14:28:43 -0400 (EDT) From: Stefan Monnier To: Pip Cet Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop In-Reply-To: <87tt3tw4p4.fsf@protonmail.com> Message-ID: References: <24453.1751060166@bach.localdomain> <86wm8t2gy5.fsf@gnu.org> <86ikkc2kx8.fsf@gnu.org> <86seje2597.fsf@gnu.org> <867c0p24gf.fsf@gnu.org> <87tt3tw4p4.fsf@protonmail.com> Date: Fri, 04 Jul 2025 14:28:42 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.141 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, Eli Zaretskii , kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.1 (---) > (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. IOW, I don't think your proposal and my patch are exclusive. Regarding your proposal, I think it makes a lot of sense, especially to make it easier to convert `read-event` calls to `read-key` (tho I suspect it would be "more right" to call `keyboard-quit` rather than `(signal 'quit nil), but that's a bikeshed color I'm not wedded to). Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 04 14:32:30 2025 Received: (at 78916) by debbugs.gnu.org; 4 Jul 2025 18:32:30 +0000 Received: from localhost ([127.0.0.1]:35137 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uXlD4-00007S-39 for submit@debbugs.gnu.org; Fri, 04 Jul 2025 14:32:30 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:8776) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uXlD1-000078-WE for 78916@debbugs.gnu.org; Fri, 04 Jul 2025 14:32:28 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 8EDD2441380; Fri, 4 Jul 2025 14:32:22 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1751653941; bh=6ZMn/A5h3RDb+w8gGY9wM2bOI1L7iBkpDrZNurHOG9A=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=BrcFp7nidjBPuYTNtdomEP2a9eAqn2tNDBrlP4kCdjMCbU8Q5ASJVytZKg0Q8Rdmf ayW01Nb210unAP9UgomQYksGo/JyHEVthoaDgcSMqUTC71lCg4eEk8d7uUxprKjBal OPEftnbge7WVm5dIwA7I0WiL18UJa2ktuJWf6gaCEr6QGYJ5FW0EbX37G3K8tWSUPR Ir8jpzYekXHbQzCwev+VPsaVCsh4Z8n7U8hGrmdv1x59e/kRMhARYD5xqVCPCLU63H 353YxFieS7kNdpdJ9xH2cSNpyRSFZ3vKqcb1768QXjgSxaKf5gtSBc8ZkeF4NDIhe9 ZOVPZlRA01KMw== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 8BEF0440331; Fri, 4 Jul 2025 14:32:21 -0400 (EDT) Received: from alfajor (bras-base-mtrlpq42zf4-grc-21-184-145-175-217.dsl.bell.ca [184.145.175.217]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 7A2861202F4; Fri, 4 Jul 2025 14:32:21 -0400 (EDT) From: Stefan Monnier To: Pip Cet Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop In-Reply-To: <87a55jx1my.fsf@protonmail.com> Message-ID: References: <24453.1751060166@bach.localdomain> <86ikkc2kx8.fsf@gnu.org> <86seje2597.fsf@gnu.org> <867c0p24gf.fsf@gnu.org> <87tt3tw4p4.fsf@protonmail.com> <87a55jx1my.fsf@protonmail.com> Date: Fri, 04 Jul 2025 14:32:21 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.287 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, Eli Zaretskii , kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.1 (---) >>> (However, there are other good reason not to apply this patch, and >>> simply fix read-key to optionally allow quitting instead. >> That wouldn't fix the `C-]` case. > I'm not sure it's that important. It's not documented in > query-replace-help, and I'm not really sure whether it should behave > like C-g or ESC (or should ESC be fixed, too?) or any unbound key (like > "r"). The doc says: =E2=80=98quit=E2=80=99 Perform a quit right away. Only =E2=80=98y-or-n-p=E2=80=99 and re= lated functions use this answer. and currently it doesn't perform a quit at all. To me, it's clear now that the intention of the `C-]` binding in this keymap is to mimic the global `C-]` binding, so the current behavior in Mike's test case is wrong. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 05 02:32:32 2025 Received: (at 78916) by debbugs.gnu.org; 5 Jul 2025 06:32:33 +0000 Received: from localhost ([127.0.0.1]:38853 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uXwRr-0000rB-R3 for submit@debbugs.gnu.org; Sat, 05 Jul 2025 02:32:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38746) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uXwRn-0000pK-AC for 78916@debbugs.gnu.org; Sat, 05 Jul 2025 02:32:28 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uXwRg-0003qg-AK; Sat, 05 Jul 2025 02:32:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=44I8JeIabG9R2sOhd7XazvExiRtA8mdyFmjbaJrQJ+g=; b=r/B9wWTiudvG YnFylPnm6BiPT52p6t5Ta0MR64Ff4Dwu0Blua+muEOqN7Xmdyan+rb26YusbcIhtnOq/3OJ2LZ0+o dZ8i3KxdUznpF1HtglXFfvN9Xjv9TfwtaCTt1OFYTNIQ3seQC3Sp2qbyIIR4ekuw/SkjoJ8gHDGPG 46RyF5ApFLdZ37WsTK0363t3jXHuCwtNzuqAeO2iDVoWj0teXIMQ0JDlBmojbe33TLCnjv1E1zxXj KGOvpQGczIJ6raSLgHRmrL+kCTU0DVic97HZw5RTACU3SifA7t/mwoXN1OixT4I0mvoQ/gphmvKXB SdsmtbRPuAXBEA0fcdr49A==; Date: Sat, 05 Jul 2025 09:32:11 +0300 Message-Id: <86ikk7xi50.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-Reply-To: (message from Stefan Monnier on Fri, 04 Jul 2025 14:06:13 -0400) Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop References: <24453.1751060166@bach.localdomain> <34220.1751153312@bach.localdomain> <86a55r5dv2.fsf@gnu.org> <19433.1751218460@bach.localdomain> <86o6u54emc.fsf@gnu.org> <86wm8t2gy5.fsf@gnu.org> <86ikkc2kx8.fsf@gnu.org> <86seje2597.fsf@gnu.org> <867c0p24gf.fsf@gnu.org> <86h5ztz2jg.fsf@gnu.org> <867c0ozbjv.fsf@gnu.org> <86ms9kxbzd.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Monnier > Cc: 78916@debbugs.gnu.org, kupfer@rawbw.com > 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' > > But if the key that causes 'quit' can be re-read and re-executed after exiting the replace, shouldn't we do that? Because AFAIU the above will not make C-] behave 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? From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 05 02:36:40 2025 Received: (at 78916) by debbugs.gnu.org; 5 Jul 2025 06:36:40 +0000 Received: from localhost ([127.0.0.1]:38874 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uXwVq-0001aX-EW for submit@debbugs.gnu.org; Sat, 05 Jul 2025 02:36:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41024) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uXwVo-0001ZL-BZ for 78916@debbugs.gnu.org; Sat, 05 Jul 2025 02:36:37 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uXwVj-0004x5-2E; Sat, 05 Jul 2025 02:36:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=zKzORAPCsCLXL6ImLF7APjFSf64lInHjxNPuBhuoWoE=; b=Ic1f3m8Ouob4lsyYJ+aw SSCRIKT4ljUwhHvwOoDsjkL06z5Nq15gkr5Nlvv/n6rDHHn6m+n1u6jdWGNzDxyIXs4KU62sJP6D8 Xl2C3IqD218kSR1Rsjea47B8COpqvNzCUEzB2LlcLA1jb94vau4/5639vBAnaUXoCARpA+C/xj32c D/M2CXBbjgkpP43IISiF+nq6duJvT9yq+NJRf6EKFx2Uf8ScPDVO2JC8T9O1w37Xb6GgMKRVvo0mH aQ7HDXXVYpagQle7EWZtKkyo9RpfNhaTRcHRUvI+dEbQSy+pzLhZX75Yd/fXwxaIcsbusEH+jK1uz FQ/bsdtCP8FkIA==; Date: Sat, 05 Jul 2025 09:36:22 +0300 Message-Id: <86h5zrxhy1.fsf@gnu.org> From: Eli Zaretskii To: Pip Cet In-Reply-To: <87a55jx1my.fsf@protonmail.com> (message from Pip Cet on Fri, 04 Jul 2025 18:16:29 +0000) Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop References: <24453.1751060166@bach.localdomain> <86ikkc2kx8.fsf@gnu.org> <86seje2597.fsf@gnu.org> <867c0p24gf.fsf@gnu.org> <87tt3tw4p4.fsf@protonmail.com> <87a55jx1my.fsf@protonmail.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, monnier@iro.umontreal.ca, kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Fri, 04 Jul 2025 18:16:29 +0000 > From: Pip Cet > Cc: Eli Zaretskii , 78916@debbugs.gnu.org, kupfer@rawbw.com > > "Stefan Monnier" writes: > > >> (However, there are other good reason not to apply this patch, and > >> simply fix read-key to optionally allow quitting instead. > > > > That wouldn't fix the `C-]` case. > > I'm not sure it's that important. It's not documented in > query-replace-help, and I'm not really sure whether it should behave > like C-g or ESC (or should ESC be fixed, too?) or any unbound key (like > "r"). C-] is documented in the manual as part of this catch-all: Aside from this, any other character exits the ‘query-replace’, and is then reread as part of a key sequence. Thus, if you type ‘C-k’, it exits the ‘query-replace’ and then kills to end of line. In particular, ‘C-g’ simply exits the ‘query-replace’. > The C-g case is documented (because C-g is documented for all of Emacs, > and exceptions are noted) C-g is documented specially in query-replace, see above. From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 05 04:17:39 2025 Received: (at 78916) by debbugs.gnu.org; 5 Jul 2025 08:17:39 +0000 Received: from localhost ([127.0.0.1]:39577 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uXy5Z-0000KI-Ey for submit@debbugs.gnu.org; Sat, 05 Jul 2025 04:17:39 -0400 Received: from mail-4316.protonmail.ch ([185.70.43.16]:32439) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uXy5W-0000JA-VC for 78916@debbugs.gnu.org; Sat, 05 Jul 2025 04:17:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1751703447; x=1751962647; bh=cprpQMs15XNptrU33vPmNSO6UO3Mqm4GzWKsNqGsmqQ=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=JmEEJuaP7uKA3CVEPcxU+fP3NXNM85zUVhtv6s8gBZAeNYrh8whw//RKbfA3rtnWD VKAI9Hzb+9ijXN2IYm5staQawVwpHwDbEfFDxKOk8EgW3vOEcvC485VYN28ubxSP6K ashzQO9Ami5o+LDUidxqhxxNy6jfyELhMlM8f7IhvY8K6OK8t0nPgAeTxz4ILvwbm0 pjPYOMhPzuV5nFqupdl54x3o8J5NPEtRh5qgtCwMRDSD/qpXrlkDFHpPb/yky+Gi9Y eCnqc/LNDWL1nZETVjtMhF3Y3mkOuhJIcUiggHmANJdLqM1gqmpGXgnL8BsCp9/xU/ GRrRxh0K1qlQw== Date: Sat, 05 Jul 2025 08:17:23 +0000 To: Eli Zaretskii From: Pip Cet Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop Message-ID: <87ikk7uk4x.fsf@protonmail.com> In-Reply-To: <86h5zrxhy1.fsf@gnu.org> References: <24453.1751060166@bach.localdomain> <86seje2597.fsf@gnu.org> <867c0p24gf.fsf@gnu.org> <87tt3tw4p4.fsf@protonmail.com> <87a55jx1my.fsf@protonmail.com> <86h5zrxhy1.fsf@gnu.org> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: 1b3a007e3fff42cda6f79ba06bfac761bed8295d MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, monnier@iro.umontreal.ca, kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) "Eli Zaretskii" writes: >> Date: Fri, 04 Jul 2025 18:16:29 +0000 >> From: Pip Cet >> Cc: Eli Zaretskii , 78916@debbugs.gnu.org, kupfer@rawbw.co= m >> >> "Stefan Monnier" writes: >> >> >> (However, there are other good reason not to apply this patch, and >> >> simply fix read-key to optionally allow quitting instead. >> > >> > That wouldn't fix the `C-]` case. >> >> I'm not sure it's that important. It's not documented in >> query-replace-help, and I'm not really sure whether it should behave >> like C-g or ESC (or should ESC be fixed, too?) or any unbound key (like >> "r"). > C-] is documented in the manual as part of this catch-all: > Aside from this, any other character exits the =E2=80=98query-replac= e=E2=80=99, and > is then reread as part of a key sequence. Thus, if you type =E2=80= =98C-k=E2=80=99, it > exits the =E2=80=98query-replace=E2=80=99 and then kills to end of line= . In particular, > =E2=80=98C-g=E2=80=99 simply exits the =E2=80=98query-replace=E2=80= =99. That is no longer accurate if we apply Stefan's fix, which will prevent C-] from being reread over and over again in Mike's loop. The last sentence contradicts the rest of it, too: if C-g is reread, it doesn't simply exit the 'query-replace'. So the documentation in the manual is contradictory and inaccurate, and the documentation in query-replace-help is incomplete. Pip From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 05 04:23:25 2025 Received: (at 78916) by debbugs.gnu.org; 5 Jul 2025 08:23:25 +0000 Received: from localhost ([127.0.0.1]:39675 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uXyBA-000187-GH for submit@debbugs.gnu.org; Sat, 05 Jul 2025 04:23:25 -0400 Received: from mail-4316.protonmail.ch ([185.70.43.16]:14535) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uXyB7-000173-HI for 78916@debbugs.gnu.org; Sat, 05 Jul 2025 04:23:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1751703795; x=1751962995; bh=Jyd/17T9Zm36UJdDpxQ3DDiwlFi5Z5IzOViLttdpIPI=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=o+YvgrYY8fcxdpblUcLIwAGFyiksmEs83lAywG8Q0O4MtcF2q0vs4XmW+ALr3Nmho QkfNo7wiYsqm+zkdpgVEz6OSMB37KRF3geGmj54I0Voz23OEP1M6c96taHk7iZC1Fx WKpTFSRGp2wUx5DS4ewoGYFd9gOHi96H5qQSqKQEvncNpHW03LKRdS6/Ku1dVQimoa cTolTheBMkTeQpEShHZgHqJKkvzXgH4pBCgb/IcCXh5dJ0X3l7cNPSXDQ9t3yTsi+Q aSUzvJ2dhez5EGumdgda4gHjjTFn1ygul6n8+tBBbpEJv4ao6wizRkEHGF3c2aLQ5N U7l0i1hPHa/ZA== Date: Sat, 05 Jul 2025 08:23:13 +0000 To: Stefan Monnier From: Pip Cet Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop Message-ID: <87frfbujv6.fsf@protonmail.com> In-Reply-To: References: <24453.1751060166@bach.localdomain> <86ikkc2kx8.fsf@gnu.org> <86seje2597.fsf@gnu.org> <867c0p24gf.fsf@gnu.org> <87tt3tw4p4.fsf@protonmail.com> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: c002e5bd07d47295514c6f1f07ed8ae63519de31 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, Eli Zaretskii , kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) "Stefan Monnier" 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. > IOW, I don't think your proposal and my patch are exclusive. Oh. That makes sense, and installing the one-liner (or the first patch) would fix things for now, and if we change the read-key call later, nothing should break in terrible ways. > I suspect it would be "more right" to call `keyboard-quit` rather than > `(signal 'quit nil), but that's a bikeshed color I'm not wedded to). I think usually, it's unpredictable for the user whether a C-g interrupts a timer or other Lisp code, which causes us to signal quit, or gets treated as input. So making the two behave differently will result in surprising behavior. Pip From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 05 05:48:11 2025 Received: (at 78916) by debbugs.gnu.org; 5 Jul 2025 09:48:11 +0000 Received: from localhost ([127.0.0.1]:40743 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uXzVC-0005Y9-DX for submit@debbugs.gnu.org; Sat, 05 Jul 2025 05:48:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39146) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uXzV9-0005X8-Q7 for 78916@debbugs.gnu.org; Sat, 05 Jul 2025 05:48:08 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uXzV3-0007wQ-HM; Sat, 05 Jul 2025 05:48:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=0zL2xVdO/2XIY0PyGL9T6PUjNj9KQgx7jKil57RFC9c=; b=od0qLMXA7QtXw5HQqgBA CCR+tRAvuY9t9wd1A9q6bmS1tVRlZB6xFiuj2m/6x4oZEVGCc4uTESLMV1OAiO3WYOy/T/ZE/ShdD SzL3YHOhfFCw3IoZK0+SvQQI6yUWnp4keM4Ge4Axj1ktVOiZTvmjOHtZAOYp824KtiLgd+uJbfmgL 1CeQMmU2eqyYkguZwDq6Oh8VQB/B2nSY3XbzdZ//ddLBjPYUJFgeJaG8RJVRAjgYw3/JNRYOKUQ8N yVoZ1SFlyhtGxGhirGT+TRPXInGLN/Snhd3QW1Y1XJQ453uVXhI3TODaWcJ+9K9tRxPl9IoFWcmUK ghsQKVKGKlAwUA==; Date: Sat, 05 Jul 2025 12:47:57 +0300 Message-Id: <8634bbvuia.fsf@gnu.org> From: Eli Zaretskii To: Pip Cet In-Reply-To: <87ikk7uk4x.fsf@protonmail.com> (message from Pip Cet on Sat, 05 Jul 2025 08:17:23 +0000) Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop References: <24453.1751060166@bach.localdomain> <86seje2597.fsf@gnu.org> <867c0p24gf.fsf@gnu.org> <87tt3tw4p4.fsf@protonmail.com> <87a55jx1my.fsf@protonmail.com> <86h5zrxhy1.fsf@gnu.org> <87ikk7uk4x.fsf@protonmail.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, monnier@iro.umontreal.ca, kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Sat, 05 Jul 2025 08:17:23 +0000 > From: Pip Cet > Cc: monnier@iro.umontreal.ca, 78916@debbugs.gnu.org, kupfer@rawbw.com > > "Eli Zaretskii" writes: > > >> Date: Fri, 04 Jul 2025 18:16:29 +0000 > >> From: Pip Cet > >> Cc: Eli Zaretskii , 78916@debbugs.gnu.org, kupfer@rawbw.com > >> > >> "Stefan Monnier" writes: > >> > >> >> (However, there are other good reason not to apply this patch, and > >> >> simply fix read-key to optionally allow quitting instead. > >> > > >> > That wouldn't fix the `C-]` case. > >> > >> I'm not sure it's that important. It's not documented in > >> query-replace-help, and I'm not really sure whether it should behave > >> like C-g or ESC (or should ESC be fixed, too?) or any unbound key (like > >> "r"). > > > C-] is documented in the manual as part of this catch-all: > > > Aside from this, any other character exits the ‘query-replace’, and > > is then reread as part of a key sequence. Thus, if you type ‘C-k’, it > > exits the ‘query-replace’ and then kills to end of line. In particular, > > ‘C-g’ simply exits the ‘query-replace’. > > That is no longer accurate if we apply Stefan's fix, which will prevent > C-] from being reread over and over again in Mike's loop. Which is why I suggested to augment that. > The last sentence contradicts the rest of it, too: if C-g is reread, > it doesn't simply exit the 'query-replace'. When we know what change we will install and how it will affect C-g, we can make that part more accurate. > So the documentation in the manual is contradictory and inaccurate, and > the documentation in query-replace-help is incomplete. Are you talking about the documentation on the release branch (and the behavior on that branch), or are you talking about the master branch? If the latter, then this discussion is precisely how to make the code behave like the documentation used to say. From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 05 10:38:01 2025 Received: (at 78916) by debbugs.gnu.org; 5 Jul 2025 14:38:01 +0000 Received: from localhost ([127.0.0.1]:45685 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uY41h-0001jM-65 for submit@debbugs.gnu.org; Sat, 05 Jul 2025 10:38:01 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:57868) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uY41e-0001iX-5e for 78916@debbugs.gnu.org; Sat, 05 Jul 2025 10:37:59 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 5610110013E; Sat, 5 Jul 2025 10:37:52 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1751726271; bh=5bljA1hUJNcOh+bmYJ8H48ognARxbCaMZTLiOLr/+Xo=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=fKcRAyDPyaHqJsjGw0Q7hBbrfEqw/hpGFRmefUvDix3IklKnEnCbu4vHjdHl2cSO4 GIzu21GbHsTnVxMSdli+qXAKdNSq602BYlfwuA/CEmDI3qpnir4BcF5BOgAFJaghxk qwmKDfQuKdP/CC3D01nrdsdBO0Zjx10Za4uMZbrJ3FGLmSGKsir4FQsmGmA/7g7R1Y nPyBB9m7LNLoKzul2jo192cXFHYwaFqT5aPWfYm6HJ24k0lSRKJsuutx/sFvEhwgJM 75v9xT8TWOcN8/qHf18Io27fl9l9zqjfGRF1dmM2y7sIEHkcAbXvZij9y7M3J3Qqxs O4rPlKrCCUfTQ== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 2A8B810002E; Sat, 5 Jul 2025 10:37:51 -0400 (EDT) Received: from alfajor (unknown [104.247.225.139]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id ED8CD1200DD; Sat, 5 Jul 2025 10:37:50 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop In-Reply-To: <86ikk7xi50.fsf@gnu.org> Message-ID: References: <24453.1751060166@bach.localdomain> <86a55r5dv2.fsf@gnu.org> <19433.1751218460@bach.localdomain> <86o6u54emc.fsf@gnu.org> <86wm8t2gy5.fsf@gnu.org> <86ikkc2kx8.fsf@gnu.org> <86seje2597.fsf@gnu.org> <867c0p24gf.fsf@gnu.org> <86h5ztz2jg.fsf@gnu.org> <867c0ozbjv.fsf@gnu.org> <86ms9kxbzd.fsf@gnu.org> <86ikk7xi50.fsf@gnu.org> Date: Sat, 05 Jul 2025 10:37:50 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.295 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.1 (---) >> 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 From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 05 10:43:10 2025 Received: (at 78916) by debbugs.gnu.org; 5 Jul 2025 14:43:10 +0000 Received: from localhost ([127.0.0.1]:45765 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uY46f-0002WH-Ok for submit@debbugs.gnu.org; Sat, 05 Jul 2025 10:43:10 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:23543) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uY46c-0002V3-RF for 78916@debbugs.gnu.org; Sat, 05 Jul 2025 10:43:07 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 5F6E2808B5; Sat, 5 Jul 2025 10:43:01 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1751726576; bh=GmIK237PRKzi8IyliwbmEXJdzPS6y6Ln4EOQ2uFIfE8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=ogHTqMsTDebiBd5ahOgF5FLpfa0e39iZfF0fxm0APrZqsUP7YXHm49iOU/fHfizBc nWrVGM5J9eajyOivCQsegw+Gn8YhiwQD9gSAQ//IXkQ2DvwHYhYodViZ/G1k4xTazy CVpeCHtpGAj+PqQRo+swb7nK/y1NSQnETWEXP5ObLqzOyojpwlMzfMfhcJEJTUuUlk x9QoTZTYhLh9Qs/VPX+rJSRHxx4yX3P7OXowBAVPnI9Z7U2G5NKdmdhKDRLxcGtdmm cDHQgCBI31RM3pGEzlqC4vsB+RYPIQUcSuB7MXjGjuzAVg5uEYJUYcSQG8B7HqaNfd MeE5jsb8/eFPw== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 47F4980823; Sat, 5 Jul 2025 10:42:56 -0400 (EDT) Received: from alfajor (unknown [104.247.225.139]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 0C0B0120372; Sat, 5 Jul 2025 10:42:56 -0400 (EDT) From: Stefan Monnier To: Pip Cet Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop In-Reply-To: <87frfbujv6.fsf@protonmail.com> Message-ID: References: <24453.1751060166@bach.localdomain> <86ikkc2kx8.fsf@gnu.org> <86seje2597.fsf@gnu.org> <867c0p24gf.fsf@gnu.org> <87tt3tw4p4.fsf@protonmail.com> <87frfbujv6.fsf@protonmail.com> Date: Sat, 05 Jul 2025 10:42:55 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.299 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, Eli Zaretskii , kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.1 (---) >>> (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: =E2=80=98exit-prefix=E2=80=99 Like =E2=80=98exit=E2=80=99, but add the key that was pressed to =E2=80=98unread-command-events=E2=80=99 (*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. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 05 18:33:25 2025 Received: (at 78916) by debbugs.gnu.org; 5 Jul 2025 22:33:25 +0000 Received: from localhost ([127.0.0.1]:48117 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uYBRk-0004eE-AC for submit@debbugs.gnu.org; Sat, 05 Jul 2025 18:33:24 -0400 Received: from shell1.rawbw.com ([198.144.192.42]:13361 ident=root) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uYBRh-0004dc-Gc for 78916@debbugs.gnu.org; Sat, 05 Jul 2025 18:33:22 -0400 Received: from bach.localdomain (135-180-175-182.dsl.dynamic.sonic.net [135.180.175.182] (may be forged)) (authenticated bits=0) by shell1.rawbw.com (8.15.1/8.15.1) with ESMTPSA id 565MXErE028368 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 5 Jul 2025 15:33:19 -0700 (PDT) (envelope-from kupfer@rawbw.com) X-Authentication-Warning: shell1.rawbw.com: Host 135-180-175-182.dsl.dynamic.sonic.net [135.180.175.182] (may be forged) claimed to be bach.localdomain From: Mike Kupfer To: Stefan Monnier Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop In-reply-to: References: <24453.1751060166@bach.localdomain> <86ikkc2kx8.fsf@gnu.org> <86seje2597.fsf@gnu.org> <867c0p24gf.fsf@gnu.org> <87tt3tw4p4.fsf@protonmail.com> <87frfbujv6.fsf@protonmail.com> Comments: In-reply-to Stefan Monnier message dated "Sat, 05 Jul 2025 10:42:55 -0400." X-Mailer: MH-E 8.6+git; nmh 1.8-RC2; Emacs 31.0.50 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Jul 2025 15:33:14 -0700 Message-ID: <17642.1751754794@bach.localdomain> X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, Pip Cet , Eli Zaretskii X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) Stefan Monnier wrote: > ESC is bound to `exit-prefix` which is documented as: >=20 > =E2=80=98exit-prefix=E2=80=99 > Like =E2=80=98exit=E2=80=99, but add the key that was pressed to > =E2=80=98unread-command-events=E2=80=99 (*note Event Input Misc:= :). >=20 > 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 would assume that ESC gets added to the unread events so that the user can type ESC-mumble intead of M-mumble. (Not that I actually know anything about all the event processing details y'all have been talking about. :-)) mike From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 06 07:13:04 2025 Received: (at 78916) by debbugs.gnu.org; 6 Jul 2025 11:13:04 +0000 Received: from localhost ([127.0.0.1]:53013 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uYNIs-0008CS-Ol for submit@debbugs.gnu.org; Sun, 06 Jul 2025 07:13:04 -0400 Received: from mail-10630.protonmail.ch ([79.135.106.30]:20521) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uYNIq-0008Bc-7h for 78916@debbugs.gnu.org; Sun, 06 Jul 2025 07:13:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1751800373; x=1752059573; bh=a0hbYJyGzko291Bdf5bBLzOFw+6g+WUFBpPtK2RMxyU=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=Kubejf9dFCvNjYdpOXEFXQAyCV9M9AzB3aGjLfuk01kP5HoG+7tfqxIR5arylsdPQ CpPOEUFLCYSe0ilvUwvMgxURUuitTRW/cdwkLCtgmhPvSDvlo6vAY+gLWozNNz+lo4 x7cm9HOqHbyMOOSLxglchwKKe6rx62NP6Fci+IGwE5hIpLpJZ5EEjBNwY/ykJB7ngv nFH59ze9uCZ3F4wvM+/A29OQMM0ni+ul6gVr5Fc0ECmjx6RPLJfo6550tBa0zQ8rEs ArhAZTs4IDO9JEN4OWnS9vtZygLkCx9VHEo6aUhcsTmhTqs0OO8hVl0e2FR9zyjQ0W ZvzMDmFYjjLvw== Date: Sun, 06 Jul 2025 11:12:49 +0000 To: Stefan Monnier From: Pip Cet Subject: Re: bug#78916: 31.0.50; C-g fails to exit loop Message-ID: <87bjpxtvwy.fsf@protonmail.com> In-Reply-To: References: <24453.1751060166@bach.localdomain> <86seje2597.fsf@gnu.org> <867c0p24gf.fsf@gnu.org> <87tt3tw4p4.fsf@protonmail.com> <87frfbujv6.fsf@protonmail.com> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: a2a41ef5c2b7d74da9b3cfc5efd21a9c38730a0e MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 78916 Cc: 78916@debbugs.gnu.org, Eli Zaretskii , kupfer@rawbw.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) "Stefan Monnier" 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 broke= n. >> >> 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: > > =E2=80=98exit-prefix=E2=80=99 > Like =E2=80=98exit=E2=80=99, but add the key that was pressed to > =E2=80=98unread-command-events=E2=80=99 (*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