From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gregory Heytings Newsgroups: gmane.emacs.bugs Subject: bug#56848: CC Mode fontification bug Date: Sun, 31 Jul 2022 08:08:45 +0000 Message-ID: <8c7321f2f3e4c925e697@heytings.org> References: <8c7321f2f31d5790f916@heytings.org> <83v8rd4yvi.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3202"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 56848@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 31 10:09:35 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 1oI410-0000g9-54 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 31 Jul 2022 10:09:34 +0200 Original-Received: from localhost ([::1]:38782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oI40y-0007Es-UH for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 31 Jul 2022 04:09:33 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34132) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oI40V-0007Ec-HA for bug-gnu-emacs@gnu.org; Sun, 31 Jul 2022 04:09:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46586) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oI40U-0004bs-KG for bug-gnu-emacs@gnu.org; Sun, 31 Jul 2022 04:09:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oI40U-0005mr-CN for bug-gnu-emacs@gnu.org; Sun, 31 Jul 2022 04:09:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gregory Heytings Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 31 Jul 2022 08:09: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.165925493022205 (code B ref 56848); Sun, 31 Jul 2022 08:09:02 +0000 Original-Received: (at 56848) by debbugs.gnu.org; 31 Jul 2022 08:08:50 +0000 Original-Received: from localhost ([127.0.0.1]:36331 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oI40H-0005m5-UR for submit@debbugs.gnu.org; Sun, 31 Jul 2022 04:08:50 -0400 Original-Received: from heytings.org ([95.142.160.155]:60202) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oI40F-0005lw-QA for 56848@debbugs.gnu.org; Sun, 31 Jul 2022 04:08:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20220101; t=1659254925; bh=0ky+hMLZJhWIG3tFmEzKX4LlIIEoMJ/edIbyjFgvADw=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=TRgmVaWjfWNI4HdsF6Ynu4BpGa7fhH74GnGymv1t9WwZjdFOBPEXKHHU2MKWor2Cs EDVoRJNBgpkPF03OICcGnh2ICSQBRzuRLtODaxzWWYPJ10l+IXFeHgz03HWj+GHoDt DpAbh5lX+XZFuigoummDyj9X7qe2Q7KbIDytB2X5rBLm28w4Esfzs9oGmcWvCGPRmX B7YRwJ2SvxCJLpSy+CBIgwE5WzHNb8Ro17n5myNnhZxJ2Lb+JyIz8vD0iIeqtzhrdK 7FF0D+3vBO6sB88og9W6mnj5crKAk53iZsvuZqucNrswwhG7BC3D5ROK6IFoNY2dfD /EInbStAhaBbQ== In-Reply-To: <83v8rd4yvi.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:238320 Archived-At: > > 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.) > Indeed, I tried to make the recipe as simple as possible, but during my tests I did use such a function. > > 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? > Yes, that's what the 'c-fontify-new-found-type' modified by the patch does. Currently, when a new type has been found, all occurrences of its identifier are "unfontified" with: (widen) (goto-char (point-min)) (while (re-search-forward ...) (put-text-property ... 'fontified nil)) When font locking has already put, say, a font-lock-comment-face, or a font-lock-function-name-face, or a font-lock-variable-name-face on an occurrence of that identifier, there is no reason to undo that. It is only occurrences that have been marked as "fontified" but on which no face has been put that should be unfontified.