bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#59888: [PATCH] Add 'grep-use-headings'


From: Juri Linkov
Subject: bug#59888: [PATCH] Add 'grep-use-headings'
Date: Wed, 01 Mar 2023 19:52:53 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

>>> +      (any ?: ?- ?=))
>>
>> I wonder what is the reason for this regexp to be different
>> from grep-regexp-alist?  Especially with such additional characters
>> as ?- and ?=.  This mismatch causes wrong handling of files when
>> file names contain these characters.
>
> This is because of context lines:
>
> $ git grep -nC 1 grep-use-headings
> lisp/progmodes/grep.el-459-
> lisp/progmodes/grep.el:460:(defcustom grep-use-headings nil
> lisp/progmodes/grep.el-461-  "If non-nil, subdivide grep output into 
> sections, one per file."
> ...
> At least when using grep --null, I think there is no confusion possible.  I
> wrote a unit test that purports to prove that.

Thanks for mentioning --null, I completely forgot about it.
I've customized 'grep-find-template' to "rg --no-heading"
because ripgrep is fast, but since its headings are not
supported by grep.el, so also needed "--no-heading".
And now after adding "--null" to "rg --no-heading --null"
'grep-use-headings' correctly handles context lines
and file names with numbers separated by dashes.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]