File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -1038,17 +1038,24 @@ HEREDOC-START."
10381038 (unwind-protect
10391039 (let (new-start new-end)
10401040 (goto-char start)
1041+ ; ; Consider bounding this backwards search by `beginning-of-defun' .
1042+ ; ; (Benchmarking for a wide range of cases may be needed to decide
1043+ ; ; whether that's an improvement, as `php-beginning-of-defun' also
1044+ ; ; uses `re-search-backward' .)
10411045 (when (re-search-backward php-heredoc-start-re nil t )
10421046 (let ((maybe (point )))
10431047 (when (and (re-search-forward (php-heredoc-end-re (match-string 0 )) nil t )
10441048 (> (point ) start))
1045- (setq new-start maybe))))
1046- (goto-char end)
1047- (when (re-search-backward php-heredoc-start-re nil t )
1048- (if (re-search-forward (php-heredoc-end-re (match-string 0 )) nil t )
1049+ (setq new-start maybe)
10491050 (when (> (point ) end)
1050- (setq new-end (point )))
1051- (setq new-end (point-max ))))
1051+ (setq new-end (point ))))))
1052+ (unless new-end
1053+ (goto-char end)
1054+ (when (re-search-backward php-heredoc-start-re start t )
1055+ (if (re-search-forward (php-heredoc-end-re (match-string 0 )) nil t )
1056+ (when (> (point ) end)
1057+ (setq new-end (point )))
1058+ (setq new-end (point-max )))))
10521059 (when (or new-start new-end)
10531060 (cons (or new-start start) (or new-end end))))
10541061 ; ; Cleanup
You can’t perform that action at this time.
0 commit comments