[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#59888: [PATCH] Add 'grep-use-headings'
From: |
Augusto Stoffel |
Subject: |
bug#59888: [PATCH] Add 'grep-use-headings' |
Date: |
Tue, 28 Feb 2023 19:17:45 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
On Tue, 28 Feb 2023 at 19:24, Juri Linkov wrote:
>> +(defvar grep-heading-regexp
>> + (rx bol
>> + (or
>> + (group-n 2
>> + (group-n 1 (+ (not (any 0 ?\n))))
>> + 0)
>> + (group-n 2
>> + (group-n 1 (+? nonl))
>> + (any ?: ?- ?=)))
>> + (+ digit)
>> + (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:
--8<---------------cut here---------------start------------->8---
$ git grep -nC 1 grep-use-headings
etc/NEWS-99-
etc/NEWS:100:*** New user option 'grep-use-headings'.
etc/NEWS-101-When non-nil, the output of Grep is split into sections, one for
each
--
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."
--
lisp/progmodes/grep.el-465-(defface grep-heading `((t :inherit ,grep-hit-face))
lisp/progmodes/grep.el:466: "Face of headings when `grep-use-headings' is
non-nil."
lisp/progmodes/grep.el-467- :version "30.1")
--
lisp/progmodes/grep.el-969- (string-replace "\0" ":" string)))
lisp/progmodes/grep.el:970: (when grep-use-headings
lisp/progmodes/grep.el-971- (add-hook 'compilation-filter-hook
#'grep--heading-filter 80 t)
--8<---------------cut here---------------end--------------->8---
(I forget which program uses the =LINE= syntax)
At least when using grep --null, I think there is no confusion possible. I
wrote a unit test that purports to prove that.
- bug#59888: [PATCH] Add 'grep-use-headings', (continued)
- bug#59888: [PATCH] Add 'grep-use-headings', Juri Linkov, 2023/02/25
- bug#59888: [PATCH] Add 'grep-use-headings', Robert Pluim, 2023/02/26
- bug#59888: [PATCH] Add 'grep-use-headings', Juri Linkov, 2023/02/27
- bug#59888: [PATCH] Add 'grep-use-headings', Augusto Stoffel, 2023/02/27
- bug#59888: [PATCH] Add 'grep-use-headings', Juri Linkov, 2023/02/27
- bug#59888: [PATCH] Add 'grep-use-headings', Juri Linkov, 2023/02/28
- bug#59888: [PATCH] Add 'grep-use-headings',
Augusto Stoffel <=