]> git.eshelyaron.com Git - emacs.git/commit
Redefine treesit-node-at
authorYuan Fu <casouri@gmail.com>
Fri, 13 May 2022 20:38:21 +0000 (13:38 -0700)
committerYuan Fu <casouri@gmail.com>
Fri, 13 May 2022 21:36:37 +0000 (14:36 -0700)
commit78df03329d1e942d5617c0f09f264792e24a063d
treebadb03713f25a02e0d3d74020fa1878fd54d6b43
parenteebe5a1d6114ed54eb3cdd5576f43da76590b8fa
Redefine treesit-node-at

The old 'treesit-node-at' becomes 'treesit-node-on'.  The new
'treesit-node-at' has slightly different semantics.  Now
'treesit-node-on' gets the smallest node covering a range and
'treesit-node-at' gets the smallest node after a position.

The reason of change can be found in the docstring of
'treesit-node-on' (the BEWARE part): its result can be sometimes
surprising/unexpected.

* doc/lispref/parsing.texi (Retrieving Node): Update manual.
* lisp/treesit.el (treesit-node-at): Change to new definition.
(treesit-node-on): Inherits the old definition of
'treesit-node-at'.  Parameter END is now mandatory.
(treesit-language-at, treesit-node-field-name): Use the new '-on'
function.
(treesit-font-lock-fontify-region, treesit-simple-indent-presets,
treesit-indent): Use the new '-at' function.
* test/src/treesit-tests.el (treesit-node-supplemental): Update tests.
doc/lispref/parsing.texi
lisp/treesit.el
test/src/treesit-tests.el