emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Font-lock fontifies C/C++ case keyword as a constant


From: Marshall, Simon
Subject: RE: Font-lock fontifies C/C++ case keyword as a constant
Date: Wed, 8 Nov 2006 12:05:58 -0000

Here is a patch that fixes the below problem for cvs emacs.

The patch prevents the re-fontification of the "case" keyword as a constant.
I also toyed with some code that fontifies the case constants as constants,
as Emacs 19-21 tries to do, but it doesn't (can't) work in all cases.  Also,
I think that's probably over the top, so I have left the additional code in
but commented it out.

2006-11-08  Simon Marshall  <address@hidden>

        * progmodes/cc-fonts.el (c-font-lock-declarations): Don't overwrite
        fontification for "case" and "default" keywords.

Simon.

> -----Original Message-----
> From: Marshall, Simon 
> Sent: 08 September 2006 11:53
> To: 'address@hidden'
> Cc: 'address@hidden'
> Subject: Font-lock fontifies C/C++ case keyword as a constant
> 
> In Emacs 19-21 fontifies the following C/C++ snippet:
> 
>       case fubar:
> 
> so that the keyword "case" is fontified as a keyword and 
> "fubar" is fontified as a constant.  Seems reasonable.
> 
> In Emacs CVS, the keyword "case" is fontified as a constant, 
> and "fubar" is not fontified at all.
> 
> (With the C++ snippet "case foo::bar:" you get the bemusing 
> situation where everything is fontified as a constant---apart 
> from the constant.  Fontifying the type/namespace qualifier 
> as a constant is the subject of another bug report.)
> 
> The first bug is that the "case" keyword should not be 
> fontified as a constant.  
> 
> For the second bug, IWBNI the constant was fontified as a 
> constant too, as it used to be, though that can be awkward 
> where the constant is a constant expression.  Still, Emacs 
> used to manage to correctly fontify:
> 
>       case foo | bar:
> 
> so that the keyword "case" is fontified as a keyword and 
> "foo" and "bar" are fontified as constants.  But if you don't 
> want to fontify constants like this for some reason, you 
> should make the "default" keyword be fontified as a keyword too.
> 
> Simon.

Attachment: cc-fonts.diff2
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]