[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Simple EMACS Grep
From: |
Karl Hegbloom |
Subject: |
Re: Simple EMACS Grep |
Date: |
Fri, 27 Apr 2007 09:06:19 -0600 |
On Thu, 2007-04-19 at 20:23 -0700, bobblue88@gmail.com wrote:
> Anyone has a good EMACS Grep define to search only certain file types,
> such as "*.c, *.h, *.s, *.cpp" and etc?
>
> The standard EMACS "grep-find" search all file types.
Have a look at M-x find-function grep-find once, and see that it first
checks the value of `grep-find-command', and then uses it's own unique
`grep-find-history' variable for the command history.
You could create a ".dired" file for the top-level directory of you C
project with:
Local Variables:
grep-find-command: "find . -type f \( -name '*.[hcs]' -or -name '*.cpp' \)
-print0 | xargs -0 -e grep -n -e "
End:
That should make it do what you want by default whenever you run it from
that location, provided you have first requested a directory listing via
dired so that the .dired is seen.
You could also, if you liked, use `add-to-list' to push that string onto
the `grep-find-history' in ~/.emacs.