GNU bug report logs - #36397
CC Mode 5.34 (C++//l); Bad highlighting on inserting a string

Previous Next

Package: cc-mode;

Reported by: Richard Copley <rcopley <at> gmail.com>

Date: Wed, 26 Jun 2019 21:37:01 UTC

Severity: normal

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


Message #37 received at 36397 <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Richard Copley <rcopley <at> gmail.com>
Cc: 36397 <at> debbugs.gnu.org
Subject: Wierd fontification in brackets in C++ Mode.  [Was bug#36397: CC
 Mode 5.34 (C++//l); Bad highlighting on inserting a string]
Date: Tue, 23 Jul 2019 10:40:15 +0000
Hello again, Richard.

On Mon, Jul 22, 2019 at 20:47:22 +0100, Richard Copley wrote:

[ .... ]

> 3. (This one's reproducible and 'stable' -- it's dependent only on the
> current buffer contents, and not on the path that got us there.) With these
> buffer contents:

> order[x];
> origin[y];
> counterpane[z];

> ... "x" and "y" are highlighted as types, and "z" is not (expected: none of
> the three subscripts are highlighted). There's apparently something special
> about the identifiers "order" and "origin".

OK, I've tracked this one down to a regexp not testing for end of word.

I'm pretty sure the following patch fixes it, but would you please do the
usual with it anyway.  As this changes a Lisp macro, the entire CC Mode
needs to be rebuilt after patching.

Thanks!


diff -r 2e20f0567ddf cc-langs.el
--- a/cc-langs.el	Tue Jul 23 09:45:20 2019 +0000
+++ b/cc-langs.el	Tue Jul 23 10:34:14 2019 +0000
@@ -1480,7 +1480,7 @@
 
 (c-lang-defconst c-pre-lambda-tokens-re
   ;; Regexp matching any token in the list `c-pre-lambda-tokens'.
-  t (regexp-opt (c-lang-const c-pre-lambda-tokens)))
+  t (c-make-keywords-re t (c-lang-const c-pre-lambda-tokens)))
 (c-lang-defvar c-pre-lambda-tokens-re (c-lang-const c-pre-lambda-tokens-re))
 
 ;;; Syntactic whitespace.



-- 
Alan Mackenzie (Nuremberg, Germany).




This bug report was last modified 6 years and 35 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.