@@ -245,7 +245,7 @@ Look at the `php-executable' variable instead of the constant \"php\" command."
245
245
'flymake-php-init )))))
246
246
(list php-executable (cdr init))))
247
247
248
- (defconst php-re-detect-html-tag
248
+ (defconst php-re-detect-html-tag-aggressive
249
249
(eval-when-compile
250
250
(rx (or (: string-start (* (in space))
251
251
" <!"
@@ -257,13 +257,38 @@ Look at the `php-executable' variable instead of the constant \"php\" command."
257
257
(* (in space)) (+ (in alpha " -" )) (* (in space)) " >" ))
258
258
(: " <" (* (in space)) (+ (in alpha " -" )) (* (in space)) " >" ))))))
259
259
260
+ (defconst php-re-detect-html-tag-default
261
+ (eval-when-compile
262
+ (rx (or (: string-start (* (in space))
263
+ " <!"
264
+ (or " DOCTYPE" " doctype" )
265
+ (+ (in space))
266
+ (or " HTML" " html" ))
267
+ (: line-start
268
+ (: " <" (* (in space)) (+ (in alpha " -" )) (* (in space)) " >" ))))))
269
+
270
+ (defcustom php-re-detect-html-tag 'php-re-detect-html-tag-default
271
+ " Regexp pattern variable-name of HTML detection."
272
+ :group 'php
273
+ :tag " PHP Re Detect HTML Tag"
274
+ :type '(choice (const :tag " Default pattern" 'php-re-detect-html-tag-default )
275
+ (const :tag " Aggressive pattern" 'php-re-detect-html-tag-aggressive )
276
+ (variable :tag " Variable name of RegExp pattern" )))
277
+
278
+ (defsubst php-re-detect-html-tag ()
279
+ " Return RegExp pattern for HTML detection."
280
+ (if (symbolp php-re-detect-html-tag)
281
+ (symbol-value php-re-detect-html-tag)
282
+ php-re-detect-html-tag))
283
+
260
284
(defun php-buffer-has-html-tag ()
261
285
" Return position of HTML tag or NIL in current buffer."
262
286
(save-excursion
263
287
(save-restriction
264
288
(widen )
265
289
(goto-char (point-min ))
266
- (re-search-forward php-re-detect-html-tag nil t ))))
290
+ (save-match-data
291
+ (re-search-forward (php-re-detect-html-tag) nil t )))))
267
292
268
293
(defun php-derivation-major-mode ()
269
294
" Return major mode for PHP file by file-name and its content."
0 commit comments