[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How best to set grep command based on current directory?
From: |
Yuri Khan |
Subject: |
Re: How best to set grep command based on current directory? |
Date: |
Sat, 9 Apr 2022 16:22:05 +0700 |
On Sat, 9 Apr 2022 at 08:11, Michael Welsh Duggan <mwd@md5i.com> wrote:
> I would like to change the program invocation in "M-x grep" (or maybe
> "M-x grep-find") to default to "git grep" when in directories that are
> in git trees. I could hack away at the grep.el sources to do this, or I
> could write some advice around the grep command to do this, but I want
> to ask here, first, if anyone believes that there is a more principled
> way to make this change.
I customize grep-command to "git --no-pager grep -nH -E -e ". When not
inside a git repository, or if I want to search untracked files, I
manually add --no-index.