aboutsummaryrefslogtreecommitdiffstats
path: root/src/treesit.c
diff options
context:
space:
mode:
authorEli Zaretskii2023-12-30 04:51:17 -0500
committerEli Zaretskii2023-12-30 04:51:17 -0500
commit3b7198dc4703671fa8b00ed3bf159cb56d4d7ba3 (patch)
tree13db74148b39c017ea6932c6572e1aa3c73a2259 /src/treesit.c
parentaa0037aaf7c2cd7052925fdeca73c77c91254de1 (diff)
parent530315287254da2e6b0767ad343fa55f79be8536 (diff)
downloademacs-3b7198dc4703671fa8b00ed3bf159cb56d4d7ba3.tar.gz
emacs-3b7198dc4703671fa8b00ed3bf159cb56d4d7ba3.zip
Merge from origin/emacs-29
53031528725 Revert "Fix treesit-node-field-name and friends (bug#66674)" fa0bb88302b ; * src/buffer.c (syms_of_buffer) <default-directory>: Do... 44517037aed ; Fix typo ccf46acefd2 ; Fix last change. c86b039dffc ; * etc/DEBUG: Improve advice for debugging native-compil... 9afba605bbc Explain status "r" in `epa-list-keys` 62714221968 ; * lisp/dired.el (dired--make-directory-clickable): Refo... fcbb0044899 Fix mouse clicks on directory line in Dired be8a7155b48 Fix 'split-root-window-right' and 'split-root-window-below' eb19984c4db Mark icalendar.el as maintained by emacs-devel 03dc914fd37 ; Fix footnotes in ELisp Intro manual ceacf753958 Fix usage of `setq-default' and offer more suggestions 2701da0eee5 Fix python-ts-mode triple quote syntax (bug#67262) 683c7c96871 Increment parser timestamp when narrowing changes (bug#67... 8ae42c825e1 ruby-ts-mode: Fix indentation for string_array closer 9cfa498e0ab treesit-major-mode-setup: Use 'treesit--syntax-propertize... da2e440462b ruby-ts-mode: Fix an out-of-bounds error with heredoc at eob 6ea507296a7 Correctly refontify changed region in tree-sitter modes (...
Diffstat (limited to 'src/treesit.c')
-rw-r--r--src/treesit.c13
1 files changed, 9 insertions, 4 deletions
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)