aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYuan Fu2025-03-14 22:56:18 -0700
committerYuan Fu2025-03-17 22:49:13 -0700
commit72f6cf8e77f3eac8fe2e5fc6ad29c2348314b84b (patch)
treeb532ce7842e02ddf10d9f700aa84725aac53452d /src
parentd708ebe401a2001e764821b7e43d9e9aaa23ea95 (diff)
downloademacs-72f6cf8e77f3eac8fe2e5fc6ad29c2348314b84b.tar.gz
emacs-72f6cf8e77f3eac8fe2e5fc6ad29c2348314b84b.zip
Update tree-sitter subroutine in Fsubst_char_in_region
Some explanation: Fsubst_char_in_region used to have a branch, one branch path calls replace_range, one branch path modifies the buffer directly. replace_range already calls treesit_record_change within it, so we needed to make sure we only call treesit_record_change in the other branch path. After I added the call to treesit_record_change, some changes are made to Fsubst_char_in_region, and the branch was removed. So no wonder Stefan had the confusion and wrote the FIXME note. Now that the branch is gone, we can indeed call treesit_record_change in the end like signal_after_change. * src/editfns.c (Fsubst_char_in_region): Move to end.
Diffstat (limited to 'src')
-rw-r--r--src/editfns.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/editfns.c b/src/editfns.c
index 53d6cce7c82..f4e9a022fe2 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -2325,10 +2325,6 @@ Both characters must have the same length of multi-byte form. */)
2325 record_change (pos, 1); 2325 record_change (pos, 1);
2326 for (i = 0; i < len; i++) *p++ = tostr[i]; 2326 for (i = 0; i < len; i++) *p++ = tostr[i];
2327 2327
2328#ifdef HAVE_TREE_SITTER
2329 /* FIXME: Why not do it when we `signal_after_change`? */
2330 treesit_record_change (pos_byte, pos_byte + len, pos_byte + len);
2331#endif
2332 last_changed = pos + 1; 2328 last_changed = pos + 1;
2333 } 2329 }
2334 pos_byte = pos_byte_next; 2330 pos_byte = pos_byte_next;
@@ -2337,6 +2333,9 @@ Both characters must have the same length of multi-byte form. */)
2337 2333
2338 if (changed > 0) 2334 if (changed > 0)
2339 { 2335 {
2336#ifdef HAVE_TREE_SITTER
2337 treesit_record_change (changed, last_changed, last_changed);
2338#endif
2340 signal_after_change (changed, 2339 signal_after_change (changed,
2341 last_changed - changed, last_changed - changed); 2340 last_changed - changed, last_changed - changed);
2342 update_compositions (changed, last_changed, CHECK_ALL); 2341 update_compositions (changed, last_changed, CHECK_ALL);