emacs-devel
[Top][All Lists]
Advanced

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

Re: FW: Font-lock misfontifies foo::bar in C++


From: Alan Mackenzie
Subject: Re: FW: Font-lock misfontifies foo::bar in C++
Date: Mon, 24 Jul 2006 19:27:07 +0100
User-agent: Mutt/1.5.9i

Hi, Simon!

On Mon, Jul 24, 2006 at 09:39:26AM +0100, Marshall, Simon wrote:
> Hi Alan, did this get forwarded to you too?
> Are you the right person to forward it to?

Yes.  Sorry, I've been very slow answering.  The canonical address for
CC Mode problems is <address@hidden>.

> Thanks, Simon.



> -----Original Message-----
> From: Marshall, Simon 
> Sent: 22 June 2006 14:33
> To: 'Emacs Pretest Bug (address@hidden)'
> Subject: Font-lock misfontifies foo::bar in C++
 
> src/emacs -Q foo.cpp
 
> In the foo.cpp buffer, insert the text:
 
> void foo::bar()        // wrong - foo in font-lock-constant-face (otherwise 
> ok)

The face for "foo" is deliberately set to c-reference-face-name (At
cc-fonts.el L667 (in (c-lang-defconst c-basic-matchers-before ....)).
c-reference-face-name is defined (earlier on in the file) as
c-label-face-name, which (in its turn) becomes font-lock-constant-face.

So this is quite deliberate.  I don't assert it's "right", for whatever
value of "right".  Maybe this could be described more clearly in the CC
Mode manual (on page "Faces").

> {
>   foo                 ;// ok - no fontification

What is this, syntactically?  Is it valid C++?

>  foo:                  // ok - foo in font-lock-constant-face (also used
> for labels)
>   foo::               ;// ok - foo not fontified (but maybe could be as a 
> type)

Is this syntactically valid C++?

>     foo::bar   // wrong - foo in font-lock-constant-face

(See above.)

> The text "foo" in "foo::bar" is fontified in font-lock-constant-face, rather
> than font-lock-type-face.  In C++, at least, anything before a "::" is a
> namespace or class name.  Note that mis-fontification happens when the "b"
> of "bar" is typed.

> Sorry, no fix.  Cc-fonts.el is too scary for my diminishing elisp skills -
> and I'm wary of breaking something else anyway.

:-)  The fix, if such is needed, would be to redefine (defconst
c-reference-face ...) at cc-fonts.el L145.

> Simon.

-- 
Alan Mackenzie (Munich, Germany).





reply via email to

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