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: Font-lock decides function call is function declaration in C+ + Date: 7 Feb 2007 21:45:02 +0100 Message-ID: <20070207215912.GA2324@muc.de> References: <81CCA6588E60BB42BE68BD029ED4826011AB3F79@wimex2.wim.midas-kapiti.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1170881140 30574 80.91.229.12 (7 Feb 2007 20:45:40 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 7 Feb 2007 20:45:40 +0000 (UTC) Cc: "'bug-cc-mode@gnu.org'" , "'emacs-devel@gnu.org'" , 'Chong Yidong' To: "Marshall, Simon" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 07 21:45:27 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HEtfR-0006C9-4T for ged-emacs-devel@m.gmane.org; Wed, 07 Feb 2007 21:45:25 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HEtfQ-0006X9-MV for ged-emacs-devel@m.gmane.org; Wed, 07 Feb 2007 15:45:24 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HEtfE-0006Wi-HI for emacs-devel@gnu.org; Wed, 07 Feb 2007 15:45:12 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HEtfA-0006WO-7k for emacs-devel@gnu.org; Wed, 07 Feb 2007 15:45:11 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HEtfA-0006WL-2q for emacs-devel@gnu.org; Wed, 07 Feb 2007 15:45:08 -0500 Original-Received: from colin.muc.de ([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 1HEtf9-0002Xa-Cc for emacs-devel@gnu.org; Wed, 07 Feb 2007 15:45:07 -0500 Original-Received: (qmail 90285 invoked by uid 3782); 7 Feb 2007 20:45:02 -0000 Original-Received: from acm.muc.de (p54A3FBBB.dip.t-dialin.net [84.163.251.187]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Wed, 07 Feb 2007 21:45:00 +0100 Original-Received: (qmail 3246 invoked by uid 1000); 7 Feb 2007 21:59:13 -0000 Original-Date: Wed, 7 Feb 2007 21:59:12 +0000 Content-Disposition: inline In-Reply-To: <81CCA6588E60BB42BE68BD029ED4826011AB3F79@wimex2.wim.midas-kapiti.com> User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) X-Primary-Address: acm@muc.de X-detected-kernel: FreeBSD 4.6-4.9 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:66082 Archived-At: Hi, Simon! On Mon, Feb 05, 2007 at 04:46:32PM -0000, Marshall, Simon wrote: > > Does this bug still exist with latest CVS? If so, please provide a > > simple test case (I couldn't find one in your previous messages). > Yes, it does, with CVS Emacs as of 05/02/2007. Originally, I couldn't > reproduce it on demand. That's why, originally, I was asking for help to > track it down. > But, messing around just now, I've finally managed to do it. I can't say > that these are the only way of reproducing it, as I've seen this > misfontification in a variety of situations that do not look obviously like > these. > 1. The goal is to write the code snippet: > int main() { > foo(); > bar(); > } > emacs -Q foo.cpp > int SPC main() SPC { RET } RET C-p C-o bar(); > OK so far. Now to insert the "foo();" line: > C-a C-o foo > At this point, "foo" is fontified as a type, and "bar" as a variable. OK. > Now: > () > The fontification of "foo" and "bar" disappears. OK. Now complete the > snippet: > ; > Now "foo" is fontified as a variable. This is wrong. It is indeed wrong. Further observations: (i) The bug doesn't happen in C Mode. The bug happens: (ii) in Emacs 5.21.3/CC Mode 5.31.4 (iii) With jit-lock disabled (thankfully ;-) (iv) in Emacs 5.21.3/CC Mode 5.30.3 So it seems its entirely a CC Mode bug. I'm going to try and track it down, though I suspect it could be quite tricky to find. Thanks for giving that recipe for producing the bug. > 2. Here's a variation. [ snipped ] > What is worse is that in both cases I cannot get rid of the > misfontification without turning Font Lock mode off and on again. M-o M-o fixes the fontification for me. > I hope this help to fix The Most Annoying Fontification Bug Ever. > Simon. I think there're also other candidates for that description. ;-( -- Alan Mackenzie (Ittersbach, Germany).