GNU bug report logs - #31796
26.1; dired-do-find-regexp-and-replace fails to find multiline regexps

Previous Next

Package: emacs;

Reported by: Žygimantas Bruzgys <me <at> zygi.xyz>

Date: Tue, 12 Jun 2018 07:56:03 UTC

Severity: minor

Found in version 26.1

Full log


Message #17 received at 31796 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Andreas Abel <abela <at> chalmers.se>, 31796 <at> debbugs.gnu.org
Subject: RE: bug#31796: 27.1; dired-do-find-regexp-and-replace fails to find
 multiline regexps
Date: Mon, 23 Nov 2020 08:16:26 -0800 (PST)
> The dired-do-find-regexp-and-replace command does not seem
> to parse the regex entered by the user correctly.  If the
> regex string contains a newline character (^Q^J), it seems
> that the parsing stops there.  At least I have seen errors
> like "unmatched bracket" and the like.
> 
> Anyhow, I did not get it to replace multiline text.
> I found an answer here:
> 
> https://emacs.stackexchange.com/questions/30437/dired-search-and-replace-is-throwing-no-results
> 
> The solution is to manually invoke
> dired-do-query-replace-regexp (instead of pressing just Q).
>
> However, this solution is hard to discover, because it is
> unexpected that the official regex-replace feature (key Q)
> contains such a blunder.
> 
> - Why isn't the more robust dired-do-query-replace-regexp
>   bound to Q?

It _was_ bound to `Q' - for decades.  But the inventor
of `dired-do-find-regexp-and-replace' decided to give
that binding to his command.  (I argued in vain in
favor of giving the new command a different binding,
keeping `Q' as it was.  Similarly for `A'.)

> - Why not fix the bug in dired-do-find-regexp-and-replace?
> It has been reported for version 26 already, and it is not
> a minor issue. Replacing interactively in several files is
> an **extremely** useful feature, and I would not want to
> do something like that outside of emacs.

+1.

___

FWIW, Dired+ binds `dired-do-query-replace-regexp'
to `M-q' (respecting the new binding of `Q' to
`dired-do-find-regexp-and-replace', though I
disagree with it).  And Dired+ has both commands
on the menus:

 Multiple > Search >
   Query Replace Using TAGS Table...   M-q
   Query Replace Using `find'...       Q

https://www.emacswiki.org/emacs/DiredPlus




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

Previous Next


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