GNU bug report logs -
#41284
26.3; cc-mode: Incorrect font locking of static functions
Previous Next
Full log
View this message in rfc822 format
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 <at> gnu.org> wrote:
> > > From: "George O'Hara" <georgeohara92 <at> 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).
This bug report was last modified 5 years and 61 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.