From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Rolf Ade Newsgroups: gmane.emacs.bugs Subject: bug#40421: 26.2; (And 27.0.90) Inconsistent fontifying in c-mode Date: Fri, 10 Apr 2020 02:50:12 +0200 Message-ID: <87wo6o88qj.fsf@pointsman.de> References: <87369k9hwx.fsf@pointsman.de> <20200404090919.52048.qmail@mail.muc.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="48513"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) Cc: 40421@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Apr 10 02:51:12 2020 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 1jMht1-000COT-9s for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 10 Apr 2020 02:51:11 +0200 Original-Received: from localhost ([::1]:57128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jMht0-0008VI-9q for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 09 Apr 2020 20:51:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33135) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jMhst-0008V7-8q for bug-gnu-emacs@gnu.org; Thu, 09 Apr 2020 20:51:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jMhsr-0002tY-Vd for bug-gnu-emacs@gnu.org; Thu, 09 Apr 2020 20:51:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43122) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jMhsr-0002tS-Sj for bug-gnu-emacs@gnu.org; Thu, 09 Apr 2020 20:51:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jMhsr-0000l4-Qc for bug-gnu-emacs@gnu.org; Thu, 09 Apr 2020 20:51:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Rolf Ade Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 10 Apr 2020 00:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40421 X-GNU-PR-Package: emacs Original-Received: via spool by 40421-submit@debbugs.gnu.org id=B40421.15864798242872 (code B ref 40421); Fri, 10 Apr 2020 00:51:01 +0000 Original-Received: (at 40421) by debbugs.gnu.org; 10 Apr 2020 00:50:24 +0000 Original-Received: from localhost ([127.0.0.1]:54668 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jMhsG-0000kF-Ip for submit@debbugs.gnu.org; Thu, 09 Apr 2020 20:50:24 -0400 Original-Received: from mxout5.interscholz.de ([85.236.196.72]:58974) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jMhsD-0000jz-Ts for 40421@debbugs.gnu.org; Thu, 09 Apr 2020 20:50:22 -0400 Original-Received: from localhost (mxout5 [127.0.0.1]) by mxout5.interscholz.de (Postfix) with ESMTP id 5063521338; Fri, 10 Apr 2020 02:50:15 +0200 (CEST) X-Virus-Scanned: interscholz amavisd-new at mxout5.interscholz.de Original-Received: from server.web01.interscholz.net (server.web01.interscholz.net [85.236.196.138]) by mxout5.interscholz.de (Postfix) with ESMTP id E411420B72; Fri, 10 Apr 2020 02:50:12 +0200 (CEST) Original-Received: from pointsman2 (p5B317438.dip0.t-ipconnect.de [91.49.116.56]) by server.web01.interscholz.net (Postfix) with ESMTPSA id 74356F0001; Fri, 10 Apr 2020 02:50:12 +0200 (CEST) In-Reply-To: <20200404090919.52048.qmail@mail.muc.de> (Alan Mackenzie's message of "4 Apr 2020 09:09:19 -0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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:178181 Archived-At: Hello Alan, Alan Mackenzie writes: > In article you wrote: > >> Recipt: > >> emacs -Q > >> Insert: > >> /* 11 */ >> EXTERN int XML_GetCurrentByteCount(XML_Parser parser); >> /* 12 */ >> EXTERN enum XML_Status XML_SetBase(XML_Parser parser, const XML_Char *base); >> /* 13 */ >> EXTERN const XML_Char * XML_GetBase(XML_Parser parser); >> /* 14 */ >> EXTERN int XML_GetSpecifiedAttributeCount(XML_Parser parser); >> /* 15 */ > >> and M-x c-mode. The font-look seems randomly. Some EXTERN colered, some >> not, some function names black, some blue. > > Yes. The problem here is that these declarations aren't syntactically > correct C. To C Mode, "EXTERN" just looks like an ordinary identifier, > not a macro which (presumably) expands to "extern". To that, or, depending on the build evironment, to something similar, yes. I can understand, that c-mode doesn't get this right. But part of the point was the apparent randomly switching of the fontification. Getting the colors wrong is one thing (but c-mode don't even got it wrong, for the first handful of function prototypes), but getting it wrong inconstently irritates particularly. But, yes ... > I would recommend you to use CC Mode's "noise macro" facility here. > (See the CC Mode manual.) With this, you would tell CC Mode that > "EXTERN" just "expands to nothing", and thus won't interfere with the > syntactic analysis. One way to do this is to set c-noise-macro-names in > a hook function, probably c-mode-common-hook. Another way (if you don't > have many source files) would be to set that variable in a file local > variables section (see the Emacs manual) - for example, put the > following at the end of your C file: > > /* Local Variables: */ > /* c-noise-macro-names: ("EXTERN") */ > /* END: */ > > . Then restart C Mode with M-x c-mode. The fontification should now > look OK. ... that works well, thanks. Sorry for the noise. >> The whole (small) file is here >> http://tdom.org/index.html/raw/generic/tdomDecls.h?name=cccb9227. With >> this syntactically correct file (at least gcc and clang consume it >> without complain) there is similiar font-lock flicker around the lines >> commented with 12, 13, 14. > > Thanks for taking the trouble to reduce the problem to a minimal test > case. That's appreciated. > >> I report this (and see it) on my working-place emacs-26.2 but have >> verified, that a freshly build emacs-27.0.90 shows the same behaviour.