aboutsummaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
authorYuchen Pei <id@ypei.org>2023-08-01 09:37:33 +1000
committerYuchen Pei <id@ypei.org>2023-08-01 09:37:33 +1000
commit66aac92722ec86788367749aa25214a0baaa89a6 (patch)
treebb8b926e7a25a5566cc87fa6084399d1f4fd61e9 /emacs
parentbd7c33b39527f3cea1c7f5270fc60a979357a318 (diff)
minor consult grep changes
Diffstat (limited to 'emacs')
-rw-r--r--emacs/.emacs.d/init/ycp-complete.el4
-rw-r--r--emacs/.emacs.d/lisp/my/my-consult.el18
-rw-r--r--emacs/.emacs.d/lisp/my/my-wikipedia.el1
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