branch: externals/auctex commit 2ca3d1856a033ee748a8b4a2edf99aa2640ada3d Author: Ikumi Keita <ik...@ikumi.que.jp> Commit: Ikumi Keita <ik...@ikumi.que.jp>
Fix slowdown of font lock in doctex mode `texmathp' limits search by looking for empty lines, which appear frequently in LaTeX documents. However, docTeX documents often lack such true empty lines. In such buffer, `texmathp' must search from (point-min) every time, which slowed down font lock operation siginificantly. * texmathp.el (texmathp): Adjust regular expression so that a line containing only whitespaces except consecutive %'s at its beginning is considered as empty in doctex mode buffer. --- texmathp.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/texmathp.el b/texmathp.el index ac2b75c..b0fd02d 100644 --- a/texmathp.el +++ b/texmathp.el @@ -274,7 +274,10 @@ See the variable `texmathp-tex-commands' about which commands are checked." (interactive) (let* ((pos (point)) math-on sw-match (bound (save-excursion - (if (re-search-backward "[\n\r][ \t]*[\n\r]" + (if (re-search-backward + (if (eq major-mode 'doctex-mode) + "[\n\r]%*[ \t]*[\n\r]" + "[\n\r][ \t]*[\n\r]") nil 1 texmathp-search-n-paragraphs) (match-beginning 0) (point-min))))