Subject: Re: bug#78042: 31.0.50; Improper sequence of `before/after-change-functions` calls

From: Stefan Monnier <[email-masked]>
Date: Sat, 26 Apr 2025 12:35:43 -0400

>> My request for comments/objection was not about whether it is worth
>> fixing this bug (there is no doubt about that on my side: it affects at
>> least Eglot and CC-mode), but whether the approach I used is acceptable
>> or if you have a better alternative to propose.
> The only alternative I can think of is to be able to handle nested
> notifications, such as what happens in this case, as correct.  What
> are the problems due to which we must have paired notifications
> without nesting?

The problem is that it would change the semantics of
`after/before-change-functions`.  E.g. code that needs to match the
before with the after (e.g. CC-mode, Eglot, ...) would now need to be
adjusted to keep a stack of "pending befores" and the C code would need
to be reviewed to try and catch the few places where we currently run
`after-change-functions` several times after running
`before-change-functions` once.

IOW, we'd trade one set of corner-case breakage for another.

        Stefan