GNU bug report logs - #20687
25.0.50; `perform-replace' should invoke a key that you have bound in `query-replace-map'

Previous Next

Package: emacs;

Reported by: Drew Adams <drew.adams <at> oracle.com>

Date: Thu, 28 May 2015 21:13:02 UTC

Severity: wishlist

Tags: fixed

Found in version 25.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 20687 <at> debbugs.gnu.org
Subject: bug#20687: 25.0.50; `perform-replace' should invoke a key that you have bound in `query-replace-map'
Date: Wed, 03 Jun 2015 01:01:39 +0300
> The point is that a user can do that (that's what keymaps and
> key bindings are for), but currently `perform-replace' refuses to
> recognize such a key and its command.

I see there are already commands (as opposed to special internal
values such as `act' and `skip') in query-replace-map:

    (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)

These bindings look like real commands intended to be called
interactively, so after enabling this feature in query-replace
they will start doing their job which is good.

The only suggestion I have is to check whether the binding
is a command before trying to call it, i.e.:

diff --git a/lisp/replace.el b/lisp/replace.el
index 1bf1343..503531a 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -2404,6 +2404,8 @@ (defun perform-replace (from-string replacements
 			 (replace-dehighlight)
 			 (save-excursion (recursive-edit))
 			 (setq replaced t))
+                        ((commandp def t)
+                         (call-interactively def))
 			;; Note: we do not need to treat `exit-prefix'
 			;; specially here, since we reread
 			;; any unrecognized character.




This bug report was last modified 4 years and 251 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.