]> git.eshelyaron.com Git - emacs.git/commit
New function treesit-parsers-at for treesit-language-at (bug#77256).
authorJuri Linkov <juri@linkov.net>
Tue, 8 Apr 2025 17:40:10 +0000 (20:40 +0300)
committerEshel Yaron <me@eshelyaron.com>
Tue, 8 Apr 2025 19:42:43 +0000 (21:42 +0200)
commitdc6afc494bb6196669fcb1851b240217cee1482b
treea053d1add1811623aa01dd1fa77791f794bad4df
parenta6b8721511aa2fb94e4083bcaf15314cb14536b3
New function treesit-parsers-at for treesit-language-at (bug#77256).

* doc/lispref/parsing.texi (Multiple Languages): The variable
'treesit-language-at-point-function' is now optional for
multi-language major modes.  Add description of 'treesit-parsers-at'.

* lisp/treesit.el (treesit-language-at-point-function):
Change the the docstring to remove the dissuasion against
deriving the language from parser ranges.
(treesit-language-at): Use the first parser from
'treesit-parsers-at' as the default return value when
'treesit-language-at-point-function' is nil.  Adapt the docstring.
(treesit-node-at): Use 'treesit-parsers-at'.
(treesit-parsers-at): New function.
(treesit-local-parsers-at): Use 'treesit-parsers-at'
with the most part of the body moved to it.
(treesit-local-parsers-on): Replace the overlay property
'treesit-parser' with 'treesit-parser-local-p' in the docstring.
(treesit-up-list, treesit-simple-imenu, treesit-outline-level):
Use 'treesit-parsers-at'.

* lisp/progmodes/c-ts-mode.el (c-ts-mode): Don't set
'treesit-language-at-point-function'.

* lisp/progmodes/elixir-ts-mode.el (elixir-ts--treesit-language-at-point):
Remove.
(elixir-ts-mode): Don't set 'treesit-language-at-point-function'.

* lisp/progmodes/js.el (js--treesit-language-at-point): Remove.
(js-ts-mode): Don't set 'treesit-language-at-point-function'.

* lisp/progmodes/php-ts-mode.el (php-ts-mode--html-language-at-point)
(php-ts-mode--language-at-point): Remove.
(php-ts-mode): Don't set 'treesit-language-at-point-function'.

* lisp/textmodes/mhtml-ts-mode.el (mhtml-ts-mode--language-at-point):
Remove.
(mhtml-ts-mode): Don't set 'treesit-language-at-point-function'.
Use 'treesit-language-at' for mode-line lighter.

(cherry picked from commit 5e0daa1ef77d2a5fe5b65b8f0fa6c4eab83a2498)
doc/lispref/parsing.texi
lisp/progmodes/c-ts-mode.el
lisp/progmodes/elixir-ts-mode.el
lisp/progmodes/js.el
lisp/progmodes/php-ts-mode.el
lisp/textmodes/mhtml-ts-mode.el
lisp/treesit.el