diff options
author | Yuchen Pei <id@ypei.org> | 2023-08-01 09:37:33 +1000 |
---|---|---|
committer | Yuchen Pei <id@ypei.org> | 2023-08-01 09:37:33 +1000 |
commit | 66aac92722ec86788367749aa25214a0baaa89a6 (patch) | |
tree | bb8b926e7a25a5566cc87fa6084399d1f4fd61e9 /emacs/.emacs.d/lisp/my/my-consult.el | |
parent | bd7c33b39527f3cea1c7f5270fc60a979357a318 (diff) |
minor consult grep changes
Diffstat (limited to 'emacs/.emacs.d/lisp/my/my-consult.el')
-rw-r--r-- | emacs/.emacs.d/lisp/my/my-consult.el | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/emacs/.emacs.d/lisp/my/my-consult.el b/emacs/.emacs.d/lisp/my/my-consult.el index 706dae5..aa71ac6 100644 --- a/emacs/.emacs.d/lisp/my/my-consult.el +++ b/emacs/.emacs.d/lisp/my/my-consult.el @@ -27,14 +27,22 @@ ;;; Code: (defun my-consult-grep-default () - "Like `consult-grep', but grepping the default directory." + "Call `consult-git-grep' or `consult-grep' on default directory. + +...depending whether we are in the git repo." (interactive) - (consult-grep default-directory nil)) + (if (vc-git-root (buffer-file-name)) + (consult-git-grep default-directory nil) + (consult-grep default-directory nil))) + +(defun my-consult-grep () + "Call `consult-git-grep' or `consult-grep'. -(defun my-consult-git-grep-default () - "Like `consult-grep', but grepping the default directory." +...depending whether we are in the git repo." (interactive) - (consult-git-grep default-directory nil)) + (if (vc-git-root (buffer-file-name)) + (consult-git-grep) + (consult-grep))) (provide 'my-consult) ;;; my-consult.el ends here |