Subject: Re: bug#51766: 29.0.50; Return value of buffer-chars-modified-tick changes when buffer text is not yet changed before inserting a character for non-latin input methods

From: Eli Zaretskii <[email-masked]>
Date: Thu, 11 Nov 2021 19:35:19 +0200

> From: Ihor Radchenko <[email-masked]>
> Cc: [email-masked]
> Date: Thu, 11 Nov 2021 23:50:31 +0800
> 
> Of course, there might be some kind of invisible change in buffer. I.e.
> text is added and immediately deleted from the buffer without redisplay.

That's exactly what happens: quail.el deletes the inserted character
and then reinserts it (for reasons unrelated to this issue).  So the
count of the changes is not equal to the number of characters actually
inserted.  I see no problem here, since the documentation never
promises that the difference between the values returned by successive
calls to buffer-chars-modified-tick will be exactly equal to the
number of inserted or deleted characters.

So if Org relies on such an equality, it's a bug in Org (but I didn't
look at the relevant Org code, and don't have a clear idea of how
exactly it uses the above function for whatever it is caching).

> However, even if there is any change like that, before-change-functions
> and after-change-functions are not triggered. That would be another bug
> then.

quail.el inhibit buffer modifications in places, since otherwise you'd
have too many of them.  It wants to pretend that just one character
was inserted.