[Top][All Lists]

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

bug#51766: 29.0.50; Return value of buffer-chars-modified-tick changes w

From: Eli Zaretskii
Subject: 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
Date: Fri, 12 Nov 2021 14:15:55 +0200

> From: Ihor Radchenko <yantar92@gmail.com>
> Cc: 51766@debbugs.gnu.org
> Date: Fri, 12 Nov 2021 20:06:41 +0800
> Org has a caching mechanism (org-element-cache) that keeps parsed buffer
> representation in memory and updates it on the fly as the buffer
> changes. To make the mechanism work, Org must keep track of all the
> changes in buffer and update the affected Org elements in memory.
> Naturally, this is done using before/after-change-functions.
> However, some third-party code carelessly uses
> inhibit-modification-hooks and some edits may be missed by element
> cache. If we just ignore the possibility of such edits, cache can be
> broken badly. So, there is currently a control code that detects if
> buffer has been changed outside the Org's change functions. The control
> code uses buffer-chars-modified-tick.
> The behaviour of quail.el makes the control code useless -
> buffer-chars-modified-tick can no longer be reliably used to detect
> unfavourable "stealthy" changes.

This last part I don't think I understand: why does quail's behavior
make the control code useless?  The value returned by
buffer-chars-modified-tick still increases in your recipe, so what
exactly is the aspect of that behavior that makes the control code
useless?  I think some additional details here are missing from your
description which could explain the issue.

> > 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.
> I understand the idea behind suppressing the modification hooks by
> quail. Though it would be helpful if before-change-functions were called
> before inserting+deleting a character by quail is done.

I don't understand this, either.  Are you saying that inserting a
character via an input method doesn't call buffer-modification hooks
even once?  If the hooks are called, then what exactly is the problem
with the hooks in this scenario?

reply via email to

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