From: Augusto Stoffel <arstoffel@gmail.com>
To: Juri Linkov <juri@linkov.net>
Cc: 59888@debbugs.gnu.org
Subject: bug#59888: [PATCH] Add 'grep-use-headings'
Date: Tue, 28 Feb 2023 19:17:45 +0100 [thread overview]
Message-ID: <871qm9bqnq.fsf@gmail.com> (raw)
In-Reply-To: <86r0u9oj4p.fsf@mail.linkov.net> (Juri Linkov's message of "Tue, 28 Feb 2023 19:24:58 +0200")
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.
next prev parent reply other threads:[~2023-02-28 18:17 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-07 17:57 bug#59888: [PATCH] Add 'grep-heading-mode' Augusto Stoffel
2022-12-07 18:14 ` Eli Zaretskii
2022-12-08 8:59 ` Augusto Stoffel
2022-12-08 10:57 ` Eli Zaretskii
2022-12-08 0:19 ` Stefan Kangas
2022-12-08 9:06 ` Augusto Stoffel
2022-12-09 7:23 ` Juri Linkov
2022-12-09 11:58 ` Augusto Stoffel
2022-12-09 12:18 ` bug#59888: [PATCH] Add 'grep-use-headings' Augusto Stoffel
2022-12-09 19:36 ` Eli Zaretskii
2022-12-09 20:03 ` Augusto Stoffel
2022-12-09 20:29 ` Eli Zaretskii
2022-12-10 20:08 ` Augusto Stoffel
2022-12-10 20:16 ` Eli Zaretskii
2022-12-11 11:30 ` Augusto Stoffel
2022-12-15 8:05 ` Juri Linkov
2023-02-25 8:34 ` Augusto Stoffel
2023-02-25 18:00 ` Juri Linkov
2023-02-26 13:17 ` Robert Pluim
2023-02-26 15:07 ` Augusto Stoffel
2023-02-27 6:24 ` Robert Pluim
2023-02-27 11:26 ` Augusto Stoffel
2023-02-27 16:51 ` Robert Pluim
2023-02-27 18:53 ` Juri Linkov
2023-02-27 19:06 ` Augusto Stoffel
2023-02-27 19:15 ` Juri Linkov
2023-02-28 17:24 ` Juri Linkov
2023-02-28 18:17 ` Augusto Stoffel [this message]
2023-03-01 17:52 ` Juri Linkov
2022-12-09 20:40 ` Gregory Heytings
2022-12-10 17:24 ` Juri Linkov
2022-12-08 9:57 ` bug#59888: [PATCH] Add 'grep-heading-mode' Mattias Engdegård
2022-12-08 10:28 ` Augusto Stoffel
2022-12-08 10:48 ` Mattias Engdegård
2023-02-27 14:18 ` Mattias Engdegård
2022-12-09 7:28 ` Juri Linkov
2022-12-09 11:58 ` Augusto Stoffel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871qm9bqnq.fsf@gmail.com \
--to=arstoffel@gmail.com \
--cc=59888@debbugs.gnu.org \
--cc=juri@linkov.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).