help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: using find-grep in emacs


From: Dan Espen
Subject: Re: using find-grep in emacs
Date: Mon, 13 May 2013 20:45:00 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux)

Rami A <rami.ammari@gmail.com> writes:

> Hi,
> I am trying to setup some default for grep-find in emacs.
> I do the following to search in the source code:
> M-x find-grep
> which give:
> find . -type f -exec grep -n  {} /dev/null \;
>
> Now I have to change /dev/null to be the directory which I want to search in.
> How is it possible to not do that every time I use find-grep and that it 
> could remember the directory I am specifying.
>
> Also, How to make it default to search all three file types .h .s .c and 
> nothing else?

In emacs 24.2.1 the string is:

find . -type f -print0 | "xargs" -0 -e grep -nH -e 


To only look at .hsc files I'd do:

 find . -type f  -a -name '*.[hsc]' -exec grep -n  {} /dev/null \;

(Not tested but you should get the idea.)

The "." after find is the directory you want to search in, if you don't
want to search the current directory, replace the ".".

I believe /dev/null is there to convince grep that it should display
file names because it is looking at multiple files.

-- 
Dan Espen


reply via email to

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