emacs-devel
[Top][All Lists]
Advanced

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

Re: grep.el regexp


From: Juri Linkov
Subject: Re: grep.el regexp
Date: Sat, 09 Jul 2005 23:56:16 +0300
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

> [I sent this message a few weeks ago but did not get a response.
> Could we get the discussion moving again?]
>
>     > I am not sure whether that relates to the suggestion I made:
>
>     >> I think that if we wrote a separate regexp for each kind of grep,
>     >> all together they would match a lot fewer different strings than the
>     >> current regexp does, and they would be much easier to understand.
>
>     Indeed, the two do not conflict.  I.e. I think there's no problem with
>     compile.el's current behavior in this regard and I believe your suggestion
>     w.r.t grep.el should work just fine.
>
> Would someone like to try implementing this?
> (Please respond to this message, if so.)

Perhaps what is needed to start with is to ask people to send output
examples of different kinds of grep.  We could put these example in a
new file etc/grep.txt similarly to etc/compilation.txt.

I've collected a few examples in the file attached below.  The section
`grep ???' contains examples deduced from regexps in `grep-regexp-alist'.
Could someone recognize what grep produces them?

Also you can see that with recent changes in GNU grep CVS it produces
escape sequences not handled by grep.el.  This requires a separate rule
in `grep-regexp-alist'.

* Introduction  -*-grep-*-

This shows the different kinds of messages grep recognizes by default and
how they are rendered.  It is intended both to help you decide which matchers
you need and as a test of the matchers.  Move the mouse over a colored part or
use `compilation-message-face', to see how much text was actually matched.


* GNU grep 2.5.1

grep -nH -e "xyzxyz" *
emacs-2:1205:inserts `xyzxyzxyzxyz' in the current buffer.

* GNU grep 2.5.1 without line numbers

grep -e "xyzxyz" *
emacs-2:inserts `xyzxyzxyzxyz' in the current buffer.

* GNU grep 2.5.1 with color matches

grep -nH --color=always -e "xyzxyz" *
emacs-2:1205:inserts `xyzxyzxyzxyz' in the current 
buffer.

* GNU grep 2.5.1-cvs

grep -nH --color=always -e "xyzxyz" *
emacs-2:1205:inserts 
`xyzxyzxyzxyz' in the current buffer.

* agrep

agrep -n "xyzxyz" *
emacs-2: 1205: inserts `xyzxyzxyzxyz' in the current buffer.

* sgrep

sgrep -l '"xyzxyz"' *
------------- #1 emacs-2: 6 (6641933,6641938 : 50542,50547)
xyzxyz
------------- #2 emacs-2: 6 (6641936,6641941 : 50545,50550)
xyzxyz
------------- #3 emacs-2: 6 (6641939,6641944 : 50548,50553)
xyzxyz

* grep ???

grep -nH -e "xyzxyz" *
emacs-2:1205:9:inserts `xyzxyzxyzxyz' in the current buffer.
emacs-2:1205:9-15:inserts `xyzxyzxyzxyz' in the current buffer.
emacs-2:1205.9-1205.9:inserts `xyzxyzxyzxyz' in the current buffer.
emacs-2 1205.9-15 inserts `xyzxyzxyzxyz' in the current buffer.
emacs-2 1205.9-1205.9 inserts `xyzxyzxyzxyz' in the current buffer.
emacs-2 1205 inserts `xyzxyzxyzxyz' in the current buffer.
-- 
Juri Linkov
http://www.jurta.org/emacs/

reply via email to

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