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 ​