aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemse2026-02-09 12:12:37 -0800
committerGravatar Tom Willemse2026-02-09 12:12:37 -0800
commit7e7c283528f28c24bdf1c9449e787072f8bf8d8b (patch)
tree07dbb13ecc59096cd5f12c3ecdd0165e8f1607b2
parent28250f8a1d54937d128159ae8b7e21c1ab1aa7f7 (diff)
downloademacs-config-master.tar.gz
emacs-config-master.zip
oni-php: ‘oni-php-add-use’: Search for existing use more strictlyHEADmaster
Before searching for ‘App\Models\Promotion’ would also match ‘App\Models\PromotionBulkImport’ and not add the use, but by searching for ‘use App\Models\Promotion;’ we ensure that we don't accidentally match a substring.
-rw-r--r--oni-php/oni-php.el4
1 files changed, 2 insertions, 2 deletions
diff --git a/oni-php/oni-php.el b/oni-php/oni-php.el
index 88af7af..fd12545 100644
--- a/oni-php/oni-php.el
+++ b/oni-php/oni-php.el
@@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
-;; Version: 2026.0107.143829
+;; Version: 2026.0209.115456
;; Package-Requires: (php-mode oni-yasnippet oni-flycheck oni-company oni-hydra oni-smartparens ggtags fic-mode company-php rainbow-delimiters rainbow-identifiers)
;; This program is free software; you can redistribute it and/or modify
@@ -97,7 +97,7 @@ nil for some reason."
(forward-line)
(insert "\n"))
- (unless (search-backward class nil t)
+ (unless (re-search-backward (rx "use " (literal class) ";") nil t)
(let ((start (point)))
(insert "use " class ";\n")
(pulse-momentary-highlight-region start (point)))))))