emacs-devel
[Top][All Lists]
Advanced

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

Re: problem with recent change to grep-regexp-alist


From: Juri Linkov
Subject: Re: problem with recent change to grep-regexp-alist
Date: Mon, 08 Aug 2005 23:38:04 +0300
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

>> > 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 via email to

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