tags:

views:

131

answers:

4

Whats the best package for finding a string in multiple files in EMACS. I know about grep and such but I would like something that is a little smoother to operate.

+6  A: 

There are three builtin functions for grepping in Emacs: grep, find-grep (or grep-find) and rgrep.

The first two work by letting the user edit the grep command line directly. I usually use the third, rgrep, from "recursive grep". It's a little friendlier, as it prompts the user for the search parameters (search string, file types and directory) one by one, provides customizable defaults, and it automatically ignores some common files and directories you usually don't want to search, like for example .svn or .o files.

Then, there is ack, and its interface for Emacs: ack.el, whose default behavior is similar to rgrep, but can be customized to use the options that ack provides.

kovan
I'm a big fan of rgrep -- it's surprisingly easy to use.
offby1
+2  A: 

Just in case you haven't read it already - there's lots of relevant tips over at the EmacsWiki GrepMode page.

ZungBang
Seems like grep mode is the best thing going, I'm just going to have to whip out the elisp to get it where i want i guess ;)
openist
A: 

Dired mode also lets you do a search through marked files with the dired-do-search function.

And ibuffer lets you do emacs' generic isearch through a bunch of buffers using the awkward key sequence M-s a C-s.

quodlibetor
A: 

I also find dired-mode versatile. I use either dired-mark-files-regexp (%m) or dired-mark-files-containing-regexp to select what should be searched and then dired-do-search (A).

unhillbilly