GNU bug report logs -
#78042
31.0.50; Improper sequence of `before/after-change-functions` calls
Previous Next
Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>
Date: Thu, 24 Apr 2025 15:40:02 UTC
Severity: normal
Found in version 31.0.50
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
>> The rest of the code in this function modifies the buffer without
>> running any `before/after-change-functions` (except for things like
>> charset properties, which is what I'm trying to suppress), so if a caller
>> fails to run those hooks we'd know (and the above patch wouldn't make
>> it worse).
>
> I was asking how will we be able to make sure the caller does run the
> modification hooks.
The function where I made the modification inserts bytes into
the buffer but without running the hooks.
So it is *already* the case that the callers must run the hooks
themselves.
> I don't quite understand what you mean by "we'd know". Know how and by what signs?
We would have noticed it because when those hooks are not run something
*will* misbehave sooner or later, and for a common operation like
`de/encode-coding-region`, it'll be sooner rather than later.
I also know because I'm running my own Emacs with additional checks to
detect when our change-functions break our promises, so that I can fix
those bugs before they bite someone.
>> > And how do we document this incompatible change in NEWS?
>> It's a bug fix, not an incompatible change.
> We now require callers to do something they didn't have to do before,
> or am I missing something?
Yes you're missing that the callers have always had to do that because
in the usual case, there is no nested modifications (because the decode
does not add any text-properties), and the function just inserts text
into the buffer without running any change-functions.
Stefan
This bug report was last modified 17 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.