]> git.eshelyaron.com Git - emacs.git/commit
Install new toggle scheme for tree-sitter
authorYuan Fu <casouri@gmail.com>
Tue, 18 Oct 2022 20:06:25 +0000 (13:06 -0700)
committerYuan Fu <casouri@gmail.com>
Tue, 18 Oct 2022 20:17:12 +0000 (13:17 -0700)
commit17b65f52921b6a9314a2709f0e5c3ef88b37f2ab
treef74addeba4b840970c974b74f9c830115b7aa030
parent851a8f65e9a6b00b51f6a41f4c8f2ec2a797862b
Install new toggle scheme for tree-sitter

Basically we now have treesit-mode and global-treesit-mode.  Major
modes set major-mode-backend-function which treesit-mode calls to
activate/deactivate tree-sitter.

js.el needs a bit explanation: I'm so sorry for messing up the
history, but basically now js-mode and js-json-mode should be exactly
the same as before any tree-sitter change was introduced, sans some
initialization code that are moved to js(-json)--backend-toggle.
js-mode and js-json-mode now just sets major-mode-backend-function and
initialize with js(-json)--backend-toggle.

* lisp/treesit.el (treesit-mode-inhibit-message): New option.
(treesit-can-enable-p): Remove function.
(major-mode-backend-function)
(treesit-remapped-major-mode-alist): New variables.
(treesit-mode)
(global-treesit-mode): New minor modes.
(global-treesit-mode--turn-on)
(treesit-ready-p): New functions.

* lisp/progmodes/python.el: Remove option.
(python--backend-toggle): New function.
(python-mode): Remove the if-form, all the initialization code are
moved to python--backend-toggle, python-mode now just sets
major-mode-backend-function and initialize with
python--backend-toggle.
* lisp/progmodes/js.el (js--treesit-can-enable-p)
(js--json-treesit-can-enable-p)
(js--treesit-enable)
(js--json-treesit-enable): Remove functions.
(js--backend-toggle)
(js-json--backend-toggle): New function.

* lisp/progmodes/ts-mode.el (ts-mode): Use treesit-ready-p.
lisp/progmodes/js.el
lisp/progmodes/python.el
lisp/progmodes/ts-mode.el
lisp/treesit.el