Emacs use variable if set in grep-find -
i'm looking way launch grep-find specific location if variable set. i'm thinking like:
- launch emacs /home/user/mycode/
- open file(s) in e.g. /home/user/mycode/a/b/c/
- run grep-find /home/user/mycode/
i know works if first open /home/user/mycode/ directory , runs grep-find want stored variable instead. (if variable not set fine search current location)
my grep-find looks this:
(setq grep-find-command "find . '(' -type f ')' -print0 | xargs -0 -e grep -n -e ")
it seems me benefit projectile.
it need. has recursive grep command launches parent directory (it can use git-grep or ag, lot faster grep), , offers lot more. can work multiple projects @ once (projectile smart way).
you can @ projectile here: https://github.com/bbatsov/projectile
it available via melpa
if not want use (or similar alternatives), advise wrapping recursive grep command in custom function this:
(defun rgrep-at-repo-base (...) (interactive) (with-temp-buffer (while (and (not (file-exists-p ".git/")) (not (equal "/" default-directory))) (cd "..")) (rgrep ...)))
where should change logic finding code base current directory (example works git repos) , set arguments need (if any)
Comments
Post a Comment