aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/buffer.c4
-rw-r--r--src/treesit.c13
-rw-r--r--src/treesit.h4
3 files changed, 14 insertions, 7 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 637830704e6..5b4c4ea390e 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -5367,8 +5367,8 @@ visual lines rather than logical lines. See the documentation of
5367 Qstringp, 5367 Qstringp,
5368 doc: /* Name of default directory of current buffer. 5368 doc: /* Name of default directory of current buffer.
5369It should be an absolute directory name; on GNU and Unix systems, 5369It should be an absolute directory name; on GNU and Unix systems,
5370these names start with `/' or `~' and end with `/'. 5370these names start with "/" or "~" and end with "/".
5371To interactively change the default directory, use command `cd'. */); 5371To interactively change the default directory, use the command `cd'. */);
5372 5372
5373 DEFVAR_PER_BUFFER ("auto-fill-function", &BVAR (current_buffer, auto_fill_function), 5373 DEFVAR_PER_BUFFER ("auto-fill-function", &BVAR (current_buffer, auto_fill_function),
5374 Qnil, 5374 Qnil,
diff --git a/src/treesit.c b/src/treesit.c
index c65873a28f7..296a404a9d1 100644
--- a/src/treesit.c
+++ b/src/treesit.c
@@ -948,7 +948,10 @@ treesit_sync_visible_region (Lisp_Object parser)
948 this function is called), we need to reparse. */ 948 this function is called), we need to reparse. */
949 if (visible_beg != BUF_BEGV_BYTE (buffer) 949 if (visible_beg != BUF_BEGV_BYTE (buffer)
950 || visible_end != BUF_ZV_BYTE (buffer)) 950 || visible_end != BUF_ZV_BYTE (buffer))
951 XTS_PARSER (parser)->need_reparse = true; 951 {
952 XTS_PARSER (parser)->need_reparse = true;
953 XTS_PARSER (parser)->timestamp++;
954 }
952 955
953 /* Before we parse or set ranges, catch up with the narrowing 956 /* Before we parse or set ranges, catch up with the narrowing
954 situation. We change visible_beg and visible_end to match 957 situation. We change visible_beg and visible_end to match
@@ -1722,6 +1725,7 @@ buffer. */)
1722 ranges); 1725 ranges);
1723 1726
1724 XTS_PARSER (parser)->need_reparse = true; 1727 XTS_PARSER (parser)->need_reparse = true;
1728 XTS_PARSER (parser)->timestamp++;
1725 return Qnil; 1729 return Qnil;
1726} 1730}
1727 1731
@@ -2066,8 +2070,9 @@ DEFUN ("treesit-node-field-name-for-child",
2066Return nil if there's no Nth child, or if it has no field. 2070Return nil if there's no Nth child, or if it has no field.
2067If NODE is nil, return nil. 2071If NODE is nil, return nil.
2068 2072
2069Note that N counts named nodes only. Also, N could be negative, e.g., 2073N counts all children, i.e., named ones and anonymous ones.
2070-1 represents the last child. */) 2074
2075N could be negative, e.g., -1 represents the last child. */)
2071 (Lisp_Object node, Lisp_Object n) 2076 (Lisp_Object node, Lisp_Object n)
2072{ 2077{
2073 if (NILP (node)) 2078 if (NILP (node))
@@ -2081,7 +2086,7 @@ Note that N counts named nodes only. Also, N could be negative, e.g.,
2081 2086
2082 /* Process negative index. */ 2087 /* Process negative index. */
2083 if (idx < 0) 2088 if (idx < 0)
2084 idx = ts_node_named_child_count (treesit_node) + idx; 2089 idx = ts_node_child_count (treesit_node) + idx;
2085 if (idx < 0) 2090 if (idx < 0)
2086 return Qnil; 2091 return Qnil;
2087 if (idx > UINT32_MAX) 2092 if (idx > UINT32_MAX)
diff --git a/src/treesit.h b/src/treesit.h
index ef7e2e15317..75d3ed778c4 100644
--- a/src/treesit.h
+++ b/src/treesit.h
@@ -61,7 +61,9 @@ struct Lisp_TS_Parser
61 /* Re-parsing an unchanged buffer is not free for tree-sitter, so we 61 /* Re-parsing an unchanged buffer is not free for tree-sitter, so we
62 only make it re-parse when need_reparse == true. That usually 62 only make it re-parse when need_reparse == true. That usually
63 means some change is made in the buffer. But others could set 63 means some change is made in the buffer. But others could set
64 this field to true to force tree-sitter to re-parse. */ 64 this field to true to force tree-sitter to re-parse. When you
65 set this to true, you should _always_ also increment
66 timestamp. */
65 bool need_reparse; 67 bool need_reparse;
66 /* These two positions record the buffer byte position (1-based) of 68 /* These two positions record the buffer byte position (1-based) of
67 the "visible region" that tree-sitter sees. Before re-parse, we 69 the "visible region" that tree-sitter sees. Before re-parse, we