From 66aac92722ec86788367749aa25214a0baaa89a6 Mon Sep 17 00:00:00 2001
From: Yuchen Pei <id@ypei.org>
Date: Tue, 1 Aug 2023 09:37:33 +1000
Subject: minor consult grep changes

---
 emacs/.emacs.d/init/ycp-complete.el    |  4 ++--
 emacs/.emacs.d/lisp/my/my-consult.el   | 18 +++++++++++++-----
 emacs/.emacs.d/lisp/my/my-wikipedia.el |  1 -
 3 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/emacs/.emacs.d/init/ycp-complete.el b/emacs/.emacs.d/init/ycp-complete.el
index 3f2a72c..29bdaf7 100644
--- a/emacs/.emacs.d/init/ycp-complete.el
+++ b/emacs/.emacs.d/init/ycp-complete.el
@@ -224,8 +224,8 @@
     "M-F" #'consult-focus-lines           ; same principle
     "M-s M-b" #'consult-buffer
     "M-s M-f" #'consult-find
-    "M-s M-G" #'consult-git-grep
-    "M-s M-g" #'my-consult-git-grep-default
+    "M-s M-G" #'my-consult-grep
+    "M-s M-g" #'my-consult-grep-default
     "M-s M-h" #'consult-history
     "M-s M-i" #'consult-imenu
     "M-s M-l" #'consult-line
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
diff --git a/emacs/.emacs.d/lisp/my/my-wikipedia.el b/emacs/.emacs.d/lisp/my/my-wikipedia.el
index af954bf..45d00e2 100644
--- a/emacs/.emacs.d/lisp/my/my-wikipedia.el
+++ b/emacs/.emacs.d/lisp/my/my-wikipedia.el
@@ -30,7 +30,6 @@
 (require 'my-utils)
 (require 'my-markup)
 (require 'my-net)
-(require 'my-mediawiki)
 (require 'wiki)
 
 ;; TODO: much of these can be generalised to any mediawiki site
-- 
cgit v1.2.3