summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp/bytecomp-resources/warn-make-variable-buffer-local.el
diff options
context:
space:
mode:
authorYuan Fu <casouri@gmail.com>2022-12-23 15:22:31 -0800
committerYuan Fu <casouri@gmail.com>2022-12-24 00:33:16 -0800
commite492c21e81040b9539139b78f6baf98df17bbaab (patch)
treea8a36f661892b71697a3c965f9e4a8acfbc7774b /test/lisp/emacs-lisp/bytecomp-resources/warn-make-variable-buffer-local.el
parent4437dbedf7bd9d7fc3612ce4ecd96d5a2c653df8 (diff)
downloademacs-e492c21e81040b9539139b78f6baf98df17bbaab.tar.gz
emacs-e492c21e81040b9539139b78f6baf98df17bbaab.tar.bz2
emacs-e492c21e81040b9539139b78f6baf98df17bbaab.zip
Fix treesit_cursor_helper (bug#60267)
The cause of that bug is that in a particular parse tree, the node treesit_cursor_helper tries to go to is a missing node, not only is it a missing node, it is the first node of a subtree. So when treesit_cursor_helper follows the algorithm and goes down the tree, it goes down the previous subtree (because that subtree's end = end_pos, because the target node has zero width). o | o--+-o | | +-+ +-+-+ | | | | | o x t o o (We ended up in x when the target is t, because t has zero width.) One way to solve it is to go back up the tree if we are at a leaf node and still haven't matched the target node. That's too ugly and finicky so I resorted to recursion. Now one more functions will return give up (treesit_node_parent) if we are in a werid parse tree that is super deep. But since we already kind of give up on this kind of parse trees (bug#59426), it doesn't really hurt. * src/treesit.c (treesit_cursor_helper_1): New function. (treesit_cursor_helper): Use the new function. Change return type to bool, and accept a cursor pointer. (Ftreesit_node_parent) (Ftreesit_search_subtree) (Ftreesit_search_forward) (Ftreesit_induce_sparse_tree): Use the new signature.
Diffstat (limited to 'test/lisp/emacs-lisp/bytecomp-resources/warn-make-variable-buffer-local.el')
0 files changed, 0 insertions, 0 deletions