[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/tree-sitter 9f7c359f40 1/3: Add note on tree-sitter's naming con
From: |
Yuan Fu |
Subject: |
feature/tree-sitter 9f7c359f40 1/3: Add note on tree-sitter's naming convention |
Date: |
Sun, 9 Oct 2022 20:21:01 -0400 (EDT) |
branch: feature/tree-sitter
commit 9f7c359f4023570616c9961487069ba1122a5bb0
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>
Add note on tree-sitter's naming convention
* admin/notes/tree-sitter/starter-guide: Add note.
* doc/lispref/parsing.texi: Add note.
---
admin/notes/tree-sitter/starter-guide | 7 +++++++
doc/lispref/parsing.texi | 4 ++++
2 files changed, 11 insertions(+)
diff --git a/admin/notes/tree-sitter/starter-guide
b/admin/notes/tree-sitter/starter-guide
index 129f9ee5fa..378ff581af 100644
--- a/admin/notes/tree-sitter/starter-guide
+++ b/admin/notes/tree-sitter/starter-guide
@@ -8,6 +8,7 @@ TOC:
- Building Emacs with tree-sitter
- Install language definitions
- Setup
+- Naming convention
- Font-lock
- Indent
- Imenu
@@ -94,6 +95,12 @@ Then in other places, we decide on whether to enable
tree-sitter by
(treesit-can-enable-p))
#+end_src
+* Naming convention
+
+When referring to tree-sitter as a noun, use “tree-sitter”, like
+python-use-tree-sitter. For prefix use “treesit”, like
+python-treesit-indent.
+
* Font-lock
Tree-sitter works like this: You provide a query made of patterns and
diff --git a/doc/lispref/parsing.texi b/doc/lispref/parsing.texi
index 3784531fe5..d0bb642a3e 100644
--- a/doc/lispref/parsing.texi
+++ b/doc/lispref/parsing.texi
@@ -30,6 +30,10 @@ For tree-sitter integration with existing Emacs features,
@pxref{Parser-based Font Lock}, @ref{Parser-based Indentation}, and
@ref{List Motion}.
+About naming convention: use ``tree-sitter'' when referring to it as a
+noun, like @code{python-use-tree-sitter}, but use ``treesit'' for
+prefixes, like @code{python-treesit-indent-function}.
+
To access the syntax tree of the text in a buffer, we need to first
load a language definition and create a parser with it. Next, we can
query the parser for specific nodes in the syntax tree. Then, we can