aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemse2026-05-05 11:42:54 -0700
committerGravatar Tom Willemse2026-05-05 11:42:54 -0700
commit44db437bae9e1f4f6a221755305aca85c1a5316c (patch)
tree39c070fce59212312764809e97c0d49a7fee5692
parent2d8e3c917d24894071f81913052d49eba858107a (diff)
downloademacs-config-44db437bae9e1f4f6a221755305aca85c1a5316c.tar.gz
emacs-config-44db437bae9e1f4f6a221755305aca85c1a5316c.zip
oni-php: oni-php-grep-symbol: If region is active, grep that instead
-rw-r--r--oni-php/oni-php.el9
1 files changed, 8 insertions, 1 deletions
diff --git a/oni-php/oni-php.el b/oni-php/oni-php.el
index 1415d2b..e895c3b 100644
--- a/oni-php/oni-php.el
+++ b/oni-php/oni-php.el
@@ -313,7 +313,14 @@ Otherwise call FUNC with ARGS. This is meant as advice around
(looking-back "::\\w+" (- (point) (line-beginning-position))))
(defun oni-php-grep-symbol (symbol)
- (interactive (list (thing-at-point 'symbol)))
+ "Use ‘rgrep’ to find SYMBOL.
+If there is an active region when this command is called interactively
+SYMBOL will be the text in the region. Otherwise it's the symbol at
+point."
+ (interactive (list
+ (if (region-active-p)
+ (buffer-substring-no-properties (region-beginning) (region-end))
+ (thing-at-point 'symbol))))
(rgrep (rx (literal symbol))
(map-elt grep-files-aliases "php")
(project-root (project-current))))