From d01b3db1383d6b967455782b8668ed3a3f9c22b1 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Mon, 13 Apr 2026 14:48:21 -0700 Subject: oni-php: Fix up inserting ‘->’ vs ‘::’ When we're looking at a ‘)’ it should be ‘->’ since we can't return a static class in that case. --- oni-php/oni-php.el | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'oni-php') diff --git a/oni-php/oni-php.el b/oni-php/oni-php.el index 612d645..1415d2b 100644 --- a/oni-php/oni-php.el +++ b/oni-php/oni-php.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2026.0406.154601 +;; Version: 2026.0407.170526 ;; Package-Requires: (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 @@ -122,8 +122,7 @@ nil for some reason." Do the insert N times." (interactive "p") - (if (or (char-equal ?\ (char-before (point))) - (oni-php--in-string-or-comment-p) + (if (or (oni-php--in-string-or-comment-p) (save-excursion (skip-syntax-backward " ") (nth 3 (syntax-ppss (1- (point))))) @@ -131,8 +130,8 @@ Do the insert N times." (skip-syntax-forward " ") (nth 3 (syntax-ppss (1+ (point)))))) (self-insert-command N) - (let ((op (if (looking-back (rx "$" (minimal-match (one-or-more (any alnum "->")))) - (line-beginning-position)) + (let ((op (if (looking-back (rx (or "$" ")") (zero-or-more (any whitespace "\n" alnum "(" ")" "->"))) + (save-excursion (backward-paragraph) (point))) "->" "::"))) (dotimes (_ N) (insert op))))) -- cgit v1.3-2-g0d8e