aboutsummaryrefslogtreecommitdiffstats
path: root/admin/notes
diff options
context:
space:
mode:
authorYuan Fu2022-10-09 15:17:11 -0700
committerYuan Fu2022-10-09 17:20:28 -0700
commitc88a1631e3f76926bf0fed49fa1b704d6eaf2155 (patch)
tree97a012153edb415acb34271d65b4c6b8dabc8ac4 /admin/notes
parent9f7c359f4023570616c9961487069ba1122a5bb0 (diff)
downloademacs-c88a1631e3f76926bf0fed49fa1b704d6eaf2155.tar.gz
emacs-c88a1631e3f76926bf0fed49fa1b704d6eaf2155.zip
Make tree-sitter font-lock support decoration levels
* admin/notes/tree-sitter/html-manual/Parser_002dbased-Font-Lock.html: Update. * admin/notes/tree-sitter/html-manual/Parsing-Program-Source.html: Update. * doc/lispref/modes.texi: Mention the new :level option. * lisp/treesit.el (treesit-font-lock-settings): Update docstring. (treesit-font-lock-rules): Support :level. Relayout the let form. (treesit-font-lock-fontify-region): Support :level.
Diffstat (limited to 'admin/notes')
-rw-r--r--admin/notes/tree-sitter/html-manual/Parser_002dbased-Font-Lock.html9
-rw-r--r--admin/notes/tree-sitter/html-manual/Parsing-Program-Source.html4
2 files changed, 13 insertions, 0 deletions
diff --git a/admin/notes/tree-sitter/html-manual/Parser_002dbased-Font-Lock.html b/admin/notes/tree-sitter/html-manual/Parser_002dbased-Font-Lock.html
index 246ebf05193..c91152edc0e 100644
--- a/admin/notes/tree-sitter/html-manual/Parser_002dbased-Font-Lock.html
+++ b/admin/notes/tree-sitter/html-manual/Parser_002dbased-Font-Lock.html
@@ -117,8 +117,17 @@ every query must specify the language. Other keywords are optional:
117<tr><td width="15%"></td><td width="15%"><code>keep</code></td><td width="60%">Fill-in regions without an existing face</td></tr> 117<tr><td width="15%"></td><td width="15%"><code>keep</code></td><td width="60%">Fill-in regions without an existing face</td></tr>
118<tr><td width="15%"><code>:toggle</code></td><td width="15%"><var>symbol</var></td><td width="60%">If non-nil, its value should be a variable name. The variable&rsquo;s value 118<tr><td width="15%"><code>:toggle</code></td><td width="15%"><var>symbol</var></td><td width="60%">If non-nil, its value should be a variable name. The variable&rsquo;s value
119(nil/non-nil) disables/enables the query during fontification.</td></tr> 119(nil/non-nil) disables/enables the query during fontification.</td></tr>
120<tr><td width="15%"></td><td width="15%">nil</td><td width="60%">Always enable this query.</td></tr>
121<tr><td width="15%"><code>:level</code></td><td width="15%"><var>integer</var></td><td width="60%">If non-nil, its value should be the decoration level for this query.
122Decoration level is controlled by <code>font-lock-maximum-decoration</code>.</td></tr>
123<tr><td width="15%"></td><td width="15%">nil</td><td width="60%">Always enable this query.</td></tr>
120</table> 124</table>
121 125
126<p>Note that a query is applied only when both <code>:toggle</code> and
127<code>:level</code> permit it. <code>:level</code> is used for global,
128coarse-grained control, whereas <code>:toggle</code> is for local,
129fine-grained control.
130</p>
122<p>Capture names in <var>query</var> should be face names like 131<p>Capture names in <var>query</var> should be face names like
123<code>font-lock-keyword-face</code>. The captured node will be fontified 132<code>font-lock-keyword-face</code>. The captured node will be fontified
124with that face. Capture names can also be function names, in which 133with that face. Capture names can also be function names, in which
diff --git a/admin/notes/tree-sitter/html-manual/Parsing-Program-Source.html b/admin/notes/tree-sitter/html-manual/Parsing-Program-Source.html
index 7b6e51468a6..81b42f7f526 100644
--- a/admin/notes/tree-sitter/html-manual/Parsing-Program-Source.html
+++ b/admin/notes/tree-sitter/html-manual/Parsing-Program-Source.html
@@ -94,6 +94,10 @@ for this Emacs instance.
94see <a href="Parser_002dbased-Font-Lock.html">Parser-based Font Lock</a>, <a href="Parser_002dbased-Indentation.html">Parser-based Indentation</a>, and 94see <a href="Parser_002dbased-Font-Lock.html">Parser-based Font Lock</a>, <a href="Parser_002dbased-Indentation.html">Parser-based Indentation</a>, and
95<a href="List-Motion.html">Moving over Balanced Expressions</a>. 95<a href="List-Motion.html">Moving over Balanced Expressions</a>.
96</p> 96</p>
97<p>About naming convention: use &ldquo;tree-sitter&rdquo; when referring to it as a
98noun, like <code>python-use-tree-sitter</code>, but use &ldquo;treesit&rdquo; for
99prefixes, like <code>python-treesit-indent-function</code>.
100</p>
97<p>To access the syntax tree of the text in a buffer, we need to first 101<p>To access the syntax tree of the text in a buffer, we need to first
98load a language definition and create a parser with it. Next, we can 102load a language definition and create a parser with it. Next, we can
99query the parser for specific nodes in the syntax tree. Then, we can 103query the parser for specific nodes in the syntax tree. Then, we can