summaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
authorThomas Voss <thomas.voss@humanwave.nl> 2026-02-09 13:18:56 +0100
committerThomas Voss <thomas.voss@humanwave.nl> 2026-02-09 13:18:56 +0100
commit3978f6b555f765ddb2bb5c539e2e881d3ad31078 (patch)
tree69035d88da7c7062982c8a3002c1a56a750c931f /.config
parent4df49b1a68a1c5a17f9da209723622e7d12ad283 (diff)
emacs: Support case-(in)sensitive project regexp
Diffstat (limited to '.config')
-rw-r--r--.config/emacs/modules/mm-keybindings.el5
-rw-r--r--.config/emacs/modules/mm-search.el31
2 files changed, 35 insertions, 1 deletions
diff --git a/.config/emacs/modules/mm-keybindings.el b/.config/emacs/modules/mm-keybindings.el
index f7038ea..e9999ad 100644
--- a/.config/emacs/modules/mm-keybindings.el
+++ b/.config/emacs/modules/mm-keybindings.el
@@ -90,6 +90,11 @@ the first command is remapped to the second command."
open-line e/open-line
yank e/yank)
+(with-eval-after-load 'project
+ (mm-keymap-remap project-prefix-map
+ project-find-regexp mm-project-find-regexp
+ project-or-external-find-regexp mm-project-or-external-find-regexp))
+
(with-eval-after-load 'cc-vars
(setopt c-backspace-function #'backward-delete-char))
diff --git a/.config/emacs/modules/mm-search.el b/.config/emacs/modules/mm-search.el
index 9de1eed..9b1c4c4 100644
--- a/.config/emacs/modules/mm-search.el
+++ b/.config/emacs/modules/mm-search.el
@@ -17,4 +17,33 @@
(lazy-count-prefix-format "(%s/%s) ")
(isearch-repeat-on-direction-change t))
-(provide 'mm-search) \ No newline at end of file
+(defun mm--project-find-wrapper (command regexp)
+ (let (csf)
+ (cond ((string-suffix-p "/i" regexp)
+ (setq regexp (string-remove-suffix "/i" regexp)
+ csf t))
+ ((string-suffix-p "/I" regexp)
+ (setq regexp (string-remove-suffix "/I" regexp)
+ csf nil))
+ (:else
+ (setq csf case-fold-search)))
+ (let ((case-fold-search csf))
+ (funcall-interactively command regexp))))
+
+(defun mm-project-find-regexp (regexp)
+ "Find all matches for REGEXP in the current project’s roots.
+This is a thin wrapper around `project-find-regexp' that supports the
+`/i' and `/I' suffixes to enable and disable case-sensitive matching
+respectively."
+ (interactive (list (project--read-regexp)))
+ (mm--project-find-wrapper #'project-find-regexp regexp))
+
+(defun mm-project-or-external-find-regexp (regexp)
+ "Find all matches for REGEXP in the project roots or external roots.
+This is a thin wrapper around `project-or-external-find-regexp' that
+supports the `/i' and `/I' suffixes to enable and disable case-sensitive
+matching respectively."
+ (interactive (list (project--read-regexp)))
+ (mm--project-find-wrapper #'project-or-external-find-regexp regexp))
+
+(provide 'mm-search)