summaryrefslogtreecommitdiff
path: root/admin
diff options
context:
space:
mode:
authorStefan Kangas <stefankangas@gmail.com>2023-02-03 06:30:24 +0100
committerStefan Kangas <stefankangas@gmail.com>2023-02-03 06:30:24 +0100
commitac7ec87a7a0db887e4ae7fe9005aea517958b778 (patch)
treec6f9cc435f6389e368fdf2af5c0e7fd9b7c5a729 /admin
parentbfd338aad9d1e6bf898fc19d23e1a5ca4e696316 (diff)
parent96ea27278b43ae5ea72643881015944a819f7974 (diff)
downloademacs-ac7ec87a7a0db887e4ae7fe9005aea517958b778.tar.gz
Merge from origin/emacs-29
96ea27278b4 ; Fix c-ts-mode indent test d963a8f1355 Make c-ts-mode indent tests side-effect-free 8a6bdf88b4b Call treesit_record_change in insert_from_gap_1 a2b77c79dcc Use c-ts-common-statement-offset for closing brackets too 74e715cb729 ; Go back to original point when filling comments in c-ts... b8009bbf2d8 ; Fix error where we pass t to treesit-node-type in c-ts-... 88ccf78b206 ; * src/treesit.c (treesit_predicate_match): Simplify las... 20454128b8b Minor improvements in sqlite.c 3b3c47d977b (treesit_predicate_match): Match node text against regexp... e8334781c9f Improve documentation of gdb-mi's dedicated windows c4988840598 Avoid spurious pause in kill-ring-save (Bug#60841) 382ab516cef Change the default of 'treesit-defun-tactic' for 'c-ts-mode' 4d3428e95a9 Fix docstring fontification of CL's 'defstruct' 1c125baa3f0 Teach 'hs-minor-mode' about tree-sitter based modes 2de0ab5cbd3 ; Doc fixes in keymap.el c6660a6d6de Improve documentation of 'repeat-mode' and related variables be304bb3286 ; * etc/NEWS: Mention the 'utf-8-auto' bugfix (bug#60750). # Conflicts: # etc/NEWS
Diffstat (limited to 'admin')
-rw-r--r--admin/notes/tree-sitter/treesit_record_change50
1 files changed, 50 insertions, 0 deletions
diff --git a/admin/notes/tree-sitter/treesit_record_change b/admin/notes/tree-sitter/treesit_record_change
new file mode 100644
index 00000000000..bb0f9edc353
--- /dev/null
+++ b/admin/notes/tree-sitter/treesit_record_change
@@ -0,0 +1,50 @@
+NOTES ON TREESIT_RECORD_CHANGE
+
+It is vital that Emacs informs tree-sitter of every change made to the
+buffer, lest tree-sitter's parse tree would be corrupted/out of sync.
+
+All buffer changes in Emacs are made through functions in insdel.c
+(and casefiddle.c), I augmented functions in those files with calls to
+treesit_record_change. Below is a manifest of all the relavent
+functions in insdel.c as of Emacs 29:
+
+Function Calls
+----------------------------------------------------------------------
+copy_text (*1)
+insert insert_1_both
+insert_and_inherit insert_1_both
+insert_char insert
+insert_string insert
+insert_before_markers insert_1_both
+insert_before_markers_and_inherit insert_1_both
+insert_1_both treesit_record_change
+insert_from_string insert_from_string_1
+insert_from_string_before_markers insert_from_string_1
+insert_from_string_1 treesit_record_change
+insert_from_gap_1 treesit_record_change
+insert_from_gap insert_from_gap_1
+insert_from_buffer treesit_record_change
+insert_from_buffer_1 (used by insert_from_buffer) (*2)
+replace_range treesit_record_change
+replace_range_2 (caller needs to call treesit_r_c)
+del_range del_range_1
+del_range_1 del_range_2
+del_range_byte del_range_2
+del_range_both del_range_2
+del_range_2 treesit_record_change
+
+(*1) This functions is used only to copy from string to string when
+used outside of insdel.c, and when used inside insdel.c, the caller
+calls treesit_record_change.
+
+(*2) This function is a static function, and insert_from_buffer is its
+only caller. So it should be fine to call treesit_record_change in
+insert_from_buffer but not insert_from_buffer_1. I also left a
+reminder comment.
+
+
+As for casefiddle.c, do_casify_unibyte_region and
+do_casify_multibyte_region modifies buffer, but they are static
+functions and are called by casify_region, which calls
+treesit_record_change. Other higher-level functions calls
+casify_region to do the work. \ No newline at end of file