Emacs use variable if set in grep-find -


i'm looking way launch grep-find specific location if variable set. i'm thinking like:

  1. launch emacs /home/user/mycode/
  2. open file(s) in e.g. /home/user/mycode/a/b/c/
  3. 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

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -