all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#69342: query-replace: ignore events not binded in query-replace-map
@ 2024-02-23 22:16 Gabriele Nicolardi
       [not found] ` <handler.69342.B.170872663926258.ack@debbugs.gnu.org>
  2024-02-25  7:28 ` bug#69342: query-replace: ignore events not binded in query-replace-map Juri Linkov
  0 siblings, 2 replies; 6+ messages in thread
From: Gabriele Nicolardi @ 2024-02-23 22:16 UTC (permalink / raw)
  To: 69342

[-- Attachment #1: Type: text/plain, Size: 1329 bytes --]

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

​

[-- Attachment #2: Type: text/html, Size: 6754 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-03-02 17:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-23 22:16 bug#69342: query-replace: ignore events not binded in query-replace-map Gabriele Nicolardi
     [not found] ` <handler.69342.B.170872663926258.ack@debbugs.gnu.org>
2024-02-23 22:33   ` bug#69342: Acknowledgement (query-replace: ignore events not binded in query-replace-map) Gabriele Nicolardi
2024-02-25  7:28 ` bug#69342: query-replace: ignore events not binded in query-replace-map Juri Linkov
2024-02-25  8:19   ` Gabriele Nicolardi
2024-02-29 17:34     ` Juri Linkov
2024-03-02 17:22   ` Juri Linkov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.