4 ms·
Quite a few ways. 1. Start with M-x rgrep, it may do everything you need. 2. If not, M-x find-grep lets you run arbitrary grep commands. You may wish to custo
by gcv 17y ago
Quite a few ways.
1. Start with M-x rgrep, it may do everything you need.
2. If not, M-x find-grep lets you run arbitrary grep commands. You may wish to customize grep-find-command to some reasonable default, e.g., mine:
(setq grep-find-command
(concatenate
'string
"find . \\( -path '*.svn' -o -path '*.git' -o -path '*.hg' \\)"
" "
"-prune -o -type f -print0 | xargs -0 grep -I -i -n -e "))
3. If you want to just search open buffers, you may find M-x multi-occur-in-matching-buffers useful. I use this simple wrapper, which you invoke using M-x search-all-buffers:
(defun search-all-buffers (regexp)
(interactive "sRegexp: ")
(multi-occur-in-matching-buffers "." regexp t))
4. You may find filtering files and query-based search replace useful, in which case you should try dired-mode. It does a lot, so try marking files (look in the Mark menu for various options), then operate on them (Operate menu). For example, hit "% m" to mark files by name regex, type "\.[c|h]" to mark all C and header files, then press "Q" to start interactive search-and-replace through all marked files.
5. I don't know of a direct equivalent to Nice Find, e.g., basing a search on "git grep" output, but if you look through the various Git modes, you may find something useful.
- philjackson 17y agoAs a side note; check out find-cmd.el (comes with 23).
- mechanical_fish 17y agoAnd, amazingly, you managed to get through this whole list without mentioning igrep-find, which is what I've been using: http://www.emacswiki.org/cgi-bin/wiki/igrep.el http://www.emacswiki.org/cgi-bin/wiki/igrep.el A lot of people have attacked the grep problem in emacs.