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

From: Stefan Monnier <[email-masked]>
Date: Sat, 03 May 2025 22:48:10 -0400

>>   Or we could rely on a (symbol) property being set on the functions
>>   added to `*-change-functions` to tell whether they want to know about
>>   changes to text-properties or not.
>>   Or maybe a more crude way would be a buffer-local variable controlling
>>   whether `*-change-functions` are called for text-property changes.
> Or pass a 4th parameter to *-change-functions indicating whether the
> change involved actual text edits or it only touched text-properties.

But many functions used on this hook don't accept 4 parameters, so
that's not backward compatible.

[ FWIW: In my local Emacs, I used another incompatible approach which is
  to pass `t` for the `oldlen` argument, since text-property changes
  don't change the length.  It seems not to cause too much trouble: most
  hooks don't pay attention to `oldlen` and most text-property changes
  are wrapped in `inhibit-modification-hooks`, but I did have to tweak
  the code at a few spots.  ]

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

        Stefan