diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2021-07-31 17:44:43 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2021-07-31 17:44:43 +0200 |
commit | f6c5a801efdad6cc7ed16ac0b1fa53599b84bc91 (patch) | |
tree | 733b465030587f28fc1dbf2970d646245802517d /src/insdel.c | |
parent | c4239ec32c944e74252937bfc52e341f81b7a5a4 (diff) | |
download | emacs-f6c5a801efdad6cc7ed16ac0b1fa53599b84bc91.tar.gz |
Adjust how `replace-match' runs modification hooks
* src/editfns.c (Fsubst_char_in_region)
(Ftranslate_region_internal):
* src/cmds.c (internal_self_insert): Update callers.
* src/insdel.c (replace_range): Allow inhibiting
signal_after_change/update_compositions.
* src/lisp.h: Update.
* src/search.c (Freplace_match): Run the modification hooks at the
end instead of before adjusting point (bug#42424).
Diffstat (limited to 'src/insdel.c')
-rw-r--r-- | src/insdel.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/insdel.c b/src/insdel.c index e66120eb08a..40674e15e45 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -1392,7 +1392,7 @@ adjust_after_insert (ptrdiff_t from, ptrdiff_t from_byte, void replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new, bool prepare, bool inherit, bool markers, - bool adjust_match_data) + bool adjust_match_data, bool inhibit_mod_hooks) { ptrdiff_t inschars = SCHARS (new); ptrdiff_t insbytes = SBYTES (new); @@ -1552,8 +1552,11 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new, if (adjust_match_data) update_search_regs (from, to, from + SCHARS (new)); - signal_after_change (from, nchars_del, GPT - from); - update_compositions (from, GPT, CHECK_BORDER); + if (!inhibit_mod_hooks) + { + signal_after_change (from, nchars_del, GPT - from); + update_compositions (from, GPT, CHECK_BORDER); + } } /* Replace the text from character positions FROM to TO with |