Reputation: 1802
I would like to be able to easily repeat a find-grep. Ideally, it would work on recompile, which is what the g char runs. But at least when I run find-grep, it should start with the string that I last used in the same session, as a default. I have searched, but not found... Kind of ironic to be searching for an answer about searching...
Upvotes: 2
Views: 438
Reputation: 30699
Doesn't g
do what you request already? For me it does.
But I'm talking about find-grep-dired
, which might be useful for what you want to do.
I use find-dired+.el
, in addition to vanilla find-dired.el
. But I think that the latter probably does the right thing too.
Here's the doc string of find-grep-dired
from find-dired+.el
:
find-grep-dired is an interactive Lisp function in `find-dired+.el'.
(find-grep-dired DIR REGEXP &optional DEPTH-LIMITS EXCLUDED-PATHS)
Find files in DIR containing a regexp REGEXP.
The output is in a Dired buffer.
The `find' command run (after changing into DIR) is essentially this,
where LS-SWITCHES is `(car find-ls-option)':
find . -exec grep find-grep-options REGEXP {} \; LS-SWITCHES
Thus REGEXP can also contain additional grep options.
Optional arg DEPTH-LIMITS is a list (MIN-DEPTH MAX-DEPTH) of the
minimum and maximum depths. If nil, search directory tree under DIR.
Optional arg EXCLUDED-PATHS is a list of strings that match paths to
exclude from the search. If nil, search all directories.
When both optional args are non-nil, the `find' command run is this:
find . -mindepth MIN-DEPTH -maxdepth MAX-DEPTH
\( -path *edir1* -o -path *edir2* ... \)
-prune -o -exec grep find-grep-options REGEXP {} \;
LS-SWITCHES
Upvotes: 2