|
From: | Dmitry Gutov |
Subject: | bug#31796: 27.1; dired-do-find-regexp-and-replace fails to find multiline regexps |
Date: | Wed, 16 Dec 2020 05:00:33 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
On 06.12.2020 23:00, Juri Linkov wrote:
dired-do-find-regexp uses 'ignores' to filter out ignored files. You could add another filter to filter out files without matches using 'grep -PzL'.Right. This is sorta a backup plan. Although, when the number of files to search can be counted on one hand, there's nothing too bad in doing the search in Emacs.Another backup plan is to use ripgrep. Its multiline handling with -U also allows to search words ignoring any whitespace, even newlines. This is like isearch-lax-whitespace using search-whitespace-regexp when it contains a newline, e.g. "[ \t\r\n]+".
Right. It has a problem of its own, though: it still outputs a file name per line, even when a match is spread across several lines (unlike pcregrep). So we're left guessing where a given multiline match ends.
Also, 'sort' doesn't seem to be able to treat both : and \0 as separators at the same time.
Here's a rough patch, for illustration. It's kind of working, but I'm not loving it.
ripgrep-multiline.diff
Description: Text Data
[Prev in Thread] | Current Thread | [Next in Thread] |