From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.bugs Subject: bug#51766: 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 Message-ID: <874k0eqic0.fsf@localhost> References: <87mtmalrs1.fsf@localhost> <837dde200c.fsf@gnu.org> <87k0helmig.fsf@localhost> <831r3m1tpk.fsf@gnu.org> <8735o1r31q.fsf@localhost> <834k8hzi10.fsf@gnu.org> <87zgq9pmb6.fsf@localhost> <831r3lzfk4.fsf@gnu.org> <87wnldpk5x.fsf@localhost> <83zgq9xv1y.fsf@gnu.org> <87r1bkpgjw.fsf@localhost> <87y1xv7ggf.fsf@localhost> <838rpvpns3.fsf@gnu.org> <8735fyslgq.fsf@localhost> <83fsjyl3sz.fsf@gnu.org> <87r13iqo19.fsf@localhost> <834k0eky7h.fsf@gnu.org> <87a6a6qjgx.fsf@localhost> <83y1xqji8z.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="928"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 51766@debbugs.gnu.org, monnier@iro.umontreal.ca To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 21 15:11:58 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o3dfh-000AVU-Bo for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 21 Jun 2022 15:11:57 +0200 Original-Received: from localhost ([::1]:50606 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o3dff-0005eN-Th for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 21 Jun 2022 09:11:55 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56540) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3dX4-00023m-5p for bug-gnu-emacs@gnu.org; Tue, 21 Jun 2022 09:03:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37288) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o3dX3-0005wS-St for bug-gnu-emacs@gnu.org; Tue, 21 Jun 2022 09:03:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o3dX3-0006Y1-OE for bug-gnu-emacs@gnu.org; Tue, 21 Jun 2022 09:03:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ihor Radchenko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 21 Jun 2022 13:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51766 X-GNU-PR-Package: emacs Original-Received: via spool by 51766-submit@debbugs.gnu.org id=B51766.165581656125139 (code B ref 51766); Tue, 21 Jun 2022 13:03:01 +0000 Original-Received: (at 51766) by debbugs.gnu.org; 21 Jun 2022 13:02:41 +0000 Original-Received: from localhost ([127.0.0.1]:59418 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o3dWj-0006XP-H5 for submit@debbugs.gnu.org; Tue, 21 Jun 2022 09:02:41 -0400 Original-Received: from mail-pg1-f179.google.com ([209.85.215.179]:39624) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o3dWg-0006XD-Cg for 51766@debbugs.gnu.org; Tue, 21 Jun 2022 09:02:40 -0400 Original-Received: by mail-pg1-f179.google.com with SMTP id q140so13056659pgq.6 for <51766@debbugs.gnu.org>; Tue, 21 Jun 2022 06:02:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=h5YwIdkW9oGy8Q9gioUDBtzYwa6UGmmH4XPwdJL65Lo=; b=pFh9Z48+u2WLknzYwCM3ZpI9yCDHCz2cTQuO1314e75D9wKNgBFxLcERyhLvqKxHk4 RJUvR46YuZL1KixaHjhcSNFyNqwAqJzp2ctgMuLYNGzBGWKK2hN15AjP3P2qvLs4w24m jk2hTdNhjHs0s2vLRZ8Pjg7zCrQvaycbq7yctqS4tjf8JkBqBgF6R+PK/yrbfkwMQFzN /IEctKSLaBU0nJoqeNi1vfROFTKDCFD+mTBA3DNFxdMa3VyUMhqTUUz/G3GRg9jadvEI aD+L2m/7ZJgig0FGgwK6XyGIQKVvxIGaujHW8Kk/BBhWKvs/R5aQa8tCTfCqVXw3C6GV AZtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=h5YwIdkW9oGy8Q9gioUDBtzYwa6UGmmH4XPwdJL65Lo=; b=RQEY5c6Qap/kSPdet5iZPsbogj2ogrrXrNYSSJ3s9lYxloFLBonfYKFWKKdpVCNImW BHushzGnP/3p9WZ5UsnL9TSlN/DNWSzHd04MlFk2knE11skoTpK4Dnxqp7Z67EdGlE0K Jt9aHFbS6nq5/3RODeYTk8cL3mCG2o/eTBKi71a1cS4fTQHmFsRLQlwbmaJDpZXsRxl4 sBXNpIurYWM47L2Zh4sv8cUvsJ2RSlzr5MO13LuoHYsicSNEeWw5bsB0qXLWszXq3EA/ jq2DkkEIdbhbDKnqyOEYMleHATIxI/mM/dEHT6De8cYxUtoD74pAe2kQV3LnnaXclg3u 8FxQ== X-Gm-Message-State: AJIora+84fAD7KumdPTxrnOeBByRmWr5jqMAPNxxgFrhOGSwkXRbl71q Jkh/mD0yOx1XcjVZhd+w48s= X-Google-Smtp-Source: AGRyM1toKTJy0HTUq3eUA20pXMC3LooZsSjbUI2aDOZBO4Ji2xHgVDWnv1PoQJdLLDwQqOP2eo99nw== X-Received: by 2002:a63:4f04:0:b0:408:8206:5bcd with SMTP id d4-20020a634f04000000b0040882065bcdmr26461540pgb.105.1655816552445; Tue, 21 Jun 2022 06:02:32 -0700 (PDT) Original-Received: from localhost ([155.94.207.39]) by smtp.gmail.com with ESMTPSA id ij11-20020a170902ab4b00b0016a0bf0ce32sm7474495plb.70.2022.06.21.06.02.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 06:02:31 -0700 (PDT) In-Reply-To: <83y1xqji8z.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:234962 Archived-At: 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 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