Subject: Re: bug#65451: 30.0.50; `after-change-functions' are not triggered in the same order the changes are made

From: Eli Zaretskii <[email-masked]>
Date: Fri, 25 Aug 2023 09:37:49 +0300

> Cc: [email-masked], [email-masked]
> Date: Thu, 24 Aug 2023 17:53:26 +0300
> From: Eli Zaretskii <[email-masked]>
> 
> If you need that from timers, then yes, all you need is access from
> the timer function to a data structure that holds the accumulated
> transactions.  Timers run approximately at the same time and under the
> same conditions as redisplay, so this mechanism will indeed ensure
> this data is accessed when Emacs is in a consistent state, and it is
> safe to access and use this data.
> 
> > Elements of the list will be like
> > [:buffer-chars-modified-tick :region-beginning :region-end-before-edit :region-end-after-edit]
> 
> If you really need buffer-chars-modified-tick, you will have to verify
> that it is updated before calling the function which updates the
> "transactions list".

Thinking about this some more, we will need to consider whether this
list of accumulated transactions is ever compacted by deleting old
transactions, or we let it grow indefinitely.  If the former, we
should consider the case where more than one feature wants to track
buffer edits (so it is impossible to remove entries once they have
been processed by a single consumer).