]> git.eshelyaron.com Git - emacs.git/commit
Make it harder to misactivate tree-sitter font-lock fast mode
authorYuan Fu <casouri@gmail.com>
Wed, 18 Jan 2023 06:26:21 +0000 (22:26 -0800)
committerYuan Fu <casouri@gmail.com>
Wed, 18 Jan 2023 06:32:40 +0000 (22:32 -0800)
commitac3bc775b6fd934c972d9e2542f384cdc92d2754
treed2128da0eb9661b84f7be627e44bd6e6a1dff2ea
parentbdd82fa7977570160523cdce907f1b5d2c786359
Make it harder to misactivate tree-sitter font-lock fast mode

This has been brought up in bug#60691 and bug#60223.  I proposed a fix
by testing the size of the tree rather than measuring the query time.
But after some thought, I fear that just looking at the size will give
us false-negatives.  So I kept the time-based activation, just added a
grace count to reduce false-positives.

* lisp/treesit.el:
(treesit--font-lock-fast-mode-grace-count): New variable.
(treesit--font-lock-notifier): Only activate fast mode after 5
offenses.
lisp/treesit.el