bug#81334: 32.0.50; fontifying buffers with many blocks is very slow

Rahul Martim Juliato <[email protected]>
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
Yuan Fu <[email protected]> writes:

>> On Jul 25, 2026, at 10:40 PM, Eli Zaretskii <[email protected]> wrote:
>> 
>>> [...]
>> 
>> Which patch you think we should install?  Rahul posted 2 patches.
>
> This one (see attached). I took liberty to edit some of the comments.
>

Both patches are needed: Yuan's new 'language-cache.patch' and the
markdown-ts-mode change, which I'm re-attaching here as
'markdown-ts-mode-Make-inline-HTML-embed-local-bug-81334.patch'.

The latter is a one-liner on markdown-ts-mode.el, adding :local t to the
html_tag range rule.

The two are complementary: the cache removes the parser-creation cost,
and the :local t removes the O(N^2) non-local range update that remains
once parser creation is cheap.

-- 
Rahul Martim Juliato
markdown-ts-mode-Make-inline-HTML-embed-local-bug-81334.patch (application/octet-stream, 1 KB)
From 3981e36f3fc55b9472fbcaef8263e8800b95ef62 Mon Sep 17 00:00:00 2001
From: Rahul Martim Juliato <[email protected]>
Date: Sat, 4 Jul 2026 10:00:45 -0300
Subject: [PATCH 1/2] markdown-ts-mode: Make inline HTML embed local
 (bug#81334)

* lisp/textmodes/markdown-ts-mode.el (markdown-ts--set-up): Mark
the html_tag markdown-inline embed as ':local t', matching the
sibling html_block embed.  Avoids non-local range updates that
scale poorly on buffers with many inline blocks.
---
 lisp/textmodes/markdown-ts-mode.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/textmodes/markdown-ts-mode.el b/lisp/textmodes/markdown-ts-mode.el
index 5b9e7eb1ed6..7e67c808355 100644
--- a/lisp/textmodes/markdown-ts-mode.el
+++ b/lisp/textmodes/markdown-ts-mode.el
@@ -5315,6 +5315,7 @@ markdown-ts--set-up
 
                                 :embed 'html
                                 :host 'markdown-inline
+                                :local t
                                 '((html_tag) @html)))))
 
          (when (treesit-ready-p 'yaml t)
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.