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


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: Eli Zaretskii <eliz <at> gnu.org>, abela <at> chalmers.se, 31796 <at> debbugs.gnu.org
Subject: bug#31796: 27.1; dired-do-find-regexp-and-replace fails to find multiline regexps
Date: Mon, 30 Nov 2020 10:49:58 +0200
> Now that I've dug in a little, the situation seems difficult.
>
> -Pz does work, but it forces Grep to consider the file as one long
>  string. As a consequence, if we ask it to output the line number, the
>  number will always be 1. That's not a helpful mode of operation.
>
> Even if it worked differently, -P imposes a significant performance penalty
> from what I see, even when the extra syntax is not actually used. So we
> couldn't enable it by default.

When a grep input pattern contains a newline, then xref could use
the same algorithm as is used for 'M-.', i.e. run 'grep -Pzl'
to get the file names that contain the pattern, then return
these file names without line numbers.  This works exactly
like a new feature of extending xref-show-xrefs-function
with a new completion function was proposed recently on emacs-devel
(BTW, why it's not installed yet?)

So like this feature presenting such completions without line numbers:

  lisp/progmodes/project.el:(cl-defgeneric project-root)
  lisp/progmodes/project.el:(cl-defmethod project-root ((project (head transient))))
  lisp/progmodes/project.el:(cl-defmethod project-root ((project (head vc))))

xref for grep could work the same way without line numbers:

  lisp/progmodes/project.el:names"^Jproject--read-file-cpd-relative)
  lisp/progmodes/project.el:names"^Jproject--read-file-absolute)

Then visiting such grep hit should use Emacs search functions
to find the grep hit in the visited file.




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.