From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Alan Mackenzie <acm@muc.de>, Ihor Radchenko <yantar92@posteo.net>,
65451@debbugs.gnu.org
Subject: bug#65451: 30.0.50; `after-change-functions' are not triggered in the same order the changes are made
Date: Sat, 30 Mar 2024 23:02:14 -0400 [thread overview]
Message-ID: <jwv8r1zt896.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <jwvmsqfvns7.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sat, 30 Mar 2024 09:51:59 -0400")
> I suspect the best option in the above case is to inhibit the inner
> calls to before/after (assuming we're sure they change only the "new
> text"), so we'd be down to:
>
> ⛔ Warning (emacs): Before: 1278 1281
> ⛔ Warning (emacs): After: 1278 1288 delta: 7
A simpler option is the patch below.
Stefan
diff --git a/src/search.c b/src/search.c
index 2ad565fadde..83ff7120e43 100644
--- a/src/search.c
+++ b/src/search.c
@@ -2769,6 +2769,8 @@ DEFUN ("replace-match", Freplace_match, Sreplace_match, 1, 5, 0,
/* Replace the old text with the new in the cleanest possible way. */
replace_range (sub_start, sub_end, newtext, 1, 0, 1, true, true);
+ signal_after_change (sub_start, sub_end - sub_start, SCHARS (newtext));
+
if (case_action == all_caps)
Fupcase_region (make_fixnum (search_regs.start[sub]),
make_fixnum (newpoint),
@@ -2792,7 +2794,6 @@ DEFUN ("replace-match", Freplace_match, Sreplace_match, 1, 5, 0,
/* Now move point "officially" to the end of the inserted replacement. */
move_if_not_intangible (newpoint);
- signal_after_change (sub_start, sub_end - sub_start, SCHARS (newtext));
update_compositions (sub_start, newpoint, CHECK_BORDER);
return Qnil;
next prev parent reply other threads:[~2024-03-31 3:02 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-22 9:30 bug#65451: 30.0.50; `after-change-functions' are not triggered in the same order the changes are made Ihor Radchenko
2023-08-22 12:22 ` Eli Zaretskii
2023-08-22 12:42 ` Ihor Radchenko
2023-08-22 12:58 ` Eli Zaretskii
2023-08-22 13:41 ` Ihor Radchenko
2023-08-22 16:02 ` Eli Zaretskii
2023-08-23 8:52 ` Ihor Radchenko
2023-08-23 17:58 ` Eli Zaretskii
2023-08-24 7:46 ` Ihor Radchenko
2023-08-24 8:08 ` Eli Zaretskii
2023-08-24 11:24 ` Ihor Radchenko
2023-08-24 12:08 ` Eli Zaretskii
2023-08-24 13:27 ` Ihor Radchenko
2023-08-24 14:53 ` Eli Zaretskii
2023-08-25 6:37 ` Eli Zaretskii
2023-08-25 9:09 ` Ihor Radchenko
2023-08-26 7:10 ` Eli Zaretskii
2023-08-27 8:13 ` Ihor Radchenko
2023-08-27 8:29 ` Eli Zaretskii
2023-08-29 7:39 ` Ihor Radchenko
2023-08-25 8:09 ` Ihor Radchenko
2023-08-25 10:25 ` Eli Zaretskii
2023-08-25 10:49 ` Ihor Radchenko
2024-03-30 13:51 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-30 14:11 ` Eli Zaretskii
2024-03-30 15:38 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-30 16:47 ` Eli Zaretskii
2024-03-31 3:04 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-31 3:02 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-03-31 6:06 ` Eli Zaretskii
2024-03-31 13:57 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-07 18:19 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-08 19:10 ` Ihor Radchenko
2024-04-07 18:19 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwv8r1zt896.fsf-monnier+emacs@gnu.org \
--to=bug-gnu-emacs@gnu.org \
--cc=65451@debbugs.gnu.org \
--cc=acm@muc.de \
--cc=eliz@gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=yantar92@posteo.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).