<feed xmlns='http://www.w3.org/2005/Atom'>
<title>emacs/src/treesit.h, branch scratch/cl-types</title>
<subtitle>Emacs is the extensible, customizable, self-documenting real-time display editor. 
</subtitle>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/'/>
<entry>
<title>Remove parent-node field from tree-sitter parsers</title>
<updated>2025-03-11T08:06:39+00:00</updated>
<author>
<name>Yuan Fu</name>
</author>
<published>2025-03-11T03:15:39+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=03a6d4256f861d71e09206ac09d48f16efd52b64'/>
<id>03a6d4256f861d71e09206ac09d48f16efd52b64</id>
<content type='text'>
* src/treesit.c (make_treesit_parser): Remove field.
(Ftreesit_parser_parent_node):
(Ftreesit_parser_set_parent_node): Remove
* src/treesit.h (Lisp_TS_Parser): Remove field.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* src/treesit.c (make_treesit_parser): Remove field.
(Ftreesit_parser_parent_node):
(Ftreesit_parser_set_parent_node): Remove
* src/treesit.h (Lisp_TS_Parser): Remove field.
</pre>
</div>
</content>
</entry>
<entry>
<title>; Fix documentation of recent treesit changes</title>
<updated>2025-02-28T07:12:05+00:00</updated>
<author>
<name>Eli Zaretskii</name>
</author>
<published>2025-02-28T07:12:05+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=6ed119d3052ffebd20450ec0c7fb3abf863b3a49'/>
<id>6ed119d3052ffebd20450ec0c7fb3abf863b3a49</id>
<content type='text'>
* src/treesit.c (Ftreesit_query_capture)
(Ftreesit_parser_embed_level, Ftreesit_parser_set_embed_level)
(Ftreesit_parser_set_parent_node):
* lisp/treesit.el (treesit-query-range)
(treesit-query-range-by-language, treesit-range-settings)
(treesit-range-rules, treesit--parser-at-level)
(treesit--update-ranges-non-local, treesit--update-ranges-local)
(treesit--update-range-1): Fix wording and typos in doc strings.

* doc/lispref/parsing.texi (Pattern Matching): Fix wording.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* src/treesit.c (Ftreesit_query_capture)
(Ftreesit_parser_embed_level, Ftreesit_parser_set_embed_level)
(Ftreesit_parser_set_parent_node):
* lisp/treesit.el (treesit-query-range)
(treesit-query-range-by-language, treesit-range-settings)
(treesit-range-rules, treesit--parser-at-level)
(treesit--update-ranges-non-local, treesit--update-ranges-local)
(treesit--update-range-1): Fix wording and typos in doc strings.

* doc/lispref/parsing.texi (Pattern Matching): Fix wording.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add tree-sitter-parser-embed-level and parent-node</title>
<updated>2025-02-28T01:22:03+00:00</updated>
<author>
<name>Yuan Fu</name>
</author>
<published>2025-02-27T11:05:26+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=30e1508ef2d40e221736cea2c50c64941d7d2f0d'/>
<id>30e1508ef2d40e221736cea2c50c64941d7d2f0d</id>
<content type='text'>
Add parser properties embed-level and parent-node. They'll be
help us implement arbitrarily nested embeded parser, and
navigation across embedded and host parsers, respectively.

* src/treesit.c:
(Ftreesit_parser_embed_level):
(Ftreesit_parser_set_embed_level):
(Ftreesit_parser_parent_node):
(Ftreesit_parser_set_parent_node): New functions.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add parser properties embed-level and parent-node. They'll be
help us implement arbitrarily nested embeded parser, and
navigation across embedded and host parsers, respectively.

* src/treesit.c:
(Ftreesit_parser_embed_level):
(Ftreesit_parser_set_embed_level):
(Ftreesit_parser_parent_node):
(Ftreesit_parser_set_parent_node): New functions.
</pre>
</div>
</content>
</entry>
<entry>
<title>Update copyright year to 2025</title>
<updated>2025-01-01T07:39:17+00:00</updated>
<author>
<name>Paul Eggert</name>
</author>
<published>2025-01-01T07:39:17+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=4da38c632161867e914b3a13dc760f8019255f94'/>
<id>4da38c632161867e914b3a13dc760f8019255f94</id>
<content type='text'>
Run "TZ=UTC0 admin/update-copyright".
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Run "TZ=UTC0 admin/update-copyright".
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge from origin/emacs-30</title>
<updated>2024-09-14T11:55:01+00:00</updated>
<author>
<name>Eli Zaretskii</name>
</author>
<published>2024-09-14T11:55:01+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=0cf9886cdfb0dd3082d70cb08bd5845d8f42a813'/>
<id>0cf9886cdfb0dd3082d70cb08bd5845d8f42a813</id>
<content type='text'>
d509a356997 Fix regression in widget-move (bug#72995)
ef0276de82b ; * lisp/cus-edit.el (setopt): Doc fix.  (Bug#73098)
b115c2d5eba ; * lisp/minibuffer.el (completion-pcm--merge-completions...
3cda1fdc3b7 Correctly include fixed strings before a prefix wildcard ...
57d93d0259a ; * lisp/treesit.el (treesit-major-mode-setup): Doc fix.
ad289f364e5 ; Improve documentation of 'easy-menu-define'
3cad7cc8dc8 Set treesit-primary-parser for c and elixir ts mode
2f243fb91d6 ; Minor doc fix in treesit.el
6a6d7925c9d Fix range handling so it works for multibyte buffer (bug#...
76faf7e6091 Revert "Read more on each call to treesit's buffer reader"
c70bd0e3fe9 Fix tree-sitter indent preset prev-adaptive-prefix
272df33fb8b ; * CONTRIBUTE: Minor copyedits.
8e1187e336f Improve NEWS entries
ca3932121a8 Don't fail uniquify-tests in non-version-controlled sourc...
79f68597aba ; * etc/ORG-NEWS: Fix typo.
d66b70f3607 * doc/misc/auth.texi: Minor copy edits.
2c6b7b2da9f ; * admin/MAINTAINERS: Remove some entries for Artur Mala...
11e7ae3964e Fix bug#72254

# Conflicts:
#	etc/NEWS
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
d509a356997 Fix regression in widget-move (bug#72995)
ef0276de82b ; * lisp/cus-edit.el (setopt): Doc fix.  (Bug#73098)
b115c2d5eba ; * lisp/minibuffer.el (completion-pcm--merge-completions...
3cda1fdc3b7 Correctly include fixed strings before a prefix wildcard ...
57d93d0259a ; * lisp/treesit.el (treesit-major-mode-setup): Doc fix.
ad289f364e5 ; Improve documentation of 'easy-menu-define'
3cad7cc8dc8 Set treesit-primary-parser for c and elixir ts mode
2f243fb91d6 ; Minor doc fix in treesit.el
6a6d7925c9d Fix range handling so it works for multibyte buffer (bug#...
76faf7e6091 Revert "Read more on each call to treesit's buffer reader"
c70bd0e3fe9 Fix tree-sitter indent preset prev-adaptive-prefix
272df33fb8b ; * CONTRIBUTE: Minor copyedits.
8e1187e336f Improve NEWS entries
ca3932121a8 Don't fail uniquify-tests in non-version-controlled sourc...
79f68597aba ; * etc/ORG-NEWS: Fix typo.
d66b70f3607 * doc/misc/auth.texi: Minor copy edits.
2c6b7b2da9f ; * admin/MAINTAINERS: Remove some entries for Artur Mala...
11e7ae3964e Fix bug#72254

# Conflicts:
#	etc/NEWS
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix range handling so it works for multibyte buffer (bug#73204)</title>
<updated>2024-09-14T07:28:23+00:00</updated>
<author>
<name>Yuan Fu</name>
</author>
<published>2024-09-14T04:42:17+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=6a6d7925c9ddbf558f70932661ee943262aea4ca'/>
<id>6a6d7925c9ddbf558f70932661ee943262aea4ca</id>
<content type='text'>
Here by multibyte buffer I mean buffer that includes non-ASCII
characters.

The problem is illustrated by this comment, which I copied from the
source:

======================================================================
(ref:bytepos-range-pitfall) Suppose we have the following buffer
content ([ ] is a unibyte char, [    ] is a multibyte char):

    [a][b][c][d][e][ f  ]

and the following ranges (denoted by braces):

    [a][b][c][d][e][ f  ]
    {       }{    }

So far so good, now user deletes a unibyte char at the beginning:

    [b][c][d][e][ f  ]
    {       }{    }

Oops, now our range cuts into the multibyte char, bad!
======================================================================

* src/treesit.c (treesit_debug_print_parser_list): Minor fix.
(treesit_sync_visible_region): Change the way we fixup ranges, instead
of using the bytepos ranges from tree-sitter, we use the cached lisp
charpos ranges.
(treesit_make_ts_ranges): New function.
(Ftreesit_parser_set_included_ranges): Refactor out the new function
treesit_make_ts_ranges.
(Ftreesit_parser_included_ranges): Rather than getting the ranges from
tree-sitter, just return the cached lisp ranges.

* src/treesit.h (Lisp_TS_Parser): Add some comment.
* test/src/treesit-tests.el (treesit-range-fixup-after-edit): New test.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Here by multibyte buffer I mean buffer that includes non-ASCII
characters.

The problem is illustrated by this comment, which I copied from the
source:

======================================================================
(ref:bytepos-range-pitfall) Suppose we have the following buffer
content ([ ] is a unibyte char, [    ] is a multibyte char):

    [a][b][c][d][e][ f  ]

and the following ranges (denoted by braces):

    [a][b][c][d][e][ f  ]
    {       }{    }

So far so good, now user deletes a unibyte char at the beginning:

    [b][c][d][e][ f  ]
    {       }{    }

Oops, now our range cuts into the multibyte char, bad!
======================================================================

* src/treesit.c (treesit_debug_print_parser_list): Minor fix.
(treesit_sync_visible_region): Change the way we fixup ranges, instead
of using the bytepos ranges from tree-sitter, we use the cached lisp
charpos ranges.
(treesit_make_ts_ranges): New function.
(Ftreesit_parser_set_included_ranges): Refactor out the new function
treesit_make_ts_ranges.
(Ftreesit_parser_included_ranges): Rather than getting the ranges from
tree-sitter, just return the cached lisp ranges.

* src/treesit.h (Lisp_TS_Parser): Add some comment.
* test/src/treesit-tests.el (treesit-range-fixup-after-edit): New test.
</pre>
</div>
</content>
</entry>
<entry>
<title>* src/treesit.h (struct Lisp_TS_Parser): Correct merge error.</title>
<updated>2024-09-11T05:25:48+00:00</updated>
<author>
<name>Po Lu</name>
</author>
<published>2024-09-11T05:25:48+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=a139c3d6d888219bb3cb3c0c5a3eb6268c9b7a29'/>
<id>a139c3d6d888219bb3cb3c0c5a3eb6268c9b7a29</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge from savannah/emacs-30</title>
<updated>2024-09-11T05:21:58+00:00</updated>
<author>
<name>Po Lu</name>
</author>
<published>2024-09-11T05:21:58+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=76487b7454b88557d7c8dec7136b7a09aacfb5bf'/>
<id>76487b7454b88557d7c8dec7136b7a09aacfb5bf</id>
<content type='text'>
ee3e3a63111 ; Update version number of exec/configure.ac
c5925b6ba5f Fix heex-ts-mode indentation following previews elixir-mo...
c3383be5f04 ; * admin/make-tarball.txt: Improve last change.
8ddb54117f1 ; * admin/make-tarball.txt: Remove now unnecessary config...
7e194d33f90 * lisp/ldefs-boot.el: Update.
9019536ea66 Fix use of Uniscribe font driver in MinGW build
5c55c860db7 Avoid crashes in redisplay in batch-mode testing
ba2190e1ae7 ; * etc/NEWS: Fix indentation.
818c0cc9a51 eglot-test-rust-completion-exit-function: Fix failure in ...
f47297782bd ; * doc/lispref/searching.texi (Rx Notation): Simplify rx...
03e56981675 Clarify the semantics of 'string-pixel-width'
9f0603207b1 ; * src/treesit.c: Minor cleanups of recent changes.
e0d3f743957 * src/treesit.c (treesit_debug_print_parser_list): Fix fo...
bed38ded730 ; * src/treesit.c (treesit_debug_print_parser_list): Fix ...
18c6487dbd0 ; * src/treesit.c: Add a prototype so there's no warning ...
bf23382f1f2 Read more on each call to treesit's buffer reader
3435464452b Fix the range handling in treesit.c
3fcec09f754 Add debugging function for treesit.c
0fd259d166c Fix elixir-ts-mode's range query
2329b36b1fb ; project-files-relative-names: Update docstring (bug#72701)
e55e2e1c6ba Make json-serialize always return a unibyte string (bug#7...
89c99891b2b ; * doc/lispref/os.texi (Suspending Emacs): Fix last change.
4f044d0d3df ; Improve documentation of 'suspend-emacs'
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
ee3e3a63111 ; Update version number of exec/configure.ac
c5925b6ba5f Fix heex-ts-mode indentation following previews elixir-mo...
c3383be5f04 ; * admin/make-tarball.txt: Improve last change.
8ddb54117f1 ; * admin/make-tarball.txt: Remove now unnecessary config...
7e194d33f90 * lisp/ldefs-boot.el: Update.
9019536ea66 Fix use of Uniscribe font driver in MinGW build
5c55c860db7 Avoid crashes in redisplay in batch-mode testing
ba2190e1ae7 ; * etc/NEWS: Fix indentation.
818c0cc9a51 eglot-test-rust-completion-exit-function: Fix failure in ...
f47297782bd ; * doc/lispref/searching.texi (Rx Notation): Simplify rx...
03e56981675 Clarify the semantics of 'string-pixel-width'
9f0603207b1 ; * src/treesit.c: Minor cleanups of recent changes.
e0d3f743957 * src/treesit.c (treesit_debug_print_parser_list): Fix fo...
bed38ded730 ; * src/treesit.c (treesit_debug_print_parser_list): Fix ...
18c6487dbd0 ; * src/treesit.c: Add a prototype so there's no warning ...
bf23382f1f2 Read more on each call to treesit's buffer reader
3435464452b Fix the range handling in treesit.c
3fcec09f754 Add debugging function for treesit.c
0fd259d166c Fix elixir-ts-mode's range query
2329b36b1fb ; project-files-relative-names: Update docstring (bug#72701)
e55e2e1c6ba Make json-serialize always return a unibyte string (bug#7...
89c99891b2b ; * doc/lispref/os.texi (Suspending Emacs): Fix last change.
4f044d0d3df ; Improve documentation of 'suspend-emacs'
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix the range handling in treesit.c</title>
<updated>2024-09-09T03:52:20+00:00</updated>
<author>
<name>Yuan Fu</name>
</author>
<published>2024-09-09T00:50:52+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=3435464452b4947098b8ccbe93e5c0afdd2ed06e'/>
<id>3435464452b4947098b8ccbe93e5c0afdd2ed06e</id>
<content type='text'>
1. In treesit_sync_visible_region, reduce the ranges for a parser so it
doesn't go beyond the visible range.

2. To avoid possible infinite recursion, add a within_reparse field to
parsers.  Previously we were using the need_reparse field to avoid
infinite recursion, but lisp programs in a parser's after change hook
might make some buffer edit which turns need_reparse to true. To avoid
that, we now use an explicit field.  If a parser's after change function
makes a buffer edit, lisp program ends up with a desynced parse tree,
but that's better than possible infinite recursion.  Also after change
function shouldn't edit the buffer.

3. In treesit_make_ranges, use parser's visible_beg instead of buffer's
BEGV.  I mean technically whenever we make ranges, buffer's BEGV should
be equal to parser's visible_beg, but better not take that uncertainty,
also makes the code more readable.

4. In Ftreesit_parser_included_ranges, move visible region sync code
before the body of the function.

* src/treesit.c (treesit_sync_visible_region): Minimally fix ranges so
it doesn't exceed parser's visible range.
(treesit_call_after_change_functions): Update calling sigature to
treesit_make_ranges.
(treesit_ensure_parsed, make_treesit_parser): Use the new field
within_reparse.
(treesit_make_ranges): Use parser's visible_beg instead of buffer's
BEGV.
(Ftreesit_parser_included_ranges): Move visible region check before
function body.
* src/treesit.h (Lisp_TS_Parser): Add new field within_reparse.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
1. In treesit_sync_visible_region, reduce the ranges for a parser so it
doesn't go beyond the visible range.

2. To avoid possible infinite recursion, add a within_reparse field to
parsers.  Previously we were using the need_reparse field to avoid
infinite recursion, but lisp programs in a parser's after change hook
might make some buffer edit which turns need_reparse to true. To avoid
that, we now use an explicit field.  If a parser's after change function
makes a buffer edit, lisp program ends up with a desynced parse tree,
but that's better than possible infinite recursion.  Also after change
function shouldn't edit the buffer.

3. In treesit_make_ranges, use parser's visible_beg instead of buffer's
BEGV.  I mean technically whenever we make ranges, buffer's BEGV should
be equal to parser's visible_beg, but better not take that uncertainty,
also makes the code more readable.

4. In Ftreesit_parser_included_ranges, move visible region sync code
before the body of the function.

* src/treesit.c (treesit_sync_visible_region): Minimally fix ranges so
it doesn't exceed parser's visible range.
(treesit_call_after_change_functions): Update calling sigature to
treesit_make_ranges.
(treesit_ensure_parsed, make_treesit_parser): Use the new field
within_reparse.
(treesit_make_ranges): Use parser's visible_beg instead of buffer's
BEGV.
(Ftreesit_parser_included_ranges): Move visible region check before
function body.
* src/treesit.h (Lisp_TS_Parser): Add new field within_reparse.
</pre>
</div>
</content>
</entry>
<entry>
<title>Make sure treesit-parse-string gc its temp buffer (bug#71012)</title>
<updated>2024-08-24T22:15:23+00:00</updated>
<author>
<name>Yuan Fu</name>
</author>
<published>2024-08-24T21:54:57+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=4339e70a942770ce4e17d16a9708e4bdf5630514'/>
<id>4339e70a942770ce4e17d16a9708e4bdf5630514</id>
<content type='text'>
* doc/lispref/parsing.texi (Using Parser): Add notice.
* lisp/treesit.el (treesit-parse-string): Remove function.
* src/treesit.c (make_treesit_parser): Init the new filed.
(treesit_delete_parser): Collect the temp buffer.
(Ftreesit_parse_string): New function.
* src/treesit.h (Lisp_TS_Parser): New field.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* doc/lispref/parsing.texi (Using Parser): Add notice.
* lisp/treesit.el (treesit-parse-string): Remove function.
* src/treesit.c (make_treesit_parser): Init the new filed.
(treesit_delete_parser): Collect the temp buffer.
(Ftreesit_parse_string): New function.
* src/treesit.h (Lisp_TS_Parser): New field.
</pre>
</div>
</content>
</entry>
</feed>
