aboutsummaryrefslogtreecommitdiffstats
path: root/admin/notes
diff options
context:
space:
mode:
authorYuan Fu2022-11-09 14:50:39 -0800
committerYuan Fu2022-11-09 15:51:13 -0800
commiteecc2d45b94513ba95789dfe0ef58aeb8b029049 (patch)
tree70c306db02d75c96ecff258020fc608ae0b0f6f7 /admin/notes
parent663d768d44be150439a58cd858615cac3c1f572f (diff)
downloademacs-eecc2d45b94513ba95789dfe0ef58aeb8b029049.tar.gz
emacs-eecc2d45b94513ba95789dfe0ef58aeb8b029049.zip
; Update tree-sitter HTML manuals in admin/notes
* admin/notes/tree-sitter/html-manual/Language-Definitions.html * admin/notes/tree-sitter/html-manual/Multiple-Languages.html * admin/notes/tree-sitter/html-manual/Parser_002dbased-Font-Lock.html * admin/notes/tree-sitter/html-manual/Parser_002dbased-Indentation.html * admin/notes/tree-sitter/html-manual/Retrieving-Node.html: Update.
Diffstat (limited to 'admin/notes')
-rw-r--r--admin/notes/tree-sitter/html-manual/Language-Definitions.html18
-rw-r--r--admin/notes/tree-sitter/html-manual/Multiple-Languages.html186
-rw-r--r--admin/notes/tree-sitter/html-manual/Parser_002dbased-Font-Lock.html28
-rw-r--r--admin/notes/tree-sitter/html-manual/Parser_002dbased-Indentation.html13
-rw-r--r--admin/notes/tree-sitter/html-manual/Retrieving-Node.html17
5 files changed, 168 insertions, 94 deletions
diff --git a/admin/notes/tree-sitter/html-manual/Language-Definitions.html b/admin/notes/tree-sitter/html-manual/Language-Definitions.html
index 6df676b1680..4fd7eb5687f 100644
--- a/admin/notes/tree-sitter/html-manual/Language-Definitions.html
+++ b/admin/notes/tree-sitter/html-manual/Language-Definitions.html
@@ -236,18 +236,20 @@ assign <em>field names</em> to child nodes. For example, a
236at point. The mode-line will display 236at point. The mode-line will display
237</p> 237</p>
238<div class="example"> 238<div class="example">
239<pre class="example"><var>parent</var> <var>field</var>: (<var>child</var> (<var>grandchild</var> (&hellip;))) 239<pre class="example"><var>parent</var> <var>field</var>: (<var>node</var> (<var>child</var> (&hellip;)))
240</pre></div> 240</pre></div>
241 241
242<p><var>child</var>, <var>grand</var>, <var>grand-grandchild</var>, etc., are nodes that 242<p>where <var>node</var>, <var>child</var>, etc, are nodes which begin at point.
243begin at point. <var>parent</var> is the parent node of <var>child</var>. 243<var>parent</var> is the parent of <var>node</var>. <var>node</var> is displayed in
244bold typeface. <var>field-name</var>s are field names of <var>node</var> and
245<var>child</var>, etc.
244</p> 246</p>
245<p>If there is no node that starts at point, i.e., point is in the middle 247<p>If no node starts at point, i.e., point is in the middle of a node,
246of a node, then the mode-line only displays the smallest node that 248then the mode line displays the earliest node that spans point, and
247spans the position of point, and its immediate parent. 249its immediate parent.
248</p> 250</p>
249<p>This minor mode doesn&rsquo;t create parsers on its own. It simply uses the 251<p>This minor mode doesn&rsquo;t create parsers on its own. It uses the first
250first parser in <code>(treesit-parser-list)</code> (see <a href="Using-Parser.html">Using Tree-sitter Parser</a>). 252parser in <code>(treesit-parser-list)</code> (see <a href="Using-Parser.html">Using Tree-sitter Parser</a>).
251</p></dd></dl> 253</p></dd></dl>
252 254
253<span id="Reading-the-grammar-definition"></span><h3 class="heading">Reading the grammar definition</h3> 255<span id="Reading-the-grammar-definition"></span><h3 class="heading">Reading the grammar definition</h3>
diff --git a/admin/notes/tree-sitter/html-manual/Multiple-Languages.html b/admin/notes/tree-sitter/html-manual/Multiple-Languages.html
index eac142921f1..6d1800fad72 100644
--- a/admin/notes/tree-sitter/html-manual/Multiple-Languages.html
+++ b/admin/notes/tree-sitter/html-manual/Multiple-Languages.html
@@ -67,7 +67,6 @@ Next: <a href="Tree_002dsitter-major-modes.html" accesskey="n" rel="next">Develo
67</div> 67</div>
68<hr> 68<hr>
69<span id="Parsing-Text-in-Multiple-Languages"></span><h3 class="section">37.6 Parsing Text in Multiple Languages</h3> 69<span id="Parsing-Text-in-Multiple-Languages"></span><h3 class="section">37.6 Parsing Text in Multiple Languages</h3>
70
71<span id="index-multiple-languages_002c-parsing-with-tree_002dsitter"></span> 70<span id="index-multiple-languages_002c-parsing-with-tree_002dsitter"></span>
72<span id="index-parsing-multiple-languages-with-tree_002dsitter"></span> 71<span id="index-parsing-multiple-languages-with-tree_002dsitter"></span>
73<p>Sometimes, the source of a programming language could contain snippets 72<p>Sometimes, the source of a programming language could contain snippets
@@ -76,8 +75,22 @@ example. In that case, text segments written in different languages
76need to be assigned different parsers. Traditionally, this is 75need to be assigned different parsers. Traditionally, this is
77achieved by using narrowing. While tree-sitter works with narrowing 76achieved by using narrowing. While tree-sitter works with narrowing
78(see <a href="Using-Parser.html#tree_002dsitter-narrowing">narrowing</a>), the recommended way is 77(see <a href="Using-Parser.html#tree_002dsitter-narrowing">narrowing</a>), the recommended way is
79instead to set regions of buffer text in which a parser will operate. 78instead to set regions of buffer text (i.e., ranges) in which a parser
79will operate. This section describes functions for setting and
80getting ranges for a parser.
81</p>
82<p>Lisp programs should call <code>treesit-update-ranges</code> to make sure
83the ranges for each parser are correct before using parsers in a
84buffer, and call <code>treesit-language-at</code> to figure out the language
85responsible for the text at some position. These two functions don&rsquo;t
86work by themselves, they need major modes to set
87<code>treesit-range-settings</code> and
88<code>treesit-language-at-point-function</code>, which do the actual work.
89These functions and variables are explained in more detail towards the
90end of the section.
80</p> 91</p>
92<span id="Getting-and-setting-ranges"></span><h3 class="heading">Getting and setting ranges</h3>
93
81<dl class="def"> 94<dl class="def">
82<dt id="index-treesit_002dparser_002dset_002dincluded_002dranges"><span class="category">Function: </span><span><strong>treesit-parser-set-included-ranges</strong> <em>parser ranges</em><a href='#index-treesit_002dparser_002dset_002dincluded_002dranges' class='copiable-anchor'> &para;</a></span></dt> 95<dt id="index-treesit_002dparser_002dset_002dincluded_002dranges"><span class="category">Function: </span><span><strong>treesit-parser-set-included-ranges</strong> <em>parser ranges</em><a href='#index-treesit_002dparser_002dset_002dincluded_002dranges' class='copiable-anchor'> &para;</a></span></dt>
83<dd><p>This function sets up <var>parser</var> to operate on <var>ranges</var>. The 96<dd><p>This function sets up <var>parser</var> to operate on <var>ranges</var>. The
@@ -127,24 +140,6 @@ ranges, the return value is <code>nil</code>.
127</dd></dl> 140</dd></dl>
128 141
129<dl class="def"> 142<dl class="def">
130<dt id="index-treesit_002dset_002dranges"><span class="category">Function: </span><span><strong>treesit-set-ranges</strong> <em>parser-or-lang ranges</em><a href='#index-treesit_002dset_002dranges' class='copiable-anchor'> &para;</a></span></dt>
131<dd><p>Like <code>treesit-parser-set-included-ranges</code>, this function sets
132the ranges of <var>parser-or-lang</var> to <var>ranges</var>. Conveniently,
133<var>parser-or-lang</var> could be either a parser or a language. If it is
134a language, this function looks for the first parser in
135<code>(treesit-parser-list)</code> for that language in the current buffer,
136and sets the ranges for it.
137</p></dd></dl>
138
139<dl class="def">
140<dt id="index-treesit_002dget_002dranges"><span class="category">Function: </span><span><strong>treesit-get-ranges</strong> <em>parser-or-lang</em><a href='#index-treesit_002dget_002dranges' class='copiable-anchor'> &para;</a></span></dt>
141<dd><p>This function returns the ranges of <var>parser-or-lang</var>, like
142<code>treesit-parser-included-ranges</code>. And like
143<code>treesit-set-ranges</code>, <var>parser-or-lang</var> can be a parser or
144a language symbol.
145</p></dd></dl>
146
147<dl class="def">
148<dt id="index-treesit_002dquery_002drange"><span class="category">Function: </span><span><strong>treesit-query-range</strong> <em>source query &amp;optional beg end</em><a href='#index-treesit_002dquery_002drange' class='copiable-anchor'> &para;</a></span></dt> 143<dt id="index-treesit_002dquery_002drange"><span class="category">Function: </span><span><strong>treesit-query-range</strong> <em>source query &amp;optional beg end</em><a href='#index-treesit_002dquery_002drange' class='copiable-anchor'> &para;</a></span></dt>
149<dd><p>This function matches <var>source</var> with <var>query</var> and returns the 144<dd><p>This function matches <var>source</var> with <var>query</var> and returns the
150ranges of captured nodes. The return value is a list of cons cells of 145ranges of captured nodes. The return value is a list of cons cells of
@@ -166,57 +161,56 @@ range in which this function queries.
166<code>treesit-query-error</code> error if <var>query</var> is malformed. 161<code>treesit-query-error</code> error if <var>query</var> is malformed.
167</p></dd></dl> 162</p></dd></dl>
168 163
169<dl class="def"> 164<span id="Supporting-multiple-languages-in-Lisp-programs"></span><h3 class="heading">Supporting multiple languages in Lisp programs</h3>
170<dt id="index-treesit_002drange_002dfunctions"><span class="category">Variable: </span><span><strong>treesit-range-functions</strong><a href='#index-treesit_002drange_002dfunctions' class='copiable-anchor'> &para;</a></span></dt>
171<dd><p>This variable holds the list of range functions. Font-locking and
172indenting code use functions in this list to set correct ranges for
173a language parser before using it.
174</p>
175<p>The signature of each function in the list should be:
176</p>
177<div class="example">
178<pre class="example">(<var>start</var> <var>end</var> &amp;rest <var>_</var>)
179</pre></div>
180 165
181<p>where <var>start</var> and <var>end</var> specify the region that is about to be 166<p>It should suffice for general Lisp programs to call the following two
182used. A range function only needs to (but is not limited to) update 167functions in order to support program sources that mixes multiple
183ranges in that region. 168languages.
184</p> 169</p>
185<p>The functions in the list are called in order.
186</p></dd></dl>
187
188<dl class="def"> 170<dl class="def">
189<dt id="index-treesit_002dupdate_002dranges"><span class="category">Function: </span><span><strong>treesit-update-ranges</strong> <em>&amp;optional start end</em><a href='#index-treesit_002dupdate_002dranges' class='copiable-anchor'> &para;</a></span></dt> 171<dt id="index-treesit_002dupdate_002dranges"><span class="category">Function: </span><span><strong>treesit-update-ranges</strong> <em>&amp;optional beg end</em><a href='#index-treesit_002dupdate_002dranges' class='copiable-anchor'> &para;</a></span></dt>
190<dd><p>This function is used by font-lock and indentation to update ranges 172<dd><p>This function updates ranges for parsers in the buffer. It makes sure
191before using any parser. Each range function in 173the parsers&rsquo; ranges are set correctly between <var>beg</var> and <var>end</var>,
192<var>treesit-range-functions</var> is called in-order. Arguments 174according to <code>treesit-range-settings</code>. If omitted, <var>beg</var>
193<var>start</var> and <var>end</var> are passed to each range function. 175defaults to the beginning of the buffer, and <var>end</var> defaults to the
176end of the buffer.
177</p>
178<p>For example, fontification functions use this function before querying
179for nodes in a region.
194</p></dd></dl> 180</p></dd></dl>
195 181
196<span id="index-treesit_002dlanguage_002dat_002dpoint_002dfunction"></span>
197<dl class="def"> 182<dl class="def">
198<dt id="index-treesit_002dlanguage_002dat"><span class="category">Function: </span><span><strong>treesit-language-at</strong> <em>pos</em><a href='#index-treesit_002dlanguage_002dat' class='copiable-anchor'> &para;</a></span></dt> 183<dt id="index-treesit_002dlanguage_002dat"><span class="category">Function: </span><span><strong>treesit-language-at</strong> <em>pos</em><a href='#index-treesit_002dlanguage_002dat' class='copiable-anchor'> &para;</a></span></dt>
199<dd><p>This function tries to figure out which language is responsible for 184<dd><p>This function returns the language of the text at buffer position
200the text at buffer position <var>pos</var>. Under the hood it just calls 185<var>pos</var>. Under the hood it calls
201<code>treesit-language-at-point-function</code>. 186<code>treesit-language-at-point-function</code> and returns its return
202</p> 187value. If <code>treesit-language-at-point-function</code> is <code>nil</code>,
203<p>Various Lisp programs use this function. For example, the indentation 188this function returns the language of the first parser in the returned
204program uses this function to determine which language&rsquo;s rule to use 189value of <code>treesit-parser-list</code>. If there is no parser in the
205in a multi-language buffer. So it is important to provide 190buffer, it returns <code>nil</code>.
206<code>treesit-language-at-point-function</code> for a multi-language major
207mode.
208</p></dd></dl> 191</p></dd></dl>
209 192
210<span id="An-example"></span><h3 class="heading">An example</h3> 193<span id="Supporting-multiple-languages-in-major-modes"></span><h3 class="heading">Supporting multiple languages in major modes</h3>
211 194
195<span id="index-host-language_002c-tree_002dsitter"></span>
196<span id="index-tree_002dsitter-host-and-embedded-languages"></span>
197<span id="index-embedded-language_002c-tree_002dsitter"></span>
212<p>Normally, in a set of languages that can be mixed together, there is a 198<p>Normally, in a set of languages that can be mixed together, there is a
213major language and several embedded languages. A Lisp program usually 199<em>host language</em> and one or more <em>embedded languages</em>. A Lisp
214first parses the whole document with the major language&rsquo;s parser, sets 200program usually first parses the whole document with the host
215ranges for the embedded languages, and then parses the embedded 201language&rsquo;s parser, retrieves some information, sets ranges for the
202embedded languages with that information, and then parses the embedded
216languages. 203languages.
217</p> 204</p>
218<p>Suppose we need to parse a very simple document that mixes 205<p>Take a buffer containing <acronym>HTML</acronym>, <acronym>CSS</acronym> and JavaScript
219<acronym>HTML</acronym>, <acronym>CSS</acronym> and JavaScript: 206as an example. A Lisp program will first parse the whole buffer with
207an <acronym>HTML</acronym> parser, then query the parser for
208<code>style_element</code> and <code>script_element</code> nodes, which
209correspond to <acronym>CSS</acronym> and JavaScript text, respectively. Then
210it sets the range of the <acronym>CSS</acronym> and JavaScript parser to the
211ranges in which their corresponding nodes span.
212</p>
213<p>Given a simple <acronym>HTML</acronym> document:
220</p> 214</p>
221<div class="example"> 215<div class="example">
222<pre class="example">&lt;html&gt; 216<pre class="example">&lt;html&gt;
@@ -225,8 +219,8 @@ languages.
225&lt;/html&gt; 219&lt;/html&gt;
226</pre></div> 220</pre></div>
227 221
228<p>We first parse with <acronym>HTML</acronym>, then set ranges for <acronym>CSS</acronym> 222<p>a Lisp program will first parse with a <acronym>HTML</acronym> parser, then set
229and JavaScript: 223ranges for <acronym>CSS</acronym> and JavaScript parsers:
230</p> 224</p>
231<div class="example"> 225<div class="example">
232<pre class="example">;; Create parsers. 226<pre class="example">;; Create parsers.
@@ -251,10 +245,76 @@ and JavaScript:
251(treesit-parser-set-included-ranges js js-range) 245(treesit-parser-set-included-ranges js js-range)
252</pre></div> 246</pre></div>
253 247
254<p>We use a query pattern <code><span class="nolinebreak">(style_element</span>&nbsp;<span class="nolinebreak">(raw_text)</span>&nbsp;@capture)</code><!-- /@w --> 248<p>Emacs automates this process in <code>treesit-update-ranges</code>. A
255to find <acronym>CSS</acronym> nodes in the <acronym>HTML</acronym> parse tree. For how 249multi-language major mode should set <code>treesit-range-settings</code> so
256to write query patterns, see <a href="Pattern-Matching.html">Pattern Matching Tree-sitter Nodes</a>. 250that <code>treesit-update-ranges</code> knows how to perform this process
251automatically. Major modes should use the helper function
252<code>treesit-range-rules</code> to generate a value that can be assigned to
253<code>treesit-range-settings</code>. The settings in the following example
254directly translate into operations shown above.
257</p> 255</p>
256<div class="example">
257<pre class="example">(setq-local treesit-range-settings
258 (treesit-range-rules
259 :embed 'javascript
260 :host 'html
261 '((script_element (raw_text) @capture))
262</pre><pre class="example">
263
264</pre><pre class="example"> :embed 'css
265 :host 'html
266 '((style_element (raw_text) @capture))))
267</pre></div>
268
269<dl class="def">
270<dt id="index-treesit_002drange_002drules"><span class="category">Function: </span><span><strong>treesit-range-rules</strong> <em>&amp;rest query-specs</em><a href='#index-treesit_002drange_002drules' class='copiable-anchor'> &para;</a></span></dt>
271<dd><p>This function is used to set <var>treesit-range-settings</var>. It
272takes care of compiling queries and other post-processing, and outputs
273a value that <var>treesit-range-settings</var> can have.
274</p>
275<p>It takes a series of <var>query-spec</var>s, where each <var>query-spec</var> is
276a <var>query</var> preceded by zero or more pairs of <var>keyword</var> and
277<var>value</var>. Each <var>query</var> is a tree-sitter query in either the
278string, s-expression or compiled form, or a function.
279</p>
280<p>If <var>query</var> is a tree-sitter query, it should be preceeded by two
281<var>:keyword</var> <var>value</var> pairs, where the <code>:embed</code> keyword
282specifies the embedded language, and the <code>:host</code> keyword
283specified the host language.
284</p>
285<p><code>treesit-update-ranges</code> uses <var>query</var> to figure out how to set
286the ranges for parsers for the embedded language. It queries
287<var>query</var> in a host language parser, computes the ranges in which
288the captured nodes span, and applies these ranges to embedded
289language parsers.
290</p>
291<p>If <var>query</var> is a function, it doesn&rsquo;t need any <var>:keyword</var> and
292<var>value</var> pair. It should be a function that takes 2 arguments,
293<var>start</var> and <var>end</var>, and sets the ranges for parsers in the
294current buffer in the region between <var>start</var> and <var>end</var>. It is
295fine for this function to set ranges in a larger region that
296encompasses the region between <var>start</var> and <var>end</var>.
297</p></dd></dl>
298
299<dl class="def">
300<dt id="index-treesit_002drange_002dsettings"><span class="category">Variable: </span><span><strong>treesit-range-settings</strong><a href='#index-treesit_002drange_002dsettings' class='copiable-anchor'> &para;</a></span></dt>
301<dd><p>This variable helps <code>treesit-update-ranges</code> in updating the
302ranges for parsers in the buffer. It is a list of <var>setting</var>s
303where the exact format of a <var>setting</var> is considered internal. You
304should use <code>treesit-range-rules</code> to generate a value that this
305variable can have.
306</p>
307</dd></dl>
308
309
310<dl class="def">
311<dt id="index-treesit_002dlanguage_002dat_002dpoint_002dfunction"><span class="category">Variable: </span><span><strong>treesit-language-at-point-function</strong><a href='#index-treesit_002dlanguage_002dat_002dpoint_002dfunction' class='copiable-anchor'> &para;</a></span></dt>
312<dd><p>This variable&rsquo;s value should be a function that takes a single
313argument, <var>pos</var>, which is a buffer position, and returns the
314language of the buffer text at <var>pos</var>. This variable is used by
315<code>treesit-language-at</code>.
316</p></dd></dl>
317
258</div> 318</div>
259<hr> 319<hr>
260<div class="header"> 320<div class="header">
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 4f2933c985d..72d82e6ee6d 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
@@ -111,7 +111,7 @@ would be highlighted in <code>font-lock-keyword</code> face.
111<code>treesit-major-mode-setup</code>. 111<code>treesit-major-mode-setup</code>.
112</p> 112</p>
113<dl class="def"> 113<dl class="def">
114<dt id="index-treesit_002dfont_002dlock_002drules"><span class="category">Function: </span><span><strong>treesit-font-lock-rules</strong> <em>:keyword value query...</em><a href='#index-treesit_002dfont_002dlock_002drules' class='copiable-anchor'> &para;</a></span></dt> 114<dt id="index-treesit_002dfont_002dlock_002drules"><span class="category">Function: </span><span><strong>treesit-font-lock-rules</strong> <em>&amp;rest query-specs</em><a href='#index-treesit_002dfont_002dlock_002drules' class='copiable-anchor'> &para;</a></span></dt>
115<dd><p>This function is used to set <var>treesit-font-lock-settings</var>. It 115<dd><p>This function is used to set <var>treesit-font-lock-settings</var>. It
116takes care of compiling queries and other post-processing, and outputs 116takes care of compiling queries and other post-processing, and outputs
117a value that <var>treesit-font-lock-settings</var> accepts. Here&rsquo;s an 117a value that <var>treesit-font-lock-settings</var> accepts. Here&rsquo;s an
@@ -129,13 +129,18 @@ example:
129 &quot;(script_element) @font-lock-builtin-face&quot;) 129 &quot;(script_element) @font-lock-builtin-face&quot;)
130</pre></div> 130</pre></div>
131 131
132<p>This function takes a list of text or s-exp queries. Before each 132<p>This function takes a series of <var>query-spec</var>s, where each
133query, there are <var>:keyword</var>-<var>value</var> pairs that configure 133<var>query-spec</var> is a <var>query</var> preceded by multiple pairs of
134that query. The <code>:lang</code> keyword sets the query&rsquo;s language and 134<var>:keyword</var> and <var>value</var>. Each <var>query</var> is a tree-sitter
135every query must specify the language. The <code>:feature</code> keyword 135query in either the string, s-expression or compiled form.
136sets the feature name of the query. Users can control which features 136</p>
137are enabled with <code>font-lock-maximum-decoration</code> and 137<p>For each <var>query</var>, the <var>:keyword</var> and <var>value</var> pairs add
138<code>treesit-font-lock-feature-list</code> (see below). 138meta information to it. The <code>:lang</code> keyword declares
139<var>query</var>&rsquo;s language. The <code>:feature</code> keyword sets the feature
140name of <var>query</var>. Users can control which features are enabled
141with <code>font-lock-maximum-decoration</code> and
142<code>treesit-font-lock-feature-list</code> (described below). These two
143keywords are mandated.
139</p> 144</p>
140<p>Other keywords are optional: 145<p>Other keywords are optional:
141</p> 146</p>
@@ -148,7 +153,7 @@ are enabled with <code>font-lock-maximum-decoration</code> and
148<tr><td width="15%"></td><td width="15%"><code>keep</code></td><td width="60%">Fill-in regions without an existing face</td></tr> 153<tr><td width="15%"></td><td width="15%"><code>keep</code></td><td width="60%">Fill-in regions without an existing face</td></tr>
149</table> 154</table>
150 155
151<p>Lisp programs mark patterns in the query with capture names (names 156<p>Lisp programs mark patterns in <var>query</var> with capture names (names
152that starts with <code>@</code>), and tree-sitter will return matched nodes 157that starts with <code>@</code>), and tree-sitter will return matched nodes
153tagged with those same capture names. For the purpose of 158tagged with those same capture names. For the purpose of
154fontification, capture names in <var>query</var> should be face names like 159fontification, capture names in <var>query</var> should be face names like
@@ -230,9 +235,10 @@ these common features.
230<dl class="def"> 235<dl class="def">
231<dt id="index-treesit_002dfont_002dlock_002dsettings"><span class="category">Variable: </span><span><strong>treesit-font-lock-settings</strong><a href='#index-treesit_002dfont_002dlock_002dsettings' class='copiable-anchor'> &para;</a></span></dt> 236<dt id="index-treesit_002dfont_002dlock_002dsettings"><span class="category">Variable: </span><span><strong>treesit-font-lock-settings</strong><a href='#index-treesit_002dfont_002dlock_002dsettings' class='copiable-anchor'> &para;</a></span></dt>
232<dd><p>A list of settings for tree-sitter based font lock. The exact format 237<dd><p>A list of settings for tree-sitter based font lock. The exact format
233of this variable is considered internal. One should always use 238of each setting is considered internal. One should always use
234<code>treesit-font-lock-rules</code> to set this variable. 239<code>treesit-font-lock-rules</code> to set this variable.
235</p></dd></dl> 240</p>
241</dd></dl>
236 242
237<p>Multi-language major modes should provide range functions in 243<p>Multi-language major modes should provide range functions in
238<code>treesit-range-functions</code>, and Emacs will set the ranges 244<code>treesit-range-functions</code>, and Emacs will set the ranges
diff --git a/admin/notes/tree-sitter/html-manual/Parser_002dbased-Indentation.html b/admin/notes/tree-sitter/html-manual/Parser_002dbased-Indentation.html
index 2fdb50df7c1..5ea1f9bc332 100644
--- a/admin/notes/tree-sitter/html-manual/Parser_002dbased-Indentation.html
+++ b/admin/notes/tree-sitter/html-manual/Parser_002dbased-Indentation.html
@@ -106,7 +106,8 @@ the current line to <var>matcher</var>; if it returns non-<code>nil</code>, this
106rule is applicable. Then Emacs passes the node to <var>anchor</var>, which 106rule is applicable. Then Emacs passes the node to <var>anchor</var>, which
107returns a buffer position. Emacs takes the column number of that 107returns a buffer position. Emacs takes the column number of that
108position, adds <var>offset</var> to it, and the result is the indentation 108position, adds <var>offset</var> to it, and the result is the indentation
109column for the current line. 109column for the current line. <var>offset</var> can be an integer or a
110variable whose value is an integer.
110</p> 111</p>
111<p>The <var>matcher</var> and <var>anchor</var> are functions, and Emacs provides 112<p>The <var>matcher</var> and <var>anchor</var> are functions, and Emacs provides
112convenient defaults for them. 113convenient defaults for them.
@@ -117,8 +118,8 @@ arguments: <var>node</var>, <var>parent</var>, and <var>bol</var>. The argument
117position of the first non-whitespace character after the beginning of 118position of the first non-whitespace character after the beginning of
118the line. The argument <var>node</var> is the largest (highest-in-tree) 119the line. The argument <var>node</var> is the largest (highest-in-tree)
119node that starts at that position; and <var>parent</var> is the parent of 120node that starts at that position; and <var>parent</var> is the parent of
120<var>node</var>. However, when that position is on a whitespace or inside 121<var>node</var>. However, when that position is in a whitespace or inside
121a multi-line string, no node that starts at that position, so 122a multi-line string, no node can start at that position, so
122<var>node</var> is <code>nil</code>. In that case, <var>parent</var> would be the 123<var>node</var> is <code>nil</code>. In that case, <var>parent</var> would be the
123smallest node that spans that position. 124smallest node that spans that position.
124</p> 125</p>
@@ -215,6 +216,12 @@ sibling of <var>node</var>.
215<dd><p>This anchor is a function that is called with 3 arguments: <var>node</var>, 216<dd><p>This anchor is a function that is called with 3 arguments: <var>node</var>,
216<var>parent</var>, and <var>bol</var>, and returns the first non-whitespace 217<var>parent</var>, and <var>bol</var>, and returns the first non-whitespace
217charater on the previous line. 218charater on the previous line.
219</p>
220</dd>
221<dt id='index-point_002dmin'><span><code>point-min</code><a href='#index-point_002dmin' class='copiable-anchor'> &para;</a></span></dt>
222<dd><p>This anchor is a function is called with 3 arguments: <var>node</var>,
223<var>parent</var>, and <var>bol</var>, and returns the beginning of the buffer.
224This is useful as the beginning of the buffer is always at column 0.
218</p></dd> 225</p></dd>
219</dl> 226</dl>
220 227
diff --git a/admin/notes/tree-sitter/html-manual/Retrieving-Node.html b/admin/notes/tree-sitter/html-manual/Retrieving-Node.html
index e1de2007077..0c086dab91d 100644
--- a/admin/notes/tree-sitter/html-manual/Retrieving-Node.html
+++ b/admin/notes/tree-sitter/html-manual/Retrieving-Node.html
@@ -262,10 +262,9 @@ is non-<code>nil</code>, it looks for smallest named child.
262<dd><p>This function traverses the subtree of <var>node</var> (including 262<dd><p>This function traverses the subtree of <var>node</var> (including
263<var>node</var> itself), looking for a node for which <var>predicate</var> 263<var>node</var> itself), looking for a node for which <var>predicate</var>
264returns non-<code>nil</code>. <var>predicate</var> is a regexp that is matched 264returns non-<code>nil</code>. <var>predicate</var> is a regexp that is matched
265(case-insensitively) against each node&rsquo;s type, or a predicate function 265against each node&rsquo;s type, or a predicate function that takes a node
266that takes a node and returns non-<code>nil</code> if the node matches. The 266and returns non-<code>nil</code> if the node matches. The function returns
267function returns the first node that matches, or <code>nil</code> if none 267the first node that matches, or <code>nil</code> if none does.
268does.
269</p> 268</p>
270<p>By default, this function only traverses named nodes, but if <var>all</var> 269<p>By default, this function only traverses named nodes, but if <var>all</var>
271is non-<code>nil</code>, it traverses all the nodes. If <var>backward</var> is 270is non-<code>nil</code>, it traverses all the nodes. If <var>backward</var> is
@@ -279,9 +278,9 @@ down the tree.
279<dt id="index-treesit_002dsearch_002dforward"><span class="category">Function: </span><span><strong>treesit-search-forward</strong> <em>start predicate &amp;optional backward all</em><a href='#index-treesit_002dsearch_002dforward' class='copiable-anchor'> &para;</a></span></dt> 278<dt id="index-treesit_002dsearch_002dforward"><span class="category">Function: </span><span><strong>treesit-search-forward</strong> <em>start predicate &amp;optional backward all</em><a href='#index-treesit_002dsearch_002dforward' class='copiable-anchor'> &para;</a></span></dt>
280<dd><p>Like <code>treesit-search-subtree</code>, this function also traverses the 279<dd><p>Like <code>treesit-search-subtree</code>, this function also traverses the
281parse tree and matches each node with <var>predicate</var> (except for 280parse tree and matches each node with <var>predicate</var> (except for
282<var>start</var>), where <var>predicate</var> can be a (case-insensitive) regexp 281<var>start</var>), where <var>predicate</var> can be a regexp or a function.
283or a function. For a tree like the below where <var>start</var> is marked 282For a tree like the below where <var>start</var> is marked S, this function
284S, this function traverses as numbered from 1 to 12: 283traverses as numbered from 1 to 12:
285</p> 284</p>
286<div class="example"> 285<div class="example">
287<pre class="example"> 12 286<pre class="example"> 12
@@ -336,8 +335,8 @@ as in <code>treesit-search-forward</code>.
336<p>It takes the subtree under <var>root</var>, and combs it so only the nodes 335<p>It takes the subtree under <var>root</var>, and combs it so only the nodes
337that match <var>predicate</var> are left. Like previous functions, the 336that match <var>predicate</var> are left. Like previous functions, the
338<var>predicate</var> can be a regexp string that matches against each 337<var>predicate</var> can be a regexp string that matches against each
339node&rsquo;s type case-insensitively, or a function that takes a node and 338node&rsquo;s type, or a function that takes a node and return non-<code>nil</code>
340return non-<code>nil</code> if it matches. 339if it matches.
341</p> 340</p>
342<p>For example, for a subtree on the left that consist of both numbers 341<p>For example, for a subtree on the left that consist of both numbers
343and letters, if <var>predicate</var> is &ldquo;letter only&rdquo;, the returned tree 342and letters, if <var>predicate</var> is &ldquo;letter only&rdquo;, the returned tree