bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#65451: 30.0.50; `after-change-functions' are not triggered in the sa


From: Eli Zaretskii
Subject: bug#65451: 30.0.50; `after-change-functions' are not triggered in the same order the changes are made
Date: Thu, 24 Aug 2023 17:53:26 +0300

> From: Ihor Radchenko <yantar92@posteo.net>
> Cc: casouri@gmail.com, 65451@debbugs.gnu.org
> Date: Thu, 24 Aug 2023 13:27:02 +0000
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > When exactly do you need this to run?  At the same time as
> > after-change-functions doesn't sound like a good idea to me, but I
> > think you don't need to run it there.  What about running just before
> > redisplay kicks in?
> 
> Usually, we need to update AST when some other Elisp code needs Org
> element API. And we update AST on idle timer to speed things up.
> 
> What if we use no hooks at all? Instead, the edit transactions are
> accumulated in a list that can be examined and processed by Elisp code
> as needed.

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".





reply via email to

[Prev in Thread] Current Thread [Next in Thread]