From unknown Thu Aug 14 22:23:30 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69342: query-replace: ignore events not binded in query-replace-map Resent-From: Gabriele Nicolardi Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 23 Feb 2024 22:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 69342 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 69342@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.170872663926258 (code B ref -1); Fri, 23 Feb 2024 22:18:01 +0000 Received: (at submit) by debbugs.gnu.org; 23 Feb 2024 22:17:19 +0000 Received: from localhost ([127.0.0.1]:48175 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rddr4-0006pR-Lq for submit@debbugs.gnu.org; Fri, 23 Feb 2024 17:17:19 -0500 Received: from lists.gnu.org ([209.51.188.17]:57330) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rddr1-0006p6-28 for submit@debbugs.gnu.org; Fri, 23 Feb 2024 17:17:18 -0500 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 1rddqT-000843-VS for bug-gnu-emacs@gnu.org; Fri, 23 Feb 2024 17:16:47 -0500 Received: from smtp02.cbsolt.net ([185.97.217.41]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rddqQ-0004CC-AU for bug-gnu-emacs@gnu.org; Fri, 23 Feb 2024 17:16:41 -0500 Received: from [10.0.2.15] (host-79-51-252-152.retail.telecomitalia.it [79.51.252.152]) by smtp02.cbsolt.net (Postfix) with ESMTPSA id 4ThPVV2vRPz3wcN for ; Fri, 23 Feb 2024 23:16:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cbsolt.net; s=201504-di4k2w; t=1708726579; bh=pV2dsfp+oJeVT7r8oWcf2imFp2PWi0gStc3VBXGPHBw=; h=Date:From:To:Subject:From; b=kVZEg+3FHyudu9lHLDU9cs9eM0ea4YoZM5EVk/w/gthMvdhOIMdCETFWiQ9bzECG0 kGKdtpWE4c0eZBxFPYy8KgOO9jckok/Tbe+c7253gBZ1NlCY8PtXJe0L7/SDNgtEpO G6MoOg6YVIgzO4INywdpBgIsQd7LX1w1eM5xzQYI= Content-Type: multipart/alternative; boundary="------------obsjsKuwz2I3N7HM3OqA0OjR" Message-ID: Date: Fri, 23 Feb 2024 23:16:15 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US From: Gabriele Nicolardi Received-SPF: pass client-ip=185.97.217.41; envelope-from=gabriele@medialab.sissa.it; helo=smtp02.cbsolt.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) 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: -2.3 (--) This is a multi-part message in MIME format. --------------obsjsKuwz2I3N7HM3OqA0OjR Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi, I have this function: |(defun my-replacements () (interactive) (query-replace "foo" "bar" nil (point-min) (point-max)) (query-replace "baz" "quz" nil (point-min) (point-max)) (query-replace "fred" "thud" nil (point-min) (point-max))) | If I run it and accidentally type, for example, ‘k’ during one of the replacements, the function is interrupted, skipping all the remaining replacements. I know that |query-replace| (and |query-replace-regexp|) accepts only events binded in the |query-replace-map| and from the manual I know that: 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. I would like to circumvent this behavior by ensuring that events not defined in the |query-replace-map| are simply ignored. Is there a way to achieve this? I thought it could be done with a macro, e.g.: |(with-ignore-qr-unbinded-events MY CODE HERE) | but I have no idea how to do it. As a feature request (this would be my first choice), I would like to add an optional argument to the function(s) so that I can have control over this behavior. Does it make sense to you? Best regards, Gabriele Nicolardi ​ --------------obsjsKuwz2I3N7HM3OqA0OjR Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Hi,

I have this function:

(defun my-replacements ()
  (interactive)
  (query-replace "foo" "bar" nil (point-min) (point-max))
  (query-replace "baz" "quz" nil (point-min) (point-max))
  (query-replace "fred" "thud" nil (point-min) (point-max)))

If I run it and accidentally type, for example, ‘k’ during one of the replacements, the function is interrupted, skipping all the remaining replacements.

I know that query-replace (and query-replace-regexp) accepts only events binded in the query-replace-map and from the manual I know that:

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.

I would like to circumvent this behavior by ensuring that events not defined in the query-replace-map are simply ignored. Is there a way to achieve this?

I thought it could be done with a macro, e.g.:

(with-ignore-qr-unbinded-events
  MY CODE HERE)

but I have no idea how to do it.

As a feature request (this would be my first choice), I would like to add an optional argument to the function(s) so that I can have control over this behavior. Does it make sense to you?

Best regards,

Gabriele Nicolardi

--------------obsjsKuwz2I3N7HM3OqA0OjR-- From unknown Thu Aug 14 22:23:30 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69342: Acknowledgement (query-replace: ignore events not binded in query-replace-map) Resent-From: Gabriele Nicolardi Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 23 Feb 2024 22:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69342 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 69342@debbugs.gnu.org Received: via spool by 69342-submit@debbugs.gnu.org id=B69342.170872764329405 (code B ref 69342); Fri, 23 Feb 2024 22:35:02 +0000 Received: (at 69342) by debbugs.gnu.org; 23 Feb 2024 22:34:03 +0000 Received: from localhost ([127.0.0.1]:49424 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rde7H-0007eB-6l for submit@debbugs.gnu.org; Fri, 23 Feb 2024 17:34:03 -0500 Received: from smtp04.cbsolt.net ([185.97.217.43]:46290) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rde7E-0007dN-Lx for 69342@debbugs.gnu.org; Fri, 23 Feb 2024 17:34:01 -0500 Received: from [192.168.1.206] (host-79-51-252-152.retail.telecomitalia.it [79.51.252.152]) by smtp04.cbsolt.net (Postfix) with ESMTPSA id 4ThPtK6KkCz3wkX for <69342@debbugs.gnu.org>; Fri, 23 Feb 2024 23:33:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cbsolt.net; s=201504-di4k2w; t=1708727610; bh=fWbwdNql5p0pDzK86wC49SGXxzooW6y1lxh6ydXvn2s=; h=Date:Subject:To:References:From:In-Reply-To:From; b=DXsLYlzcLQUED0I4v85/6AOIkzEx4lcHnh58AjffjNsJuWy0jr5Dwdw+sa4doiFk6 PzmcK6wCuXLym5XnW78SxUL5rboPp+hIrlsmWnyxSiy6rScFd/jNSPXvcAzPa4uZ4C IMsjkdv2+/hbLpc+ePKtkwH7XZs/VFj82zBobv40= Message-ID: <6ef3bf16-b98a-4c07-b841-a4e0382b7523@medialab.sissa.it> Date: Fri, 23 Feb 2024 23:33:29 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird References: From: Gabriele Nicolardi Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) 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.7 (-) I just realized that a better idea would be using a variable to control this feature i request. Best regards Gabriele Nicolardi Il 23/02/24 23:18, GNU bug Tracking System ha scritto: > Thank you for filing a new bug report with debbugs.gnu.org. > > This is an automatically generated reply to let you know your message > has been received. > > Your message is being forwarded to the package maintainers and other > interested parties for their attention; they will reply in due course. > > Your message has been sent to the package maintainer(s): > bug-gnu-emacs@gnu.org > > If you wish to submit further information on this problem, please > send it to 69342@debbugs.gnu.org. > > Please do not send mail to help-debbugs@gnu.org unless you wish > to report a problem with the Bug-tracking system. > From unknown Thu Aug 14 22:23:30 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69342: query-replace: ignore events not binded in query-replace-map Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 25 Feb 2024 07:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69342 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Gabriele Nicolardi Cc: 69342@debbugs.gnu.org Received: via spool by 69342-submit@debbugs.gnu.org id=B69342.170884652624116 (code B ref 69342); Sun, 25 Feb 2024 07:36:02 +0000 Received: (at 69342) by debbugs.gnu.org; 25 Feb 2024 07:35:26 +0000 Received: from localhost ([127.0.0.1]:50075 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1re92j-0006Gq-M4 for submit@debbugs.gnu.org; Sun, 25 Feb 2024 02:35:26 -0500 Received: from mslow1.mail.gandi.net ([217.70.178.240]:34865) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1re92h-0006GR-Ds for 69342@debbugs.gnu.org; Sun, 25 Feb 2024 02:35:24 -0500 Received: from relay9-d.mail.gandi.net (unknown [217.70.183.199]) by mslow1.mail.gandi.net (Postfix) with ESMTP id 30111C10C9 for <69342@debbugs.gnu.org>; Sun, 25 Feb 2024 07:34:48 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 27F0FFF803; Sun, 25 Feb 2024 07:34:26 +0000 (UTC) From: Juri Linkov In-Reply-To: (Gabriele Nicolardi's message of "Fri, 23 Feb 2024 23:16:15 +0100") Organization: LINKOV.NET References: Date: Sun, 25 Feb 2024 09:28:52 +0200 Message-ID: <864jdx11qx.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-GND-Sasl: juri@linkov.net X-Spam-Score: 0.6 (/) 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.4 (/) > (defun my-replacements () > (interactive) > (query-replace "foo" "bar" nil (point-min) (point-max)) > (query-replace "baz" "quz" nil (point-min) (point-max)) > (query-replace "fred" "thud" nil (point-min) (point-max))) > [...] > As a feature request (this would be my first choice), I would like to add > an optional argument to the function(s) so that I can have control over > this behavior. Does it make sense to you? Thanks for the feature request. Or maybe this is a bug report, since currently query-replace doesn't allow you using such a simple configuration to ignore all unbound keys: (define-key query-replace-map [t] 'ignore) To give you the freedom of using such configuration we need to set the optional argument ACCEPT-DEFAULTS of 'lookup-key' to t with this patch: diff --git a/lisp/replace.el b/lisp/replace.el index f8f5c415273..750ca9c1ee3 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -2924,7 +2924,7 @@ perform-replace ;; If last typed key in previous call of multi-buffer perform-replace ;; was `automatic-all', don't ask more questions in next files - (when (eq (lookup-key map (vector last-input-event)) 'automatic-all) + (when (eq (lookup-key map (vector last-input-event) t) 'automatic-all) (setq query-flag nil multi-buffer t)) (cond @@ -3111,7 +3111,7 @@ perform-replace ;; read-event that clobbers the match data. (set-match-data real-match-data) (setq key (vector key)) - (setq def (lookup-key map key)) + (setq def (lookup-key map key t)) ;; Restore the match data while we process the command. (cond ((eq def 'help) (let ((display-buffer-overriding-action From unknown Thu Aug 14 22:23:30 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69342: query-replace: ignore events not binded in query-replace-map Resent-From: Gabriele Nicolardi Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 25 Feb 2024 08:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69342 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Juri Linkov Cc: 69342@debbugs.gnu.org Received: via spool by 69342-submit@debbugs.gnu.org id=B69342.170885132717074 (code B ref 69342); Sun, 25 Feb 2024 08:56:02 +0000 Received: (at 69342) by debbugs.gnu.org; 25 Feb 2024 08:55:27 +0000 Received: from localhost ([127.0.0.1]:55580 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1reAI9-0004RH-Oj for submit@debbugs.gnu.org; Sun, 25 Feb 2024 03:55:27 -0500 Received: from smtp06.cbsolt.net ([185.97.217.45]:46798) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1re9jt-0002iQ-S0 for 69342@debbugs.gnu.org; Sun, 25 Feb 2024 03:20:03 -0500 Received: from [10.0.2.15] (host-79-16-242-199.retail.telecomitalia.it [79.16.242.199]) by smtp06.cbsolt.net (Postfix) with ESMTPSA id 4TjGr21102z3whm; Sun, 25 Feb 2024 09:19:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cbsolt.net; s=201504-di4k2w; t=1708849171; bh=sEX2vgLVqaPi3jjLHk1862qBIRNjkld5zB52KgSdkTw=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=RfBh3tMF31nNQ7VjgrKsxDf2u/68MpG0weYWHD7lHPWMvHdtIpHIyBICIjRj4u1vI xSOSp1WVc6sD9gBb2JZAr/abANB47NofxJe5tf6UmQEn3KACb5ozRqqjE4zqtDdWcw dlH6q2MmleKC9tygrFCjJIc7dRxYh/kxIiwmGlmo= Content-Type: multipart/alternative; boundary="------------RXCD10SIDoJ95JzzYr5Ozq2f" Message-ID: <93c69078-769f-460f-bfb6-4e942af7e102@medialab.sissa.it> Date: Sun, 25 Feb 2024 09:19:29 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US References: <864jdx11qx.fsf@mail.linkov.net> From: Gabriele Nicolardi In-Reply-To: <864jdx11qx.fsf@mail.linkov.net> X-Spam-Score: -0.7 (/) 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.7 (-) This is a multi-part message in MIME format. --------------RXCD10SIDoJ95JzzYr5Ozq2f Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Thanks! I suppose this feature will be available starting from Emacs version 30, right? In the meantime, I was suggested this code on StackExchange (https://emacs.stackexchange.com/a/80494/15606): |(defvar my-do-nothing-map (let ((map (make-keymap))) (set-char-table-range (nth 1 map) t 'ignore) map)) (set-keymap-parent query-replace-map my-do-nothing-map) and it seems to work with the actual version of query-replace. | Il 25/02/24 08:28, Juri Linkov ha scritto: >> (defun my-replacements () >> (interactive) >> (query-replace "foo" "bar" nil (point-min) (point-max)) >> (query-replace "baz" "quz" nil (point-min) (point-max)) >> (query-replace "fred" "thud" nil (point-min) (point-max))) >> [...] >> As a feature request (this would be my first choice), I would like to add >> an optional argument to the function(s) so that I can have control over >> this behavior. Does it make sense to you? > Thanks for the feature request. Or maybe this is a bug report, > since currently query-replace doesn't allow you using such a simple > configuration to ignore all unbound keys: > > (define-key query-replace-map [t] 'ignore) > > To give you the freedom of using such configuration we need > to set the optional argument ACCEPT-DEFAULTS of 'lookup-key' to t > with this patch: > > diff --git a/lisp/replace.el b/lisp/replace.el > index f8f5c415273..750ca9c1ee3 100644 > --- a/lisp/replace.el > +++ b/lisp/replace.el > @@ -2924,7 +2924,7 @@ perform-replace > > ;; If last typed key in previous call of multi-buffer perform-replace > ;; was `automatic-all', don't ask more questions in next files > - (when (eq (lookup-key map (vector last-input-event)) 'automatic-all) > + (when (eq (lookup-key map (vector last-input-event) t) 'automatic-all) > (setq query-flag nil multi-buffer t)) > > (cond > @@ -3111,7 +3111,7 @@ perform-replace > ;; read-event that clobbers the match data. > (set-match-data real-match-data) > (setq key (vector key)) > - (setq def (lookup-key map key)) > + (setq def (lookup-key map key t)) > ;; Restore the match data while we process the command. > (cond ((eq def 'help) > (let ((display-buffer-overriding-action --------------RXCD10SIDoJ95JzzYr5Ozq2f Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Thanks!

I suppose this feature will be available starting from Emacs version 30, right?

In the meantime, I was suggested this code on StackExchange (https://emacs.stackexchange.com/a/80494/15606):

(defvar my-do-nothing-map
  (let ((map (make-keymap)))
    (set-char-table-range (nth 1 map) t 'ignore)
    map))

(set-keymap-parent query-replace-map my-do-nothing-map)

and it seems to work with the actual version of query-replace.


Il 25/02/24 08:28, Juri Linkov ha scritto:
(defun my-replacements ()
  (interactive)
  (query-replace "foo" "bar" nil (point-min) (point-max))
  (query-replace "baz" "quz" nil (point-min) (point-max))
  (query-replace "fred" "thud" nil (point-min) (point-max)))
[...]
As a feature request (this would be my first choice), I would like to add
an optional argument to the function(s) so that I can have control over
this behavior. Does it make sense to you?
Thanks for the feature request.  Or maybe this is a bug report,
since currently query-replace doesn't allow you using such a simple
configuration to ignore all unbound keys:

  (define-key query-replace-map [t] 'ignore)

To give you the freedom of using such configuration we need
to set the optional argument ACCEPT-DEFAULTS of 'lookup-key' to t
with this patch:

diff --git a/lisp/replace.el b/lisp/replace.el
index f8f5c415273..750ca9c1ee3 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -2924,7 +2924,7 @@ perform-replace
 
     ;; If last typed key in previous call of multi-buffer perform-replace
     ;; was `automatic-all', don't ask more questions in next files
-    (when (eq (lookup-key map (vector last-input-event)) 'automatic-all)
+    (when (eq (lookup-key map (vector last-input-event) t) 'automatic-all)
       (setq query-flag nil multi-buffer t))
 
     (cond
@@ -3111,7 +3111,7 @@ perform-replace
 		  ;; read-event that clobbers the match data.
 		  (set-match-data real-match-data)
 		  (setq key (vector key))
-		  (setq def (lookup-key map key))
+		  (setq def (lookup-key map key t))
 		  ;; Restore the match data while we process the command.
 		  (cond ((eq def 'help)
 			 (let ((display-buffer-overriding-action
--------------RXCD10SIDoJ95JzzYr5Ozq2f-- From unknown Thu Aug 14 22:23:30 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69342: query-replace: ignore events not binded in query-replace-map Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 29 Feb 2024 17:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69342 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Gabriele Nicolardi Cc: 69342@debbugs.gnu.org Received: via spool by 69342-submit@debbugs.gnu.org id=B69342.170922901812441 (code B ref 69342); Thu, 29 Feb 2024 17:51:01 +0000 Received: (at 69342) by debbugs.gnu.org; 29 Feb 2024 17:50:18 +0000 Received: from localhost ([127.0.0.1]:35291 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rfkXy-0003Eb-0t for submit@debbugs.gnu.org; Thu, 29 Feb 2024 12:50:18 -0500 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:38073) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rfkXv-0003EM-FJ for 69342@debbugs.gnu.org; Thu, 29 Feb 2024 12:50:16 -0500 Received: by mail.gandi.net (Postfix) with ESMTPSA id B58D0C0003; Thu, 29 Feb 2024 17:49:40 +0000 (UTC) From: Juri Linkov In-Reply-To: <93c69078-769f-460f-bfb6-4e942af7e102@medialab.sissa.it> (Gabriele Nicolardi's message of "Sun, 25 Feb 2024 09:19:29 +0100") Organization: LINKOV.NET References: <864jdx11qx.fsf@mail.linkov.net> <93c69078-769f-460f-bfb6-4e942af7e102@medialab.sissa.it> Date: Thu, 29 Feb 2024 19:34:19 +0200 Message-ID: <86sf1bjj70.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) 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.7 (-) > I suppose this feature will be available starting from Emacs version 30, > right? Yes, not before the next release. > In the meantime, I was suggested this code on StackExchange > (https://emacs.stackexchange.com/a/80494/15606): > > (defvar my-do-nothing-map > (let ((map (make-keymap))) > (set-char-table-range (nth 1 map) t 'ignore) > map)) > > (set-keymap-parent query-replace-map my-do-nothing-map) > > and it seems to work with the actual version of query-replace. Interesting hack. > @@ -3111,7 +3111,7 @@ perform-replace > ;; read-event that clobbers the match data. > (set-match-data real-match-data) > (setq key (vector key)) > - (setq def (lookup-key map key)) > + (setq def (lookup-key map key t)) > ;; Restore the match data while we process the command. > (cond ((eq def 'help) > (let ((display-buffer-overriding-action Still this could be fixed as well. Only one thing that I don't understand is why lookup-key ignores bindings for [t] by default. This requires adding ACCEPT-DEFAULT=t to all calls. But ok, this can't be changed now. From unknown Thu Aug 14 22:23:30 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69342: query-replace: ignore events not binded in query-replace-map Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 02 Mar 2024 17:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69342 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Gabriele Nicolardi Cc: 69342@debbugs.gnu.org Received: via spool by 69342-submit@debbugs.gnu.org id=B69342.170940027929124 (code B ref 69342); Sat, 02 Mar 2024 17:25:01 +0000 Received: (at 69342) by debbugs.gnu.org; 2 Mar 2024 17:24:39 +0000 Received: from localhost ([127.0.0.1]:39311 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rgT6E-0007Ze-Sp for submit@debbugs.gnu.org; Sat, 02 Mar 2024 12:24:39 -0500 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:57297) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rgT6B-0007ZM-N1; Sat, 02 Mar 2024 12:24:36 -0500 Received: by mail.gandi.net (Postfix) with ESMTPSA id 39CC660002; Sat, 2 Mar 2024 17:23:38 +0000 (UTC) From: Juri Linkov In-Reply-To: <864jdx11qx.fsf@mail.linkov.net> (Juri Linkov's message of "Sun, 25 Feb 2024 09:28:52 +0200") Organization: LINKOV.NET References: <864jdx11qx.fsf@mail.linkov.net> Date: Sat, 02 Mar 2024 19:22:38 +0200 Message-ID: <8634t8tuox.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) 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.7 (-) close 69342 30.0.50 thanks > Thanks for the feature request. Or maybe this is a bug report, > since currently query-replace doesn't allow you using such a simple > configuration to ignore all unbound keys: > > (define-key query-replace-map [t] 'ignore) > > To give you the freedom of using such configuration we need > to set the optional argument ACCEPT-DEFAULTS of 'lookup-key' to t > with this patch: Now the patch is pushed to master, so you can use this in Emacs 30.