@@ -284,6 +284,15 @@ In that case set to `NIL'."
284
284
:tag " PHP Mode Enable Project Local Variable"
285
285
:type 'boolean )
286
286
287
+ (defcustom php-mode-syntax-propertize-extend-region-limit (* 100 syntax-propertize-chunk-size)
288
+ " Boundary value of the number of search characters to propertize syntax.
289
+
290
+ Smaller values can improve performance with large buffers.
291
+ If the value is too small, the syntax will not be displayed properly."
292
+ :group 'php-mode
293
+ :tag " PHP Mode Syntax Propertize Extend Region Limit"
294
+ :type 'integer )
295
+
287
296
(defconst php-mode-cc-vertion
288
297
(eval-when-compile c-version))
289
298
@@ -987,22 +996,24 @@ this ^ lineup"
987
996
988
997
(defun php-syntax-propertize-extend-region (start end )
989
998
" Extend the propertize region if START or END falls inside a PHP heredoc."
990
- (let ((pair (cons start end)))
999
+ (let ((pair (cons start end))
1000
+ (limit (max syntax-propertize-chunk-size php-mode-syntax-propertize-extend-region-limit))
1001
+ new-start new-end maybe)
991
1002
(when (not (member pair php-mode--propertize-extend-region-current))
992
1003
; ; re-search functions may trigger
993
1004
; ; syntax-propertize-extend-region-functions to be called again, which in
994
1005
; ; turn call this to be called again.
995
1006
(push pair php-mode--propertize-extend-region-current)
996
1007
(unwind-protect
997
- (let (new-start new-end)
1008
+ (progn
998
1009
(goto-char start)
999
- (when (re-search-backward php-heredoc-start-re nil t )
1000
- (let (( maybe (point ) ))
1001
- (when (and (re-search-forward (php-heredoc-end-re (match-string 0 )) nil t )
1002
- (> (point ) start))
1003
- (setq new-start maybe) )))
1010
+ (when (re-search-backward php-heredoc-start-re limit t )
1011
+ (setq maybe (point ))
1012
+ (when (and (re-search-forward (php-heredoc-end-re (match-string 0 )) nil t )
1013
+ (> (point ) start))
1014
+ (setq new-start maybe)))
1004
1015
(goto-char end)
1005
- (when (re-search-backward php-heredoc-start-re nil t )
1016
+ (when (re-search-backward php-heredoc-start-re limit t )
1006
1017
(if (re-search-forward (php-heredoc-end-re (match-string 0 )) nil t )
1007
1018
(when (> (point ) end)
1008
1019
(setq new-end (point )))
0 commit comments