GNU bug report logs -
#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
Previous Next
Full log
Message #23 received at 51766 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> 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.
The control code makes sure that all the changes made in buffer are
processed by org-element-cache. It means that
org-element--after-change-function saves the buffer-chars-modified-tick
and the next org-element--before-change-function checks if the saved
value is unchanged. If the saved value is changed, the buffer has been
changed after org-element--after-change-function, but before next
org-element--before-change-function. Such change may be arbitrary and
the whole cache is potentially obsolete.
In code, the described roughly looks like:
(defun org-element--after-change-function (...)
(setq org-element-chars-modified-tick (buffer-chars-modified-tick))
(org-element-cache-submit-request ...))
(defun org-element--before-change-function (...)
(unless (eq org-element-chars-modified-tick (buffer-chars-modified-tick))
;; Buffer has been changed without calling after-change-function
;; and we have no way to determine which part of buffer has been changed.
))
quail changes the buffer after org-element--after-change-function call,
but before org-element--before-change-function. So, all Org can see is
that something has been changed in buffer, but there is no way to tell
what it was. Org cannot distinguish between harmless buffer edits by
quail (they do not change buffer text) and other kinds of "silent"
changes.
> 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?
The hooks are called, but after quail already triggered
buffer-chars-modified-tick increase. If quail called
before-change-functions before buffer-chars-modified-tick increases, it
would be useful for my scenario. Though I am not sure how feasible it
is. Just an idea.
Best,
Ihor
This bug report was last modified 3 years and 48 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.