Skip to content

Commit a2a1b5f

Browse files
committed
Save match data in markdown-syntax-propertize-extend-region
1 parent f7d7983 commit a2a1b5f

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

markdown-mode.el

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,19 +1455,20 @@ This helps improve syntax analysis for block constructs.
14551455
Returns a cons (NEW-START . NEW-END) or nil if no adjustment should be made.
14561456
Function is called repeatedly until it returns nil. For details, see
14571457
`syntax-propertize-extend-region-functions'."
1458-
(save-excursion
1459-
(let* ((new-start (progn (goto-char start)
1460-
(if (re-search-backward "\n\n" nil t)
1461-
(match-end 0) (point-min))))
1462-
(new-end (progn (goto-char end)
1463-
(if (re-search-forward "\n\n" nil t)
1464-
(match-beginning 0) (point-max))))
1465-
(code-match (markdown-code-block-at-pos new-start))
1466-
(new-start (or (and code-match (cl-first code-match)) new-start))
1467-
(code-match (markdown-code-block-at-pos end))
1468-
(new-end (or (and code-match (cl-second code-match)) new-end)))
1469-
(unless (and (eq new-start start) (eq new-end end))
1470-
(cons new-start new-end)))))
1458+
(save-match-data
1459+
(save-excursion
1460+
(let* ((new-start (progn (goto-char start)
1461+
(if (re-search-backward "\n\n" nil t)
1462+
(match-end 0) (point-min))))
1463+
(new-end (progn (goto-char end)
1464+
(if (re-search-forward "\n\n" nil t)
1465+
(match-beginning 0) (point-max))))
1466+
(code-match (markdown-code-block-at-pos new-start))
1467+
(new-start (or (and code-match (cl-first code-match)) new-start))
1468+
(code-match (markdown-code-block-at-pos end))
1469+
(new-end (or (and code-match (cl-second code-match)) new-end)))
1470+
(unless (and (eq new-start start) (eq new-end end))
1471+
(cons new-start new-end))))))
14711472

14721473
(defun markdown-font-lock-extend-region-function (start end _)
14731474
"Used in `jit-lock-after-change-extend-region-functions'. Delegates to

0 commit comments

Comments
 (0)