unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Recent updates to tree-sitter branch
@ 2022-09-25  4:27 Yuan Fu
  2022-09-25  6:17 ` Ihor Radchenko
  2022-09-29 10:13 ` Aurélien Aptel
  0 siblings, 2 replies; 14+ messages in thread
From: Yuan Fu @ 2022-09-25  4:27 UTC (permalink / raw)
  To: emacs-devel; +Cc: Theodor Thornhill

Hi,

I’ve recently made some breaking changes and added some goodies to the tree-sitter branch. If anyone have used that branch for … stuff, please have a look at these changes:

1. I reworked the tree-traversal functions—moved them from lisp to C, and changed their name and signature:

treesit-traverse-depth-first   -> treesit-search-subtree
treesit-traverse-breadth-first ->
treesit-traverse-forward       -> treesit-search-forward
treesit-search-forward         -> treesit-search-forward-goto
treesit-search-beginning/end   -> treesit-search-forward-goto
                               -> treesit-induce-sparse-tree

Treesit-induce-sparse-tree is very good for very quickly extracting a tree containing only nodes that satisfy some condition. Maybe it should be called treesit-extract-sparse-tree? “Sparse tree” is an invented word, I’m not aware of a good terminology for this kind of induced tree.

2. Although treesit-font-lock-settings didn’t change, treesit-font-lock-defaults is abandoned. You are also now supposed to use treesit-font-lock-rules to build the queries and set it to treesit-font-lock-settings. It is much cleaner than setting treesit-font-lock-settings manually.

Basically:

(setq treesit-font-lock-defaults ...)

|
V

(setq treesit-font-lock-settings
      (treesit-font-lock-rules
       ...))

3. I removed treesit-defun-query, treesit-beginning/end-of-defun.

That’s it! Happy hacking.

Yuan


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-10-04 16:58 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-25  4:27 Recent updates to tree-sitter branch Yuan Fu
2022-09-25  6:17 ` Ihor Radchenko
2022-09-26  8:35   ` Yuan Fu
2022-09-26  9:43     ` Ihor Radchenko
2022-09-27 22:28       ` Yuan Fu
2022-09-29  4:01         ` Ihor Radchenko
2022-09-30 21:03           ` Yuan Fu
2022-10-01  4:20             ` Ihor Radchenko
2022-10-02  3:46               ` Yuan Fu
2022-10-02  7:33                 ` Ihor Radchenko
2022-10-02 22:54                   ` Yuan Fu
2022-10-03  5:58                     ` Ihor Radchenko
2022-10-04 16:58                       ` Yuan Fu
2022-09-29 10:13 ` Aurélien Aptel

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).