diff options
| author | Eli Zaretskii | 2023-12-30 04:51:17 -0500 |
|---|---|---|
| committer | Eli Zaretskii | 2023-12-30 04:51:17 -0500 |
| commit | 3b7198dc4703671fa8b00ed3bf159cb56d4d7ba3 (patch) | |
| tree | 13db74148b39c017ea6932c6572e1aa3c73a2259 /src | |
| parent | aa0037aaf7c2cd7052925fdeca73c77c91254de1 (diff) | |
| parent | 530315287254da2e6b0767ad343fa55f79be8536 (diff) | |
| download | emacs-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')
| -rw-r--r-- | src/buffer.c | 4 | ||||
| -rw-r--r-- | src/treesit.c | 13 | ||||
| -rw-r--r-- | src/treesit.h | 4 |
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. |
| 5369 | It should be an absolute directory name; on GNU and Unix systems, | 5369 | It should be an absolute directory name; on GNU and Unix systems, |
| 5370 | these names start with `/' or `~' and end with `/'. | 5370 | these names start with "/" or "~" and end with "/". |
| 5371 | To interactively change the default directory, use command `cd'. */); | 5371 | To 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", | |||
| 2066 | Return nil if there's no Nth child, or if it has no field. | 2070 | Return nil if there's no Nth child, or if it has no field. |
| 2067 | If NODE is nil, return nil. | 2071 | If NODE is nil, return nil. |
| 2068 | 2072 | ||
| 2069 | Note that N counts named nodes only. Also, N could be negative, e.g., | 2073 | N counts all children, i.e., named ones and anonymous ones. |
| 2070 | -1 represents the last child. */) | 2074 | |
| 2075 | N 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 |