Skip to content

Commit d8b42c8

Browse files
committed
Refactor HTML/XML/PHP tag detection in php-c-at-vsemi-p
1 parent 39f4306 commit d8b42c8

File tree

1 file changed

+12
-22
lines changed

1 file changed

+12
-22
lines changed

php-mode.el

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -885,29 +885,19 @@ POS is a position on the line in question.
885885
This is was done due to the problem reported here:
886886
887887
URL `https://answers.launchpad.net/nxhtml/+question/43320'"
888-
(if (not php-template-compatibility)
889-
nil
890-
(setq pos (or pos (point)))
891-
(let ((here (point))
892-
ret)
893-
(save-match-data
888+
(save-excursion
889+
(if pos
894890
(goto-char pos)
895-
(beginning-of-line)
896-
(setq ret (looking-at
897-
(rx
898-
(or (seq
899-
bol
900-
(0+ space)
901-
"<"
902-
(in "a-z\\?"))
903-
(seq
904-
(0+ not-newline)
905-
(in "a-z\\?")
906-
">"
907-
(0+ space)
908-
eol))))))
909-
(goto-char here)
910-
ret)))
891+
(setq pos (point)))
892+
(unless (php-in-string-or-comment-p)
893+
(or
894+
;; Detect HTML/XML tag and PHP tag (<?php, <?=, ?>)
895+
(when php-mode-template-compatibility
896+
(beginning-of-line)
897+
(looking-at-p
898+
(eval-when-compile
899+
(rx (or (: bol (0+ space) "<" (in "a-z\\?"))
900+
(: (0+ not-newline) (in "a-z\\?") ">" (0+ space) eol))))))))))
911901

912902
(defun php-c-vsemi-status-unknown-p ()
913903
"Always return NIL. See `php-c-at-vsemi-p'."

0 commit comments

Comments
 (0)