[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: rgrep with (some) fixed parameters
From: |
Stefan Vollmar |
Subject: |
Re: rgrep with (some) fixed parameters |
Date: |
Fri, 06 Jun 2008 23:43:40 +0200 |
Dear Peter,
On 06.06.2008, at 22:40, Peter Jones wrote:
Stefan Vollmar <vollmar@nf.mpg.de> writes:
I find the M-rgrep command very useful but need it frequently in the
context of a particular project where all parameters remain constant
(directory, name pattern of files to search) except the expression to
look for. How could I create a command my-rgrep that uses some pre-
set
parameters and only asks for the search pattern (the project-specific
parameters have already been assigned to some variables) ?
You just need to write a few small lines of lisp. Read the
documentation for rgrep:
C-h f rgrep
I did, but I am new to Emacs customization and might have overlooked
something.
If I do the equivalent of a
(setq grep-find-command "find somepath \\( -path \*/.svn \\) -prune -o
-type f \\( -iname \\*.cpp \\) -exec grep -nH -e {} /dev/null \\;")
in my .emacs file,
C-u C-u M-x rgrep
does indeed use this pattern (and does not ask about anything else,
and I could use a keyboard shortcut for this) - so far so good.
However, I feel that having to look at that long-ish command every
time I use it, is not elegant - in particular, as I need to navigate
to the correct position when the find command is being displayed in
the minibuffer (point should be between "-e" and "{}" to insert the
pattern to search for). Could you help me improve on this?
Many thanks in advance,
Stefan
--
Dr. Stefan Vollmar, Dipl.-Phys.
Max-Planck-Institut für neurologische Forschung
Gleuelerstr. 50, 50931 Köln, Germany
Tel.: +49-221-4726-213 FAX +49-221-4726-298
Tel.: +49-221-478-5713 Mobile: 0160-93874279
Email: vollmar@nf.mpg.de http://www.nf.mpg.de