Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save match data in markdown-syntax-propertize-extend-region #105

Merged
merged 1 commit into from
Feb 25, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions markdown-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -1455,19 +1455,20 @@ This helps improve syntax analysis for block constructs.
Returns a cons (NEW-START . NEW-END) or nil if no adjustment should be made.
Function is called repeatedly until it returns nil. For details, see
`syntax-propertize-extend-region-functions'."
(save-excursion
(let* ((new-start (progn (goto-char start)
(if (re-search-backward "\n\n" nil t)
(match-end 0) (point-min))))
(new-end (progn (goto-char end)
(if (re-search-forward "\n\n" nil t)
(match-beginning 0) (point-max))))
(code-match (markdown-code-block-at-pos new-start))
(new-start (or (and code-match (cl-first code-match)) new-start))
(code-match (markdown-code-block-at-pos end))
(new-end (or (and code-match (cl-second code-match)) new-end)))
(unless (and (eq new-start start) (eq new-end end))
(cons new-start new-end)))))
(save-match-data
(save-excursion
(let* ((new-start (progn (goto-char start)
(if (re-search-backward "\n\n" nil t)
(match-end 0) (point-min))))
(new-end (progn (goto-char end)
(if (re-search-forward "\n\n" nil t)
(match-beginning 0) (point-max))))
(code-match (markdown-code-block-at-pos new-start))
(new-start (or (and code-match (cl-first code-match)) new-start))
(code-match (markdown-code-block-at-pos end))
(new-end (or (and code-match (cl-second code-match)) new-end)))
(unless (and (eq new-start start) (eq new-end end))
(cons new-start new-end))))))

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