diff options
| author | Yuan Fu | 2022-06-16 17:55:07 -0700 |
|---|---|---|
| committer | Yuan Fu | 2022-06-16 17:55:07 -0700 |
| commit | 246dbb540a32fd5e68ae0665527717943ebb69b1 (patch) | |
| tree | 7a2520f82c4775edc9da948630d4db11d5868f68 /src/buffer.h | |
| parent | 33f7e10a29dad475f7872d6af87ecefaccdb55fc (diff) | |
| download | emacs-246dbb540a32fd5e68ae0665527717943ebb69b1.tar.gz emacs-246dbb540a32fd5e68ae0665527717943ebb69b1.zip | |
Change treesit-parser-list from variable to function
Effectively making the list internal. Now Emacs user cannot shoot
themselves in the foot by removing a parser from the list, make
chaanges to buffer and add that parser back to the list.
* doc/lispref/parsing.texi (Language Definitions, Using Parser)
(Retrieving Node, Multiple Languages): Change variable to function.
* lisp/treesit.el (treesit-language-at, treesit-node-on)
(treesit-buffer-root-node, treesit-indent, treesit-check-indent)
(treesit-search-forward, treesit-search-beginning)
(treesit-end-of-defun, treesit-inspect-mode): Change variable to
function.
* src/buffer.c (bset_ts_parser_list, reset_buffer, init_buffer_once):
Add ts_parser_list.
* src/buffer.h (struct buffer): Add ts_parser_list.
* src/treesit.c (ts_record_change, Ftreesit_parser_create): Use the
buffer field instead of the old buffer local variable.
(Ftreesit_parser_delete, Ftreesit_parser_list): New functions.
(syms_of_treesit): Remove treesit-parser-list.
* test/src/treesit-tests.el (treesit-basic-parsing): Use the new
function.
Diffstat (limited to 'src/buffer.h')
| -rw-r--r-- | src/buffer.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/buffer.h b/src/buffer.h index 135eaf72d30..bc07a63b537 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -561,6 +561,10 @@ struct buffer | |||
| 561 | in the display of this buffer. */ | 561 | in the display of this buffer. */ |
| 562 | Lisp_Object extra_line_spacing_; | 562 | Lisp_Object extra_line_spacing_; |
| 563 | 563 | ||
| 564 | #ifdef HAVE_TREE_SITTER | ||
| 565 | /* A list of tree-sitter parsers for this buffer. */ | ||
| 566 | Lisp_Object ts_parser_list_; | ||
| 567 | #endif | ||
| 564 | /* Cursor type to display in non-selected windows. | 568 | /* Cursor type to display in non-selected windows. |
| 565 | t means to use hollow box cursor. | 569 | t means to use hollow box cursor. |
| 566 | See `cursor-type' for other values. */ | 570 | See `cursor-type' for other values. */ |