diff options
author | Martin Polden <mpolden@mpolden.no> | 2021-08-26 21:31:50 +0200 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2021-08-26 21:31:50 +0200 |
commit | 52f92cda84f29a67f5e333e2b4ca1762c5e176bb (patch) | |
tree | 06a0bbf2dc0c58ca2889df1ba856cd050cff6727 /lisp/init-grep.el | |
parent | c21a10a6f69cab0968ea6ef51d59f3d171478115 (diff) |
grep: Consider current project before Git repository
Diffstat (limited to 'lisp/init-grep.el')
-rw-r--r-- | lisp/init-grep.el | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lisp/init-grep.el b/lisp/init-grep.el index 4e5044f..871fbf3 100644 --- a/lisp/init-grep.el +++ b/lisp/init-grep.el @@ -14,10 +14,11 @@ This is only used when running grep in a Git repository.") This tries to use either rg or git grep if available, and otherwise falls back to regular grep." (interactive) - (let* ((git-root-dir (locate-dominating-file default-directory ".git")) - (dir (or git-root-dir default-directory)) + (let* ((project-dir (or (cdr (project-current)) + (locate-dominating-file default-directory ".git"))) + (dir (or project-dir default-directory)) (use-rg (executable-find "rg")) - (use-git (and git-root-dir (executable-find "git"))) + (use-git (and project-dir (executable-find "git"))) (grep-template (cond (use-rg mpolden/rg-template) (use-git mpolden/git-grep-template)))) (grep-apply-setting 'grep-template grep-template) |