I want to search in all files from the current folder for macro CODE_INIT_PARAMETERS.
I can do Alt + X occur, Return CODE_INIT_PARAMETERS Return, but this shows only entries from open buffers.
Is there a way to search all files from current folder, from Emacs, without switching to M-x shell and then grep? I want to avoid grep, because for some commands (M-x occur) Emacs do jumps to offending code, and I want that too.
To use a more straightforward search, type C-s RETURN or select Search from the Search menu. Type the search string, press RETURN, and Emacs begins the search. Simply press C-s again to repeat the search.
To run grep , type M-x grep , then enter a command line that specifies how to run grep . Use the same arguments you would give grep when running it normally: a grep -style regexp (usually in single-quotes to quote the shell's special characters) followed by file names, which may use wildcards.
You can try M-x rgrep
.
It will ask for:
As an extra, it will exclude source control private directories from your search (like CVS, .svn or .git).
Emacs provides a built-in command:
M-x grep RET CODE_INIT_PARAMETERS *.c
(and 'grep-find
to search sub directories)
Though I prefer the interface provided by an external package igrep
(which provides the commands igrep
and igrep-find
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With