]> git.eshelyaron.com Git - emacs.git/commit
Change treesit-parser-list from variable to function
authorYuan Fu <yuan@debian-BULLSEYE-live-builder-AMD64>
Fri, 17 Jun 2022 00:55:07 +0000 (17:55 -0700)
committerYuan Fu <yuan@debian-BULLSEYE-live-builder-AMD64>
Fri, 17 Jun 2022 00:55:07 +0000 (17:55 -0700)
commit246dbb540a32fd5e68ae0665527717943ebb69b1
tree7a2520f82c4775edc9da948630d4db11d5868f68
parent33f7e10a29dad475f7872d6af87ecefaccdb55fc
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.
doc/lispref/parsing.texi
lisp/treesit.el
src/buffer.c
src/buffer.h
src/treesit.c
test/src/treesit-tests.el