[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/tree-sitter 9e339415b4 14/15: Fix treesit-induce-sparse-tree
From: |
Yuan Fu |
Subject: |
feature/tree-sitter 9e339415b4 14/15: Fix treesit-induce-sparse-tree |
Date: |
Sun, 25 Sep 2022 00:12:00 -0400 (EDT) |
branch: feature/tree-sitter
commit 9e339415b4c068242e7cd785d2ac95420f1934ba
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>
Fix treesit-induce-sparse-tree
Because not-at-all-werid way we implemented ts_build_sparse_tree, it’s
return value needs a bit post-processing (i.e., reverse its cdr).
* src/treesit.c (Ftreesit_induce_sparse_tree): Reverse the top-level
children list.
(ts_build_sparse_tree): Add comment.
---
src/treesit.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/treesit.c b/src/treesit.c
index 5917931e44..1a61e354cf 100644
--- a/src/treesit.c
+++ b/src/treesit.c
@@ -2041,7 +2041,9 @@ case, only 1 3 4 8 16 would be traversed. */)
}
/* Recursively traverse the tree under CURSOR, and append the result
- subtree to PARENT's cdr. See more in `ts_build_sparse_tree'. */
+ subtree to PARENT's cdr. See more in Ftreesit_induce_sparse_tree.
+ Note that the top-level children list is reversed, because
+ reasons. */
static void
ts_build_sparse_tree
(TSTreeCursor *cursor, Lisp_Object parent, Lisp_Object pred,
@@ -2151,6 +2153,7 @@ regexp. */)
ts_build_sparse_tree
(&cursor, parent, predicate, process_fn,
the_limit, no_limit, parser);
+ Fsetcdr (parent, Fnreverse (Fcdr (parent)));
if (NILP (Fcdr (parent)))
return Qnil;
else
- feature/tree-sitter updated (1cdb24fe35 -> 9ed53535f5), Yuan Fu, 2022/09/25
- feature/tree-sitter c957832cbf 08/15: Remove treesit-traverse functions, Yuan Fu, 2022/09/25
- feature/tree-sitter b584569014 05/15: Change make_string to build_string in treesit.c, Yuan Fu, 2022/09/25
- feature/tree-sitter 17422c2cfc 06/15: ; * src/treesit.c (Ftreesit_node_field_name_for_child): Doc fix., Yuan Fu, 2022/09/25
- feature/tree-sitter eba6582436 09/15: Add the treesit-search functions that supplant the removed ones, Yuan Fu, 2022/09/25
- feature/tree-sitter a31538ea5b 12/15: Fix treesit-search-forward, Yuan Fu, 2022/09/25
- feature/tree-sitter ef6e18a6b9 13/15: Improve treesit-search-forward-goto, Yuan Fu, 2022/09/25
- feature/tree-sitter 9e339415b4 14/15: Fix treesit-induce-sparse-tree,
Yuan Fu <=
- feature/tree-sitter c5147882a9 03/15: ; Minor manual fix for tree-sitter indent, Yuan Fu, 2022/09/25
- feature/tree-sitter 914f68da05 04/15: ; Minor tree-sitter manual fix, Yuan Fu, 2022/09/25
- feature/tree-sitter 013c7d6aae 01/15: Rename treesit-expand-query/pattern, Yuan Fu, 2022/09/25
- feature/tree-sitter 9ed53535f5 15/15: ; * lisp/progmodes/python.el (python-mode): Fix typo., Yuan Fu, 2022/09/25
- feature/tree-sitter 08a1c32d0b 02/15: Improve printing treesit nodes, Yuan Fu, 2022/09/25
- feature/tree-sitter 1575ee2eeb 07/15: Accept nil as NODE in treesit-node-text, Yuan Fu, 2022/09/25
- feature/tree-sitter f071e61d10 10/15: ; Fix docstrings in treesit.el, Yuan Fu, 2022/09/25
- feature/tree-sitter 795e01ac24 11/15: Update and enable treesit-imenu function in python.el, Yuan Fu, 2022/09/25