emacsgrep

Is there a mode or some way to use grep inside emacs then jump to the referenced?


I'm looking for a useful way to use grep from inside emacs. I generally run a grep command to find references in the source tree and then use emacs to open the file and then jump to the line indicated with the -n flag to grep. However, I'm guessing with emacs I could do better. It would be nice if the resulting view maintained the colorization provided by normal grep in the terminal. Granted this wouldn't be universal, but at least the intent.

Is there a mode or some way to use grep inside emacs then jump to the referenced?


Solution

  • Believe it or not, M-x grep and M-x rgrep (r for recursive) are already there - and can be accessed from menu Tools --> Search files (Grep).

    See 27.4 Searching with Grep under Emacs.

    You might also find M-x dired-do-find-regexp-and-replace and M-x project-query-regexp useful.