@@ -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,37 @@ 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
+ :type '(choice (const 'php-re-detect-html-tag-default :tag " Default pattern" )
274
+ (const 'php-re-detect-html-tag-aggressive :tag " Aggressive pattern" )
275
+ (variable :tag " Variable name of RegExp pattern" )))
276
+
277
+ (defsubst php-re-detect-html-tag ()
278
+ " Return RegExp pattern for HTML detection."
279
+ (if (symbolp php-re-detect-html-tag)
280
+ (symbol-value php-re-detect-html-tag)
281
+ php-re-detect-html-tag))
282
+
260
283
(defun php-buffer-has-html-tag ()
261
284
" Return position of HTML tag or NIL in current buffer."
262
285
(save-excursion
263
286
(save-restriction
264
287
(widen )
265
288
(goto-char (point-min ))
266
- (re-search-forward php-re-detect-html-tag nil t ))))
289
+ (save-match-data
290
+ (re-search-forward (php-re-detect-html-tag) nil t )))))
267
291
268
292
(defun php-derivation-major-mode ()
269
293
" Return major mode for PHP file by file-name and its content."
0 commit comments