]> git.eshelyaron.com Git - emacs.git/commit
Make sure treesit.el doesn't create parsers by itself (bug#75456)
authorYuan Fu <casouri@gmail.com>
Sat, 18 Jan 2025 01:40:04 +0000 (17:40 -0800)
committerEshel Yaron <me@eshelyaron.com>
Sat, 18 Jan 2025 22:03:02 +0000 (23:03 +0100)
commit57416f54f0030837d8f79cdfcda905dc6c44ed31
tree0632e01d6e7ab795fa90aeab0b53bc84f5a6eff2
parenta210f6e3a542b4dcc066989e8c1ebb1d89ac87c2
Make sure treesit.el doesn't create parsers by itself (bug#75456)

Up to this point, functions in
treesit.el (font-lock/indentation/etc) creates a parser if one
doesn't exist.  This doesn't work well with local parsers,
because local parsers are not visible at global level and
font-lock or indentation functions might accidentally create a
global parser for an embedded language.

The solution is to not create parsers automatically.  This has
the potential of breaking things, but I don't expect any actual
breakage: all the major modes create parsers they need in the
major mode body, even though previously it isn't technically
necessary.

* lisp/treesit.el (treesit-buffer-root-node):
(treesit--update-ranges-local):
(treesit-update-ranges):
(treesit--guess-primary-parser): Use treesit-parser-list instead
of treesit-parser-create.

(cherry picked from commit f7e41ba3d0fb5f89b1d2712b699b526ef7d7b82c)
lisp/treesit.el