GNU bug report logs - #6843
23.1; grep-mode and filenames with colons

Previous Next

Package: emacs;

Reported by: Ethan Glasser-Camp <glasse <at> cs.rpi.edu>

Date: Wed, 11 Aug 2010 14:11:02 UTC

Severity: normal

Tags: fixed, patch

Merged with 7378

Found in versions 23.1, 23.2

Fixed in version 26.1

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6843 in the body.
You can then email your comments to 6843 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6843; Package emacs. (Wed, 11 Aug 2010 14:11:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ethan Glasser-Camp <glasse <at> cs.rpi.edu>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 11 Aug 2010 14:11:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ethan Glasser-Camp <glasse <at> cs.rpi.edu>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.1; grep-mode and filenames with colors
Date: Wed, 11 Aug 2010 07:20:08 -0400
grep-mode highlights matches based on the presence of a pair of colons
around a number. But, for example, if you do this:

ethan <at> joker:~$ mkdir test
ethan <at> joker:~$ echo 'Hello' > test/10:45:20.txt
ethan <at> joker:~$ emacs -q

M-x rgrep <RET>
Hello <RET>
~/test <RET>

The results will mis-highlight 10:45:20, coloring "45" as the line
number (when it is part of the name of the file). Correspondingly,
if you do

M-x grep <RET>
Hello 10:<TAB> <RET>

The same thing happens. It's not possible to automatically jump-to-line
when this happens.

Thanks for your time,

Ethan

In GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.18.3)
of 2010-03-26 on palmer, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.10604000
configured using `configure  '--build=i486-linux-gnu' 
'--host=i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' 
'--libexecdir=/usr/lib' '--localstatedir=/var/lib' 
'--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' 
'--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim' 
'--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 
'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 
'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS=''

Important settings:
 value of $LC_ALL: nil
 value of $LC_COLLATE: nil
 value of $LC_CTYPE: nil
 value of $LC_MESSAGES: nil
 value of $LC_MONETARY: nil
 value of $LC_NUMERIC: nil
 value of $LC_TIME: nil
 value of $LANG: en_US.UTF-8
 value of $XMODIFIERS: @im=ibus
 locale-coding-system: utf-8-unix
 default-enable-multibyte-characters: t

Major mode: Grep

Minor modes in effect:
 shell-dirtrack-mode: t
 tooltip-mode: t
 tool-bar-mode: t
 mouse-wheel-mode: t
 menu-bar-mode: t
 file-name-shadow-mode: t
 global-font-lock-mode: t
 font-lock-mode: t
 blink-cursor-mode: t
 global-auto-composition-mode: t
 auto-composition-mode: t
 auto-encryption-mode: t
 auto-compression-mode: t
 line-number-mode: t
 transient-mark-mode: t

Recent input:
M-x r g r e p <return> H e l l o <return> * <return>
f o o <tab> <backspace> <backspace> <backspace> t e
s t <tab> <return> C-x o <down> <down> <down> <down>
<down> <down> <down> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> C-a <down>
<down> <down> <up> <up> <up> <return> C-x k <return>
M-x <up> <return> H e l l o <return> <return> t e s
t <return> C-x o <down> <down> <down> <down> <down>
<down> <down> <down> <return> M-x <up> <return> f o
o <return> * <return> <M-backspace> <M-backspace> s
r <tab> c a m <tab> <return> C-x o <down> <down> <down>
<down> <down> <down> <down> <M-down> <M-down> M-x <up>
<return> H e l l o <return> ~ <backspace> <return>
~ <backspace> <M-backspace> <M-backspace> t e s t <tab>
<return> C-x o <down> <down> <up> <up> C-x o <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> M-x <up> <return> H e l l o <return> <return>
<return> <help-echo> M-x g r e p <return> H e l l o
SPC <backspace> <return> M-x <up> <return> H e l l
o SPC 1 0 : <tab> <return> M-x <up> C-g M-x e m a c
<tab> b <tab> <M-backspace> <M-backspace> <M-backspace>
<M-backspace> b u <backspace> <backspace> r e p <tab>
o r t <tab> <return>

Recent messages:
Grep finished (matches found)
Mark set
Grep finished (matches found)
Mark set
Grep finished (matches found) [3 times]
Grep finished with no matches found
Grep finished (matches found)
Quit
Making completion list...
/usr/bin/mail is not an executable.  Setting mail-interactive to t.





Merged 6843 7378. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 28 Jan 2011 23:51:02 GMT) Full text and rfc822 format available.

Added tag(s) patch. Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Wed, 28 Jun 2017 12:00:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6843; Package emacs. (Thu, 20 Jul 2017 00:04:02 GMT) Full text and rfc822 format available.

Message #12 received at 6843 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Juri Linkov <juri <at> jurta.org>, 7378 <at> debbugs.gnu.org, 6843 <at> debbugs.gnu.org
Subject: Re: bug#7378: 23.2;
 grep buffer misinterprets result if filename contains colon character
Date: Wed, 19 Jul 2017 20:04:45 -0400
tags 7378 fixed
close 7378 26.1
quit

npostavs <at> users.sourceforge.net writes:
>
> GNU grep also supports --null to output NUL bytes following file names,
> I haven't measured but it should be no slower and possibly faster since
> the regexp is simpler.

Pushed to master.

[1: 644cdd1aa0]: 2017-07-19 20:03:00 -0400
  Use grep's --null option (Bug#6843)
  http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=644cdd1aa0a10dbfffa3b9b4c7a97f8cddded0b8




Added tag(s) fixed. Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Thu, 20 Jul 2017 00:04:03 GMT) Full text and rfc822 format available.

bug marked as fixed in version 26.1, send any further explanations to 7378 <at> debbugs.gnu.org and Robin Green <greenrd <at> greenrd.org> Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Thu, 20 Jul 2017 00:04:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6843; Package emacs. (Wed, 26 Jul 2017 23:31:02 GMT) Full text and rfc822 format available.

Message #19 received at 6843 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: bug#6843 <6843 <at> debbugs.gnu.org>, Andreas Schwab <schwab <at> linux-m68k.org>,
 Dmitry Gutov <dgutov <at> yandex.ru>
Subject: bug#6843: grep-mode and filenames with colons
Date: Wed, 26 Jul 2017 19:32:27 -0400
On Wed, Jul 26, 2017 at 12:58 PM, Dmitry Gutov <dgutov <at> yandex.ru> wrote:
>
>> +*** Grep commands will now use GNU grep's '--null' option if
>> +available, which allows distinguishing the filename from contents if
>> +they contain colons.  This can be controlled by the new custom option
>> +'grep-use-null-filename-separator'.
>
>
> Why do the want the option?
>
> And on the same note, are there any versions of Grep in widespread usage
> that don't support '--null'? AFAICT this flag was added to GNU Grep 2.4
> which was released in 1999.

As noted in the emacs-devel thread, non-GNU greps don't support it.

>> +(defconst grep--regexp-alist-bin-matcher
>> +  '("^Binary file \\(.+\\) matches$" 1 nil nil 0 1))
>> +(defconst grep-with-null-regexp-alist
>> +  `(("^\\([^\0]+\\)\\(\0\\)\\([0-9]+\\):" 1 3 ,grep--regexp-alist-column
>> nil nil
>
>
> Any reason to change 2 to 3? Why don't we use a non-capturing group for \0
> here?

It's on the next line, I capture the \0 so as to display it with a nicer
string than "^@".

>> +     (2 '(face unspecified display ":")))

> If the numbers are the same, we could keep the variable's name the same as
> well. As a result, most third-party code would continue to simply work.

Might be worth using explicitly numbered groups to keep the numbers for
FILE and COLUMN the same though.

>> +    ,grep--regexp-alist-bin-matcher)
>> +  "Regexp used to match grep hits.
>> +See `compilation-error-regexp-alist'.")
>> +(defconst grep-fallback-regexp-alist
>
>
> Compensating for the multitude of variables by eliminating newlines between
> them doesn't look too hot to me.

Hmm yeah, I think I had them originally as let-bindings, and then I
forgot to space them out when converting to defconst.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6843; Package emacs. (Thu, 27 Jul 2017 12:18:02 GMT) Full text and rfc822 format available.

Message #22 received at 6843 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: npostavs <at> users.sourceforge.net, bug#6843 <6843 <at> debbugs.gnu.org>,
 Andreas Schwab <schwab <at> linux-m68k.org>
Subject: Re: bug#6843: grep-mode and filenames with colons
Date: Thu, 27 Jul 2017 15:10:40 +0300
On 7/27/17 2:32 AM, npostavs <at> users.sourceforge.net wrote:

> As noted in the emacs-devel thread, non-GNU greps don't support it.

And we can't always ask the user to install GNU Grep?

If we do need to support both ways, maybe tweak the variable names. As 
of now, they look a bit inconsistent.

I'd prefer to have either grep-with-null-regexp-alist and 
grep-[without-null-]-regexp-alist, or grep-regexp-alist and 
grep-fallback-regexp-alist. Just a suggestion.

>> Any reason to change 2 to 3? Why don't we use a non-capturing group for \0
>> here?
> 
> It's on the next line, I capture the \0 so as to display it with a nicer
> string than "^@".

Oh, right. Thanks.

>>> +     (2 '(face unspecified display ":")))
> 
>> If the numbers are the same, we could keep the variable's name the same as
>> well. As a result, most third-party code would continue to simply work.
> 
> Might be worth using explicitly numbered groups to keep the numbers for
> FILE and COLUMN the same though.

Yes, I think it will be a good idea. Provided we can combine it with 
renaming either of the variables back to grep-regexp-alist. Otherwise, 
any backward compatibility is broken anyway.

>> Compensating for the multitude of variables by eliminating newlines between
>> them doesn't look too hot to me.
> 
> Hmm yeah, I think I had them originally as let-bindings, and then I
> forgot to space them out when converting to defconst.

Thanks in advance.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6843; Package emacs. (Thu, 27 Jul 2017 17:22:02 GMT) Full text and rfc822 format available.

Message #25 received at 6843 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 6843 <at> debbugs.gnu.org, schwab <at> linux-m68k.org, npostavs <at> users.sourceforge.net
Subject: Re: bug#6843: grep-mode and filenames with colons
Date: Thu, 27 Jul 2017 20:20:41 +0300
> From: Dmitry Gutov <dgutov <at> yandex.ru>
> Date: Thu, 27 Jul 2017 15:10:40 +0300
> 
> On 7/27/17 2:32 AM, npostavs <at> users.sourceforge.net wrote:
> 
> > As noted in the emacs-devel thread, non-GNU greps don't support it.
> 
> And we can't always ask the user to install GNU Grep?

We could, but I don't think users will indeed do that.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6843; Package emacs. (Sun, 30 Jul 2017 15:01:02 GMT) Full text and rfc822 format available.

Message #28 received at 6843 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: bug#6843 <6843 <at> debbugs.gnu.org>, Andreas Schwab <schwab <at> linux-m68k.org>
Subject: Re: bug#6843: grep-mode and filenames with colons
Date: Sun, 30 Jul 2017 11:01:36 -0400
Dmitry Gutov <dgutov <at> yandex.ru> writes:

> I'd prefer to have either grep-with-null-regexp-alist and
> grep-[without-null-]-regexp-alist, or grep-regexp-alist and
> grep-fallback-regexp-alist. Just a suggestion.
>

[...]

>>
>>> If the numbers are the same, we could keep the variable's name the same as
>>> well. As a result, most third-party code would continue to simply work.
>>
>> Might be worth using explicitly numbered groups to keep the numbers for
>> FILE and COLUMN the same though.
>
> Yes, I think it will be a good idea. Provided we can combine it with
> renaming either of the variables back to grep-regexp-alist. Otherwise,
> any backward compatibility is broken anyway.

That part is already covered by this, no?

    (defvaralias 'grep-regex-alist 'grep-with-null-regexp-alist)
    (make-obsolete-variable
     'grep-regex-alist "Call `grep-regexp-alist' instead." "26.1")






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6843; Package emacs. (Tue, 01 Aug 2017 13:29:03 GMT) Full text and rfc822 format available.

Message #31 received at 6843 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: npostavs <at> users.sourceforge.net
Cc: bug#6843 <6843 <at> debbugs.gnu.org>, Andreas Schwab <schwab <at> linux-m68k.org>
Subject: Re: bug#6843: grep-mode and filenames with colons
Date: Tue, 1 Aug 2017 16:28:44 +0300
On 7/30/17 6:01 PM, npostavs <at> users.sourceforge.net wrote:

> That part is already covered by this, no?
> 
>      (defvaralias 'grep-regex-alist 'grep-with-null-regexp-alist)
>      (make-obsolete-variable
>       'grep-regex-alist "Call `grep-regexp-alist' instead." "26.1")

I suppose so. Thanks.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 30 Aug 2017 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 299 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.