Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the best Find in File mode for EMACS?

Tags:

emacs

What's 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.

like image 951
math0ne Avatar asked Jan 23 '23 01:01

math0ne


2 Answers

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.

like image 59
kovan Avatar answered Jan 29 '23 01:01

kovan


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

like image 26
ZungBang Avatar answered Jan 29 '23 02:01

ZungBang