unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Drew Adams <drew.adams@oracle.com>
Cc: Andreas Abel <abela@chalmers.se>, 31796@debbugs.gnu.org
Subject: bug#31796: 27.1; dired-do-find-regexp-and-replace fails to find multiline regexps
Date: Wed, 25 Nov 2020 09:31:23 +0200	[thread overview]
Message-ID: <87im9unh9o.fsf@mail.linkov.net> (raw)
In-Reply-To: <c46208e5-91ec-46d5-8866-f365d0bef10d@default> (Drew Adams's message of "Tue, 24 Nov 2020 12:12:25 -0800 (PST)")

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

>> >  Multiple > Search >
>> >    Query Replace Using TAGS Table...   M-q
>> >    Query Replace Using `find'...       Q
>>
>> dired-do-find-regexp-and-replace could be left bound to Q, but
>> dired-do-query-replace-regexp could be bound to M-% in Dired.
>
> For the latter, I use `M-q' (not `M-%').
> I suggest that vanilla Emacs do the same.
>
> These two commands have quite similar purposes.
> I suggest that they have similar keys.
>
> Also, `M-%' has its normal meaning when Dired
> has been toggled to writable (WDired).  That
> key should be kept for its normal purpose, IMO.

'M-q' has its normal meaning of filling the paragraph,
so it would be confusing to use other meaning in Dired.

While finding a good short key would be nice, here is a patch
that for consistency with 'M-s a M-C-s' also adds 'M-s a M-C-%':


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: query-replace-regexp.patch --]
[-- Type: text/x-diff, Size: 2423 bytes --]

diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el
index cdf8ab984e..bed779104c 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -308,6 +308,7 @@ vc-dir-mode-map
     (define-key map "Q" 'vc-dir-query-replace-regexp)
     (define-key map (kbd "M-s a C-s")   'vc-dir-isearch)
     (define-key map (kbd "M-s a M-C-s") 'vc-dir-isearch-regexp)
+    (define-key map (kbd "M-s a M-C-%") 'vc-dir-query-replace-regexp)
     (define-key map "G" 'vc-dir-ignore)
 
     (let ((branch-map (make-sparse-keymap)))
diff --git a/lisp/dired.el b/lisp/dired.el
index 08b19a0225..6cbcc17852 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -1932,6 +1932,7 @@ dired-mode-map
     ;; isearch
     (define-key map (kbd "M-s a C-s")   'dired-do-isearch)
     (define-key map (kbd "M-s a M-C-s") 'dired-do-isearch-regexp)
+    (define-key map (kbd "M-s a M-C-%") 'dired-do-query-replace-regexp)
     (define-key map (kbd "M-s f C-s")   'dired-isearch-filenames)
     (define-key map (kbd "M-s f M-C-s") 'dired-isearch-filenames-regexp)
     ;; misc
@@ -2214,9 +2215,12 @@ dired-mode-map
     (define-key map [menu-bar operate dashes-3]
       '("--"))
 
-    (define-key map [menu-bar operate query-replace]
-      '(menu-item "Query Replace in Files..." dired-do-find-regexp-and-replace
-		  :help "Replace regexp matches in marked files"))
+    (define-key map [menu-bar operate find-regexp-and-replace]
+      '(menu-item "Replace Regexp in Files..." dired-do-find-regexp-and-replace
+        	  :help "Replace regexp matches in marked files"))
+    (define-key map [menu-bar operate query-replace-regexp]
+      '(menu-item "Query Replace in Files..." dired-do-query-replace-regexp
+        	  :help "Replace regexp matches in marked files"))
     (define-key map [menu-bar operate search]
       '(menu-item "Search Files..." dired-do-find-regexp
 		  :help "Search marked files for matches of regexp"))
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index a395453491..7b8dcc2096 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -598,7 +598,7 @@ project-prefix-map
     (define-key map "p" 'project-switch-project)
     (define-key map "g" 'project-find-regexp)
     (define-key map "G" 'project-or-external-find-regexp)
-    (define-key map "r" 'project-query-replace-regexp)
+    (define-key map [?\C-\M-%] 'project-query-replace-regexp)
     map)
   "Keymap for project commands.")
 

  reply	other threads:[~2020-11-25  7:31 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-11 18:58 bug#31796: 26.1; dired-do-find-regexp-and-replace fails to find multiline regexps Žygimantas Bruzgys
2018-06-12 10:17 ` Noam Postavsky
2020-11-23 21:25   ` Dmitry Gutov
2020-11-23  9:09 ` bug#31796: 27.1; " Andreas Abel
2020-11-23 15:23   ` Eli Zaretskii
2020-11-23 16:16   ` Drew Adams
2020-11-23 21:22     ` Dmitry Gutov
2020-11-24 19:28     ` Juri Linkov
2020-11-24 20:12       ` Drew Adams
2020-11-25  7:31         ` Juri Linkov [this message]
2020-11-25 17:37           ` Drew Adams
2020-11-24 20:19       ` Eli Zaretskii
2020-11-24 20:31         ` Juri Linkov
2020-11-24 20:51           ` Drew Adams
2020-11-24 21:07           ` Eli Zaretskii
2020-11-25  7:28             ` Juri Linkov
2020-11-25 15:48               ` Eli Zaretskii
2020-11-25 20:18                 ` Juri Linkov
2020-11-25 20:30                   ` Eli Zaretskii
2020-11-29  2:30                     ` Dmitry Gutov
2020-11-29 15:22                       ` Eli Zaretskii
2020-11-23 21:28   ` Dmitry Gutov
2020-11-23 23:49     ` Andreas Abel
2020-11-24  0:13       ` Dmitry Gutov
2020-11-24  1:19         ` Dmitry Gutov
2020-11-24 15:16       ` Eli Zaretskii
2020-11-24 15:43         ` Dmitry Gutov
2020-11-24 16:35           ` Eli Zaretskii
2020-11-24 19:43             ` Dmitry Gutov
2020-11-24 20:16               ` Eli Zaretskii
2020-11-30  2:25                 ` Dmitry Gutov
2020-11-30  8:49                   ` Juri Linkov
2020-12-01  2:21                     ` Dmitry Gutov
2020-12-01  8:39                       ` Juri Linkov
2020-12-03  2:46                         ` Dmitry Gutov
2020-12-06 21:00                           ` Juri Linkov
2020-12-16  3:00                             ` Dmitry Gutov
2020-12-16 20:32                               ` Juri Linkov
2020-12-17  0:40                                 ` Dmitry Gutov
2020-11-30 15:30                   ` Eli Zaretskii
2020-11-30 15:39                     ` Jean Louis
2020-11-30 16:36                       ` Eli Zaretskii
2020-11-30 15:42                     ` Jean Louis
2020-12-01  1:23                       ` Dmitry Gutov
2020-12-01  8:36                         ` Juri Linkov
2020-12-01 15:20                           ` Dmitry Gutov
2020-12-01  1:24                     ` Dmitry Gutov
2020-12-01  5:20                   ` Richard Stallman
2020-12-01 15:46                     ` Eli Zaretskii
2020-12-02  4:26                       ` Richard Stallman
2020-12-02 14:56                         ` Eli Zaretskii
2020-12-02 17:17                           ` Dmitry Gutov
2020-12-02 17:39                             ` Eli Zaretskii
2020-12-02 17:43                               ` Dmitry Gutov
2020-12-02 17:47                                 ` Eli Zaretskii
2020-12-03  5:26                                   ` Richard Stallman
2020-12-03  2:23                     ` Dmitry Gutov
2020-11-24 19:29     ` Juri Linkov
2020-11-24 19:39       ` Dmitry Gutov
     [not found] <<CADy8Bt=f=LOE6ODLhhW7ZS6qXRQCzd15Hd0eFKVO8qok98ni8w@mail.gmail.com>
     [not found] ` <<10120030-8b8d-b702-add4-8f099f934ed5@chalmers.se>
     [not found]   ` <<91c98791-9df2-43ee-9aac-205c5b0de9c2@default>
     [not found]     ` <<87blfm6922.fsf@mail.linkov.net>
     [not found]       ` <<838saqtsm9.fsf@gnu.org>
2020-11-24 20:32         ` Drew Adams
     [not found]         ` <<87mtz64htw.fsf@mail.linkov.net>
     [not found]           ` <<831rgitqe2.fsf@gnu.org>
2020-11-24 21:35             ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87im9unh9o.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=31796@debbugs.gnu.org \
    --cc=abela@chalmers.se \
    --cc=drew.adams@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).