From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#56848: CC Mode fontification bug Date: Sun, 31 Jul 2022 08:47:29 +0300 Message-ID: <83v8rd4yvi.fsf@gnu.org> References: <8c7321f2f31d5790f916@heytings.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16698"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 56848@debbugs.gnu.org To: Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 31 07:48:18 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 1oI1oI-0004Dp-HW for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 31 Jul 2022 07:48:18 +0200 Original-Received: from localhost ([::1]:51058 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oI1oH-000490-C1 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 31 Jul 2022 01:48:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49950) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oI1o2-00048h-Qn for bug-gnu-emacs@gnu.org; Sun, 31 Jul 2022 01:48:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46520) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oI1o2-00035B-Id for bug-gnu-emacs@gnu.org; Sun, 31 Jul 2022 01:48:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oI1o2-0001sD-Aq for bug-gnu-emacs@gnu.org; Sun, 31 Jul 2022 01:48:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 31 Jul 2022 05:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56848 X-GNU-PR-Package: emacs Original-Received: via spool by 56848-submit@debbugs.gnu.org id=B56848.16592464747146 (code B ref 56848); Sun, 31 Jul 2022 05:48:02 +0000 Original-Received: (at 56848) by debbugs.gnu.org; 31 Jul 2022 05:47:54 +0000 Original-Received: from localhost ([127.0.0.1]:36269 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oI1nt-0001rA-AU for submit@debbugs.gnu.org; Sun, 31 Jul 2022 01:47:53 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:37012) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oI1np-0001q8-93 for 56848@debbugs.gnu.org; Sun, 31 Jul 2022 01:47:51 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:50014) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oI1nj-000334-QV; Sun, 31 Jul 2022 01:47:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=UMK+nyss46lajM7XfrLT2Ub+UV/HJHCDXcK88+Jz824=; b=X54L5jn+8LdH tKciE2MYoC6HLRnmgalxCsSN+51Nclifc/pu8Mo75/+LIl/ZM9q03UPojRI7R3fWjqlekqOvE2uCo J/MP7gfWtYjsGYk5QM36WHUb42PoBM4I3DwSN+6fCm/fBzys9aBGt7r0OS/57KP0bMriuIiqrPOWb c/vt190zngTBJdOkiaic00MUeHumympheFcAFwB5L2NcrE19b4zHNzWC1EIh67YSwzRlNyZrEbzAP mN0k20WXDK66d1wD180ImJCIFgq6rKBxIA4QJinnkGluQZxnFiCodUf59aUet4m55H6dAuqoO3O6y 59DynwU3yHVC/Pl4L+Mvcw==; Original-Received: from [87.69.77.57] (port=1632 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oI1nj-0001Qb-Ac; Sun, 31 Jul 2022 01:47:43 -0400 In-Reply-To: <8c7321f2f31d5790f916@heytings.org> (message from Gregory Heytings on Sun, 31 Jul 2022 00:16:37 +0000) 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:238315 Archived-At: > Date: Sun, 31 Jul 2022 00:16:37 +0000 > From: Gregory Heytings > > emacs -Q > C-x C-f src/xdisp.c RET > M-g c 28 RET > ;; take note of the word there: "window" > M-: (get-char-property 28 'fontified) RET > ;; observe that this returns t > M-g g 800 RET > C-v > M-: (get-char-property 28 'fontified) RET > ;; observe that this returns nil, because "struct window" is now visible As an aside, one should be very careful with trusting the likes of M-: (get-char-property 28 'fontified) RET because entering the minibuffer triggers a rather thorough redisplay cycle, which could change the 'fontified' property one is trying to obtain. Instead, it is advisable to write a simple command that would do the evaluation, then bind it to a single key, like F5, and invoke through that key. Even better, invoke the function from the debugger. (I'm not saying that the nil above is inaccurate, since the problematic position is outside the window, I'm just saying one should be very careful with this stuff.) FWIW, I can reproduce this on master, but not on the release branch. I thought this was related to bug#56841, but since that one happens on emacs-28 as well, it probably is a separate issue. > When font locking has put a fontified property and one of the > font-lock-*-faces on characters in the buffer, a mode should not undo that > unless it has a very good reason to do so. Otherwise scrolling again > through an already fontified buffer calls fontification functions again > without reason. The fact that the word 'window' is involved in both cases seems to ring a bell: isn't there a feature in CC Mode's fontifications whereby it does something with identifiers whose type it knows about, by going forward and back into the buffer and "fixing" their fontifications? Thanks.