* bug#41284: 26.3; cc-mode: Incorrect font locking of static functions
@ 2020-05-15 11:15 George O'Hara
2020-05-15 11:57 ` Eli Zaretskii
0 siblings, 1 reply; 5+ messages in thread
From: George O'Hara @ 2020-05-15 11:15 UTC (permalink / raw)
To: 41284
[-- Attachment #1: Type: text/plain, Size: 3011 bytes --]
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))
[-- Attachment #2: Type: text/html, Size: 3541 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#41284: 26.3; cc-mode: Incorrect font locking of static functions
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
0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2020-05-15 11:57 UTC (permalink / raw)
To: George O'Hara; +Cc: 41284
> 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?
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#41284: 26.3; cc-mode: Incorrect font locking of static functions
2020-05-15 11:57 ` Eli Zaretskii
@ 2020-05-15 12:03 ` George O'Hara
2020-05-17 19:26 ` Alan Mackenzie
0 siblings, 1 reply; 5+ messages in thread
From: George O'Hara @ 2020-05-15 12:03 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 41284
[-- Attachment #1: Type: text/plain, Size: 806 bytes --]
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@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?
>
[-- Attachment #2: Type: text/html, Size: 1494 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#41284: 26.3; cc-mode: Incorrect font locking of static functions
2020-05-15 12:03 ` George O'Hara
@ 2020-05-17 19:26 ` Alan Mackenzie
[not found] ` <CAHHF0DZ_wUH92NS+Nf0-qQL1zzSQTBPd7xEY1MDXQunt0mf9hA@mail.gmail.com>
0 siblings, 1 reply; 5+ messages in thread
From: Alan Mackenzie @ 2020-05-17 19:26 UTC (permalink / raw)
To: George O'Hara; +Cc: 41284
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).
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#41284: 26.3; cc-mode: Incorrect font locking of static functions
[not found] ` <CAHHF0DZ_wUH92NS+Nf0-qQL1zzSQTBPd7xEY1MDXQunt0mf9hA@mail.gmail.com>
@ 2020-05-18 18:38 ` Alan Mackenzie
0 siblings, 0 replies; 5+ messages in thread
From: Alan Mackenzie @ 2020-05-18 18:38 UTC (permalink / raw)
To: George O'Hara; +Cc: 41284-done
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).
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-05-18 18:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
[not found] ` <CAHHF0DZ_wUH92NS+Nf0-qQL1zzSQTBPd7xEY1MDXQunt0mf9hA@mail.gmail.com>
2020-05-18 18:38 ` Alan Mackenzie
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).