Subject: bug#78221: 31.0.50; Improving *-change-functions notifications

From: Stefan Monnier <[email-masked]>
Date: Sun, 04 May 2025 09:01:35 -0400

>>> Org mode currently has to resort to (eq
>>> org-fold-core--last-buffer-chars-modified-tick
>>> (buffer-chars-modified-tick)) checks to filter out changes in
>>> text properties.
>> Interesting.  What made you do that?  IME, it's fairly rare for
>> text-property changes to trigger such notifications.
> Some parts of Org mode (org-agenda, org-sparse-tree) use text properties
> and trigger the notifications; usually that happens across the whole
> buffer. And when that does happen, expensive processing of buffer
> changes makes things very slow.

I see.  But then, why fix it on the side of your `*-change-functions`
rather than on using `inhibit-modification-hooks` (so it benefits all
the `*-change-functions`)?

IME, most ELisp code which calls things like `put-text-property` usually
does so within a `with-silent-modifications` wrapper, and not only to
avoid running `*-change-functions`: also to avoid setting the
`buffer-modified-p` flag or getting prompted if some other session is
modifying the same file at the same time, etc...

        Stefan