[Top][All Lists]

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

Re: Changes to emacs/lisp/progmodes/grep.el

From: Adrian Aichner
Subject: Re: Changes to emacs/lisp/progmodes/grep.el
Date: Sun, 27 Jun 2004 13:58:30 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.5 (chayote, windows-nt)

address@hidden (Daniel Pfeiffer) writes:

> Saluton, Moin,
> Richard Stallman <address@hidden> skribis:
>> Would you please say precisely what job this Perl script does,
>> and what purpose people would use it for?  Those details are
>> not clear to me, so I don't understand what question we are
>> discussing.
> I've written a little Perl script, which is not production quality yet.  This
> serves two purposes I'm frequently confronted with:
> - easily deployable on machines without GNU grep
> - can match over several lines.

Hi Daniel,

I use
(setq igrep-options "-Pi")
(setq grep-command "grep -Pni ")
which gives me multi-line match capability with
grep (GNU grep) 2.5
CYGWIN_NT-5.1 D5DC120J 1.5.7(0.109/3/2) 2004-01-30 19:32 i686 unknown unknown 
XEmacs 21.5  (beta17) "chayote" (+CVS-20040611) [Lucid] (i586-pc-win32, Mule) 
of Sat Jun 12 2004 on D5DC120J

I guess if I had no grep, but only perl, your script could be useful.


> =head1 NAME
> plgrep -- Perl grep specially useful within Emacs
> =head1 SYNOPSIS
>  plgrep -n3 'regexp spanning\n upto\n 3 lines' file ...
>  plgrep -R -c 'regexp looked for in C sources in and recursively under dir'
> dir ...
>  plgrep --eval 'script "perl"' 'regexp looked for only in all perl scripts in
> pwd'
>  plgrep --eval 'script "perl"; $_ = 0 if /^=/../^=cut/ or /^\s*#/' 'same,
> excluding POD or comment lines'
> Unlike other greps, this prints out only the name of the file.  Instead of
> prepending the directory on every line, it outputs "Entering directory"
> messages as necessary.  It also outputs column numbers.  Emacs M-x grep picks
> up this information.
> The regexps are in Perl syntax, giving you very rich possibilities.
> coralament / best Grötens / liebe Grüße / best regards / elkorajn salutojn
> Daniel Pfeiffer

Adrian Aichner

reply via email to

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