unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
Cc: emacs-devel@gnu.org
Subject: Re: problem with recent change to grep-regexp-alist
Date: Mon, 08 Aug 2005 23:38:04 +0300	[thread overview]
Message-ID: <874qa05fmd.fsf@jurta.org> (raw)
In-Reply-To: <742051605080707254aeaf65c@mail.gmail.com> (Emanuele Giaquinta's message of "Sun, 7 Aug 2005 16:25:00 +0200")

>> > Ok, let's use "\(.+?\)".
>> >
>> > You can still get wrong matches with the file names like "abc:123",
>> > but perhaps such file names are rare.
>> 
>> Maybe \([A-Za-z]:\| ...
>> or something?  It is not like there are many Unix file names starting
>> with a single letter followed by colon.
>> 
>> But Linux has file names like
>> 
>> /proc/driver/uhci/0000:00:07.2
>
> For those files the matching will be fine.

It can't be fine, because the grep output is ambiguous.  For example,
for the grep output line:

1:2:3:4:text

there are three different interpretations:

file name `1:2:3', line number `4', source line `text'
file name `1:2', line number `3', source line `4:text'
file name `1', line number `2', source line `3:4:text'

One way to resolve them is to match markup escape sequences that new
GNU grep puts around file names and line numbers.  You can see them in
grep.txt under the title `GNU grep 2.5.1-cvs with default colors'.

> The wrong matches occur when the filename contains somewhere the
> pattern ":[0-9]+:" or ends with the pattern ":[0-9]+" (like Juri's example)
> Juri, wouldn't be good to add a comment about this in grep.el or grep.txt?

Since Richard doesn't want to document even `-n' option in grep.el,
I am not sure I can add a comment in grep.el about such rare cases
with numbers and colons in the file name.

-- 
Juri Linkov
http://www.jurta.org/emacs/

  reply	other threads:[~2005-08-08 20:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-06 10:34 problem with recent change to grep-regexp-alist Emanuele Giaquinta
2005-08-06 18:11 ` Juri Linkov
2005-08-06 19:20   ` David Kastrup
2005-08-07 14:25     ` Emanuele Giaquinta
2005-08-08 20:38       ` Juri Linkov [this message]
2005-08-08 22:56         ` Emanuele Giaquinta
2005-08-10  4:02           ` Juri Linkov
2005-08-09 23:57   ` Stefan Monnier

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=874qa05fmd.fsf@jurta.org \
    --to=juri@jurta.org \
    --cc=emacs-devel@gnu.org \
    /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).