@@ -660,13 +660,14 @@ but only if the setting is enabled."
660
660
'+ )
661
661
(t nil )))))))
662
662
663
- (defun php-c-looking-at-or-maybe-in-bracelist (&optional _containing -sexp lim )
663
+ (defun php-c-looking-at-or-maybe-in-bracelist (orig-fun &optional containing -sexp lim )
664
664
" Replace `c-looking-at-or-maybe-in-bracelist' .
665
665
666
666
CONTAINING-SEXP is the position of the brace/paren/bracket enclosing
667
667
POINT, or nil if there is no such position, or we do not know it. LIM is
668
668
a backward search limit."
669
669
(cond
670
+ ((not (derived-mode-p 'php-mode )) (apply orig-fun containing-sexp lim args))
670
671
((looking-at-p " {" )
671
672
(save-excursion
672
673
(c-backward-token-2 2 t lim)
@@ -1208,7 +1209,7 @@ After setting the stylevars run hook `php-mode-STYLENAME-hook'."
1208
1209
(progn
1209
1210
(add-hook 'hack-local-variables-hook #'php-mode-set-style-delay t t )
1210
1211
(setq php-mode--delayed-set-style t )
1211
- (advice-add # 'c-set-style :after #'php-mode--disable-delay-set-style '(local) ))
1212
+ (advice-add 'c-set-style :after #'php-mode--disable-delay-set-style ))
1212
1213
(let ((php-mode-enable-backup-style-variables nil ))
1213
1214
(php-set-style (symbol-name php-mode-coding-style))))
1214
1215
@@ -1242,15 +1243,12 @@ After setting the stylevars run hook `php-mode-STYLENAME-hook'."
1242
1243
php-mode-replace-flymake-diag-function)
1243
1244
(add-hook 'flymake-diagnostic-functions php-mode-replace-flymake-diag-function nil t ))
1244
1245
1245
- (when (fboundp 'c-looking-at-or-maybe-in-bracelist )
1246
- (advice-add #'c-looking-at-or-maybe-in-bracelist
1247
- :override 'php-c-looking-at-or-maybe-in-bracelist '(local)))
1248
- (advice-add #'fixup-whitespace :after #'php-mode--fixup-whitespace-after '(local))
1246
+ (advice-add 'c-looking-at-or-maybe-in-bracelist
1247
+ :around 'php-c-looking-at-or-maybe-in-bracelist )
1248
+ (advice-add 'fixup-whitespace :after #'php-mode--fixup-whitespace-after )
1249
1249
1250
- (when (fboundp #'acm-backend-tabnine-candidate-expand )
1251
- (advice-add #'acm-backend-tabnine-candidate-expand
1252
- :filter-args #'php-acm-backend-tabnine-candidate-expand-filter-args
1253
- '(local)))
1250
+ (advice-add 'acm-backend-tabnine-candidate-expand
1251
+ :filter-args #'php-acm-backend-tabnine-candidate-expand-filter-args )
1254
1252
1255
1253
(when (>= emacs-major-version 25 )
1256
1254
(with-silent-modifications
@@ -1558,22 +1556,25 @@ The output will appear in the buffer *PHP*."
1558
1556
; ;; logic of `fixup-whitespace' .
1559
1557
(defun php-mode--fixup-whitespace-after ()
1560
1558
" Remove whitespace before certain characters in PHP Mode."
1561
- (when (or (looking-at-p " \\ (?:;\\ |,\\ |->\\ |::\\ )" )
1562
- (save-excursion
1563
- (forward-char -2 )
1564
- (looking-at-p " ->\\ |::" )))
1559
+ (when (and (derived-mode-p 'php-mode )
1560
+ (or (looking-at-p " \\ (?:;\\ |,\\ |->\\ |::\\ )" )
1561
+ (save-excursion
1562
+ (forward-char -2 )
1563
+ (looking-at-p " ->\\ |::" ))))
1565
1564
(delete-char 1 )))
1566
1565
1567
1566
; ; Advice for lsp-bridge' acm-backend-tabnine
1568
1567
; ; see https://github.com/manateelazycat/lsp-bridge/issues/402#issuecomment-1305653058
1569
1568
(defun php-acm-backend-tabnine-candidate-expand-filter-args (args )
1570
1569
" Adjust to replace bound-start ARGS for Tabnine in PHP."
1571
- (cl-multiple-value-bind (candidate-info bound-start) args
1572
- (save-excursion
1573
- (goto-char bound-start)
1574
- (when (looking-at-p (eval-when-compile (regexp-quote " $" )))
1575
- (setq bound-start (1+ bound-start))))
1576
- (list candidate-info bound-start)))
1570
+ (if (not (derived-mode-p 'php-mode ))
1571
+ args
1572
+ (cl-multiple-value-bind (candidate-info bound-start) args
1573
+ (save-excursion
1574
+ (goto-char bound-start)
1575
+ (when (looking-at-p (eval-when-compile (regexp-quote " $" )))
1576
+ (setq bound-start (1+ bound-start))))
1577
+ (list candidate-info bound-start))))
1577
1578
1578
1579
;;;### autoload
1579
1580
(progn
0 commit comments