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#41284: 26.3; cc-mode: Incorrect font locking of static functions Date: Sun, 17 May 2020 19:26:38 +0000 Message-ID: <20200517192638.GA12648@ACM> References: <83v9kx1kds.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="30723"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 41284@debbugs.gnu.org To: George O'Hara Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 17 21:27:33 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 1jaOwe-0007q3-Kn for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 17 May 2020 21:27:32 +0200 Original-Received: from localhost ([::1]:45030 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jaOwd-0002a1-Nf for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 17 May 2020 15:27:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47754) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jaOwB-0002KK-NC for bug-gnu-emacs@gnu.org; Sun, 17 May 2020 15:27:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33244) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jaOwA-0002Uw-Hl for bug-gnu-emacs@gnu.org; Sun, 17 May 2020 15:27:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jaOwA-0001qF-BE for bug-gnu-emacs@gnu.org; Sun, 17 May 2020 15:27:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 17 May 2020 19:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41284 X-GNU-PR-Package: emacs Original-Received: via spool by 41284-submit@debbugs.gnu.org id=B41284.15897436027040 (code B ref 41284); Sun, 17 May 2020 19:27:02 +0000 Original-Received: (at 41284) by debbugs.gnu.org; 17 May 2020 19:26:42 +0000 Original-Received: from localhost ([127.0.0.1]:44788 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jaOvq-0001pT-9v for submit@debbugs.gnu.org; Sun, 17 May 2020 15:26:42 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:65253 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1jaOvo-0001pK-QO for 41284@debbugs.gnu.org; Sun, 17 May 2020 15:26:41 -0400 Original-Received: (qmail 18074 invoked by uid 3782); 17 May 2020 19:26:39 -0000 Original-Received: from acm.muc.de (p4FE15467.dip0.t-ipconnect.de [79.225.84.103]) by localhost.muc.de (tmda-ofmipd) with ESMTP; Sun, 17 May 2020 21:26:38 +0200 Original-Received: (qmail 11860 invoked by uid 1000); 17 May 2020 19:26:38 -0000 Content-Disposition: inline In-Reply-To: X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de 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:180504 Archived-At: Hello, George. On Fri, May 15, 2020 at 13:03:39 +0100, George O'Hara wrote: > Hi Eli! > Yes, I do mean the other way round. > I made a post on the Emacs SE with images last night, which may be useful > to link here. > https://emacs.stackexchange.com/questions/58509/static-function-highlighting-locking-in-c?noredirect=1#comment91178_58509 Could you please try out the following patch. The file cc-langs.el is in directory .../emacs/lisp/progmodes. Because the change is in a macro, you will need to rebuild all of cc-*.el to get a clean build. (If you want any help with the patching or byte compiling, feel free to send me private email.) The patch increases considerably the number of keywords which can come after the "int", when previously they had to come before it. Please let us all know whether the patch actually fixes the bug satisfactorally. Thanks! diff -r de83a122cf12 cc-langs.el --- a/cc-langs.el Fri May 15 19:04:24 2020 +0000 +++ b/cc-langs.el Sun May 17 19:12:39 2020 +0000 @@ -3402,8 +3402,14 @@ The end of the first submatch is taken as the end of the operator. Identifier syntax is in effect when this is matched (see `c-identifier-syntax-table')." - t (if (c-lang-const c-type-modifier-kwds) - (concat (regexp-opt (c-lang-const c-type-modifier-kwds) t) "\\>") + t (if (or (c-lang-const c-type-modifier-kwds) (c-lang-const c-modifier-kwds)) + (concat + (regexp-opt (c--delete-duplicates + (append (c-lang-const c-type-modifier-kwds) + (c-lang-const c-modifier-kwds)) + :test 'string-equal) + t) + "\\>") ;; Default to a regexp that never matches. "\\`a\\`") ;; Check that there's no "=" afterwards to avoid matching tokens > As an aside, I accidentally posted this bug twice. Is there a way I can > close the other issue? > Kind regards > On Fri, 15 May 2020 at 12:57, Eli Zaretskii wrote: > > > From: "George O'Hara" > > > Date: Fri, 15 May 2020 12:15:42 +0100 > > > >From 'emacs -Q', C-x C-f and create a buffer called 'test.c'. > > > In this buffer, type: > > > static int some_function(); > > > int static another_function(); > > > some_function is not highlighted, while another_function is. > > You mean, the other way around, no? -- Alan Mackenzie (Nuremberg, Germany).