From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: FW: Font-lock misfontifies foo::bar in C++ Date: Mon, 24 Jul 2006 19:27:07 +0100 Message-ID: <20060724182707.GB1111@muc.de> References: <81CCA6588E60BB42BE68BD029ED48260089A94BF@wimex2.wim.midas-kapiti.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1153765741 18379 80.91.229.2 (24 Jul 2006 18:29:01 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 24 Jul 2006 18:29:01 +0000 (UTC) Cc: bug-cc-mode@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 24 20:28:57 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1G55AN-0007Vb-FU for ged-emacs-devel@m.gmane.org; Mon, 24 Jul 2006 20:28:31 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G55AM-00043I-Ni for ged-emacs-devel@m.gmane.org; Mon, 24 Jul 2006 14:28:30 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1G55A9-00043C-RU for emacs-devel@gnu.org; Mon, 24 Jul 2006 14:28:17 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1G55A8-00042b-KY for emacs-devel@gnu.org; Mon, 24 Jul 2006 14:28:17 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G55A8-00042U-FA for emacs-devel@gnu.org; Mon, 24 Jul 2006 14:28:16 -0400 Original-Received: from [193.149.48.1] (helo=mail.muc.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1G55BG-0007rm-OP for emacs-devel@gnu.org; Mon, 24 Jul 2006 14:29:27 -0400 Original-Received: (qmail 58710 invoked from network); 24 Jul 2006 18:28:07 -0000 Original-Received: from acm.muc.de (HELO localhost.localdomain) (Debian-exim@193.149.49.134) by mail.muc.de with SMTP; 24 Jul 2006 18:28:07 -0000 Original-Received: from acm by localhost.localdomain with local (Exim 4.50) id 1G5591-0001XC-FC; Mon, 24 Jul 2006 19:27:07 +0100 Original-To: "Marshall, Simon" Content-Disposition: inline In-Reply-To: <81CCA6588E60BB42BE68BD029ED48260089A94BF@wimex2.wim.midas-kapiti.com> User-Agent: Mutt/1.5.9i X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:57561 Archived-At: 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 . > 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).