all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
Cc: bug-cc-mode@gnu.org, emacs-devel@gnu.org
Subject: Re: FW: Font-lock misfontifies foo::bar in C++
Date: Mon, 24 Jul 2006 19:27:07 +0100	[thread overview]
Message-ID: <20060724182707.GB1111@muc.de> (raw)
In-Reply-To: <81CCA6588E60BB42BE68BD029ED48260089A94BF@wimex2.wim.midas-kapiti.com>

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 <bug-cc-mode@gnu.org>.

> Thanks, Simon.



> -----Original Message-----
> From: Marshall, Simon 
> Sent: 22 June 2006 14:33
> To: 'Emacs Pretest Bug (emacs-pretest-bug@gnu.org)'
> 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	other threads:[~2006-07-24 18:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <81CCA6588E60BB42BE68BD029ED48260089A94BF@wimex2.wim.midas-kapiti.com>
2006-07-24 18:27 ` Alan Mackenzie [this message]
2006-07-25  8:48 FW: Font-lock misfontifies foo::bar in C++ Marshall, Simon
2006-08-06 18:08 ` Alan Mackenzie
  -- strict thread matches above, loose matches on Subject: below --
2006-08-07  8:32 Marshall, Simon
2006-08-16 11:47 ` Alan Mackenzie
2006-08-16 14:35 Marshall, Simon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060724182707.GB1111@muc.de \
    --to=acm@muc.de \
    --cc=bug-cc-mode@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.