[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-29 e982192e933 1/3: Call treesit_record_change in subst-char-in-re
From: |
Yuan Fu |
Subject: |
emacs-29 e982192e933 1/3: Call treesit_record_change in subst-char-in-region (bug#64329) |
Date: |
Thu, 29 Jun 2023 14:16:29 -0400 (EDT) |
branch: emacs-29
commit e982192e93369265cca7827065e13bf1f71aad13
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>
Call treesit_record_change in subst-char-in-region (bug#64329)
* src/editfns.c (Fsubst_char_in_region): Call treesit_record_change in
the else branch.
---
src/editfns.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/editfns.c b/src/editfns.c
index d02cce4aef3..0cbeefb3262 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -55,6 +55,11 @@ along with GNU Emacs. If not, see
<https://www.gnu.org/licenses/>. */
#ifdef WINDOWSNT
# include "w32common.h"
#endif
+
+#ifdef HAVE_TREE_SITTER
+#include "treesit.h"
+#endif
+
static void update_buffer_properties (ptrdiff_t, ptrdiff_t);
static Lisp_Object styled_format (ptrdiff_t, Lisp_Object *, bool);
@@ -2391,6 +2396,14 @@ Both characters must have the same length of multi-byte
form. */)
if (NILP (noundo))
record_change (pos, 1);
for (i = 0; i < len; i++) *p++ = tostr[i];
+
+#ifdef HAVE_TREE_SITTER
+ /* In the previous branch, replace_range() notifies
+ changes to tree-sitter, but in this branch, we
+ modified buffer content manually, so we need to
+ notify tree-sitter manually. */
+ treesit_record_change (pos_byte, pos_byte + len, pos_byte + len);
+#endif
}
last_changed = pos + 1;
}