summaryrefslogtreecommitdiff
path: root/src/emacs.c
diff options
context:
space:
mode:
authorYuan Fu <casouri@gmail.com>2022-03-12 22:10:06 -0800
committerYuan Fu <casouri@gmail.com>2022-05-07 01:11:39 -0700
commit84847cad82e3b667c82f411627cd58d236f55e84 (patch)
treed0cb76d6977d88ae0b263a55dd0b8f0a705fa52f /src/emacs.c
parent22dde4e621fb49b9f05d560aee22332ad60bf485 (diff)
downloademacs-84847cad82e3b667c82f411627cd58d236f55e84.tar.gz
emacs-84847cad82e3b667c82f411627cd58d236f55e84.tar.bz2
emacs-84847cad82e3b667c82f411627cd58d236f55e84.zip
Add tree-sitter intergration
* configure.ac (HAVE_TREE_SITTER, TREE_SITTER_OBJ): New variables. (DYNAMIC_LIB_SUFFIX): new variable, I copied code from MODULES_SUFFIX so the diff looks this way. * doc/lispref/elisp.texi (Top): Add tree-sitter manual. * doc/lispref/modes.texi (Font Lock Mode): mention tree-sitter. (Parser-based Font Lock): New section. (Auto-Indentation): Mention tree-sitter. (Parser-based Indentation): New section. * doc/lispref/parsing.texi (Parsing Program Source): New chapter. * lisp/emacs-lisp/cl-preloaded.el (cl--typeof-types): Add treesit-parser and treesit-node type. * lisp/treesit.el: New file. * src/Makefile.in (TREE_SITTER_LIBS, TREE_SITTER_FLAGS, TREE_SITTER_OBJ): New variables. * src/alloc.c: (cleanup_vector): Add cleanup code for treesit-parser and treesit-node. * src/casefiddle.c (casify_region): Notify tree-sitter parser of buffer change. * src/data.c (Ftype_of): Add treesit-parser and treesit-node type (Qtreesit_parser, Qtreesit_node): New symbol. * src/emacs.c (main): Add symbols in treesit.c. * src/eval.c (define_error): Move the function to here. * src/insdel.c (insert_1_both, insert_from_string_1, insert_from_gap, insert_from_buffer_1, replace_range, del_range_2): Notify tree-sitter parser of buffer change. * src/json.c (define_error): Move this function out. * src/lisp.h (DEFINE_GDB_SYMBOL_BEGIN): Add treesit-parser and treesit-node. * src/lread.c (Vdynamic_library_suffixes): New variable. * src/print.c (print_vectorlike): Add code for printing treesit-parser and treesit-node. * src/treesit.c: New file. * src/treesit.h: New file. * test/src/treesit-tests.el: New file.
Diffstat (limited to 'src/emacs.c')
-rw-r--r--src/emacs.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/emacs.c b/src/emacs.c
index d1060bca0b3..9a14e103759 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -136,6 +136,10 @@ extern char etext;
#include <sys/resource.h>
#endif
+#ifdef HAVE_TREE_SITTER
+#include "treesit.h"
+#endif
+
#include "pdumper.h"
#include "fingerprint.h"
#include "epaths.h"
@@ -2181,6 +2185,9 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
syms_of_module ();
#endif
+#ifdef HAVE_TREE_SITTER
+ syms_of_treesit ();
+#endif
#ifdef HAVE_SOUND
syms_of_sound ();
#endif