all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: George O'Hara <georgeohara92@gmail.com>
Cc: 41284@debbugs.gnu.org
Subject: bug#41284: 26.3; cc-mode: Incorrect font locking of static functions
Date: Sun, 17 May 2020 19:26:38 +0000	[thread overview]
Message-ID: <20200517192638.GA12648@ACM> (raw)
In-Reply-To: <CAHHF0DZMG9c0Pt3LSfx5VOg5sQW4=JAV1YYuKEYWDA9hQ3U7DA@mail.gmail.com>

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 <eliz@gnu.org> wrote:

> > > From: "George O'Hara" <georgeohara92@gmail.com>
> > > 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).





  reply	other threads:[~2020-05-17 19:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-15 11:15 bug#41284: 26.3; cc-mode: Incorrect font locking of static functions George O'Hara
2020-05-15 11:57 ` Eli Zaretskii
2020-05-15 12:03   ` George O'Hara
2020-05-17 19:26     ` Alan Mackenzie [this message]
     [not found]       ` <CAHHF0DZ_wUH92NS+Nf0-qQL1zzSQTBPd7xEY1MDXQunt0mf9hA@mail.gmail.com>
2020-05-18 18:38         ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200517192638.GA12648@ACM \
    --to=acm@muc.de \
    --cc=41284@debbugs.gnu.org \
    --cc=georgeohara92@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.