From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#40421: 26.2; (And 27.0.90) Inconsistent fontifying in c-mode Date: 4 Apr 2020 09:09:19 -0000 Organization: muc.de e.V. Message-ID: <20200404090919.52048.qmail@mail.muc.de> References: <87369k9hwx.fsf@pointsman.de> Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="70341"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: tin/2.4.3-20181224 ("Glen Mhor") (UNIX) (FreeBSD/11.3-RELEASE-p3 (amd64)) Cc: 40421@debbugs.gnu.org To: Rolf Ade Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 04 11:10:21 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 1jKeom-000IBD-NQ for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 04 Apr 2020 11:10:20 +0200 Original-Received: from localhost ([::1]:36810 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKeol-0000aI-6J for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 04 Apr 2020 05:10:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52158) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKeoV-0000a9-7D for bug-gnu-emacs@gnu.org; Sat, 04 Apr 2020 05:10:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKeoU-0000me-2S for bug-gnu-emacs@gnu.org; Sat, 04 Apr 2020 05:10:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60126) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jKeoT-0000mW-Vd for bug-gnu-emacs@gnu.org; Sat, 04 Apr 2020 05:10:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jKeoT-00034C-No for bug-gnu-emacs@gnu.org; Sat, 04 Apr 2020 05:10:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 Apr 2020 09:10: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.158599136211653 (code B ref 40421); Sat, 04 Apr 2020 09:10:01 +0000 Original-Received: (at 40421) by debbugs.gnu.org; 4 Apr 2020 09:09:22 +0000 Original-Received: from localhost ([127.0.0.1]:43439 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jKenq-00031t-KW for submit@debbugs.gnu.org; Sat, 04 Apr 2020 05:09:22 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:29575 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1jKeno-00031i-Ma for 40421@debbugs.gnu.org; Sat, 04 Apr 2020 05:09:21 -0400 Original-Received: (qmail 52049 invoked by uid 3782); 4 Apr 2020 09:09:19 -0000 In-Reply-To: X-Newsgroups: gnu.emacs.bug 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:178013 Archived-At: Hello, Rolf. 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". 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. > 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. -- Alan Mackenzie (Nuremberg, Germany).