Skip to content

Commit b4742ba

Browse files
authored
Merge pull request #670 from emacs-php/optimize/php-c-at-vsemi-p
Optimize php-in-string-or-comment-p
2 parents fb314f2 + 770db0a commit b4742ba

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

lisp/php-mode.el

+12-14
Original file line numberDiff line numberDiff line change
@@ -906,19 +906,18 @@ This is was done due to the problem reported here:
906906
(if pos
907907
(goto-char pos)
908908
(setq pos (point)))
909-
(unless (php-in-string-or-comment-p)
910-
(or
911-
;; Detect PHP8 attribute: <<Attribute()>>
912-
(when (and (< 1 pos) (< 1 (- pos (c-point 'bol))))
913-
(backward-char 1)
914-
(looking-at-p (eval-when-compile (rx "]" (* (syntax whitespace)) (or "#[" line-end)))))
915-
;; Detect HTML/XML tag and PHP tag (<?php, <?=, ?>)
916-
(when php-mode-template-compatibility
917-
(beginning-of-line)
918-
(looking-at-p
919-
(eval-when-compile
920-
(rx (or (: bol (0+ space) "<" (in "a-z\\?"))
921-
(: (0+ not-newline) (in "a-z\\?") ">" (0+ space) eol))))))))))
909+
(cond
910+
;; Detect PHP8 attribute: #[Attribute()]
911+
((and (< 1 pos) (< 1 (- pos (c-point 'bol))))
912+
(backward-char 1)
913+
(looking-at-p (eval-when-compile (rx "]" (* (syntax whitespace)) (or "#[" line-end)))))
914+
;; Detect HTML/XML tag and PHP tag (<?php, <?=, ?>)
915+
(php-mode-template-compatibility
916+
(beginning-of-line)
917+
(looking-at-p
918+
(eval-when-compile
919+
(rx (or (: bol (0+ space) "<" (in "?a-z"))
920+
(: (0+ not-newline) (in "?a-z") ">" (0+ space) eol)))))))))
922921

923922
(defun php-c-vsemi-status-unknown-p ()
924923
"Always return NIL. See `c-vsemi-status-unknown-p'."
@@ -1516,7 +1515,6 @@ The output will appear in the buffer *PHP*."
15161515
'php-mode
15171516
`((php-string-intepolated-variable-font-lock-find))
15181517
'append)))
1519-
15201518

15211519

15221520
;;; Correct the behavior of `delete-indentation' by modifying the

0 commit comments

Comments
 (0)