GNU bug report logs -
#41284
26.3; cc-mode: Incorrect font locking of static functions
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 41284 in the body.
You can then email your comments to 41284 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#41284
; Package
emacs
.
(Fri, 15 May 2020 11:39:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
"George O'Hara" <georgeohara92 <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 15 May 2020 11:39:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi,
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.
I would expect both to be highlighted.
Note that this also happens with C++.
In GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
of 2020-05-13 built on gohara-t450s
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Linux Mint 19.3 Tricia
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Making completion list... [2 times]
Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB
NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM THREADS LCMS2
Important settings:
value of $LANG: en_GB.UTF-8
locale-coding-system: utf-8-unix
Major mode: Fundamental
Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
buffer-read-only: t
line-number-mode: t
transient-mark-mode: t
Load-path shadows:
None found.
Features:
(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib dired dired-loaddefs
format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg
epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils elec-pair time-date
mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)
Memory information:
((conses 16 97752 8020)
(symbols 48 20379 1)
(miscs 40 84 118)
(strings 32 28409 1537)
(string-bytes 1 746781)
(vectors 16 14596)
(vector-slots 8 505938 8384)
(floats 8 50 68)
(intervals 56 246 4)
(buffers 992 13))
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#41284
; Package
emacs
.
(Fri, 15 May 2020 11:58:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 41284 <at> debbugs.gnu.org (full text, mbox):
> 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?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#41284
; Package
emacs
.
(Fri, 15 May 2020 12:04:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 41284 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
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
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?
>
[Message part 2 (text/html, inline)]
Merged 41283 41284.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Sun, 17 May 2020 16:34:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#41284
; Package
emacs
.
(Sun, 17 May 2020 19:27:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 41284 <at> debbugs.gnu.org (full text, mbox):
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).
Reply sent
to
Alan Mackenzie <acm <at> muc.de>
:
You have taken responsibility.
(Mon, 18 May 2020 18:39:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
"George O'Hara" <georgeohara92 <at> gmail.com>
:
bug acknowledged by developer.
(Mon, 18 May 2020 18:39:02 GMT)
Full text and
rfc822 format available.
Message #21 received at 41284-done <at> debbugs.gnu.org (full text, mbox):
Hello, George.
On Mon, May 18, 2020 at 09:52:26 +0100, George O'Hara wrote:
> Hi Alan,
> I can confirm that fixes it.
> A huge thank you for your help!
OK, that's great,thanks! I've committed the patch to the master branch
at savannah, and I'm closing the bug with this post.
> Kind regards
> George
--
Alan Mackenzie (Nuremberg, Germany).
Reply sent
to
Alan Mackenzie <acm <at> muc.de>
:
You have taken responsibility.
(Mon, 18 May 2020 18:39:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
"George O'Hara" <georgeohara92 <at> gmail.com>
:
bug acknowledged by developer.
(Mon, 18 May 2020 18:39:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 16 Jun 2020 11:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 5 years and 60 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.