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

Package: emacs;

Reported by: Ihor Radchenko <yantar92 <at> gmail.com>

Date: Thu, 11 Nov 2021 13:56:01 UTC

Severity: normal

Found in version 29.0.50

Full log


Message #92 received at 51766 <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 51766 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: Re: string-pixel-width limitations (was: 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: Tue, 21 Jun 2022 21:03:43 +0800
Note that I changed the topic in this particular branch. My aim here is
to make you aware about the issues with current Emacs tools to measure
pixel-precise string width. Maybe, things can be improved on Emacs side
in this regard.

The below is going back to the initial topic.

Eli Zaretskii <eliz <at> gnu.org> writes:

> Anyway, the beginning of this sub-thread, specifically about valign,
> was in the context of Lisp programs that do buffer modifications under
> with-silent-modifications or equivalent, and valign seems to do that
> because it just needs to measure the pixel width of a string, and it
> does that by inserting the string and then removing it.  So in that
> case, the "buffer modifications" are indeed null and void, and Org
> shouldn't be bothered by such "modifications", because the buffer
> really remains unmodified.  Right?

In short, you are right. To clarify the problem on my side goes like:

1. Org has a real issue with bad third-party code inhibiting
   before/after-change function + modifications in indirect buffers not
   always triggering before/after-change
2. Because the issue is critical and can cause data corruption, we
   cannot just ignore it
3. The first attempt to detect "stealthy" modifications was using
   buffer-chars-modified-tick
4. But this method is not reliable because (a) quail does some legit
   edits under inhibit-modification-hooks; (b) some other code, like
   valign also does legit edits under inhibit-modification-hooks
   These buffer modifications are harmless from Org perspective.
5. However, We end up with numerous false-positives using (3) and I am
   clueless how to reliably detect or work around harmful "stealthy"
   edits

   - The suggestion to compare buffer size is helpful, but not 100%
     reliable
   - My other idea to request before/after-change function variants are
     too specific to the problem at hand and may be not good for Emacs
     in a whole

In any case, bug#51766 should not be considered a bug because quail does
modify the buffer and changes in buffer-chars-modified-tick are legit.

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.