unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Yuan Fu <casouri@gmail.com>
To: emacs-devel <emacs-devel@gnu.org>
Cc: Theodor Thornhill <theo@thornhill.no>
Subject: Recent updates to tree-sitter branch
Date: Sat, 24 Sep 2022 21:27:40 -0700	[thread overview]
Message-ID: <C6117703-7C33-4DB5-A556-5EDF37511374@gmail.com> (raw)

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


             reply	other threads:[~2022-09-25  4:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-25  4:27 Yuan Fu [this message]
2022-09-25  6:17 ` Recent updates to tree-sitter branch 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=C6117703-7C33-4DB5-A556-5EDF37511374@gmail.com \
    --to=casouri@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=theo@thornhill.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).