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: 11 Feb 2007 18:40:53 +0100 Message-ID: <20070211185523.GA7079@muc.de> References: <81CCA6588E60BB42BE68BD029ED4826011AB3F79@wimex2.wim.midas-kapiti.com> <20070207215912.GA2324@muc.de> <87hctvhvlq.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1171215776 18146 80.91.229.12 (11 Feb 2007 17:42:56 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 11 Feb 2007 17:42:56 +0000 (UTC) Cc: "'bug-cc-mode@gnu.org'" , "Marshall, Simon" , "'emacs-devel@gnu.org'" To: Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Feb 11 18:42:54 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 1HGIiy-0008Bq-1P for ged-emacs-devel@m.gmane.org; Sun, 11 Feb 2007 18:42:52 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HGIix-00073v-GM for ged-emacs-devel@m.gmane.org; Sun, 11 Feb 2007 12:42:51 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HGIhD-0005XQ-Dc for emacs-devel@gnu.org; Sun, 11 Feb 2007 12:41:03 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HGIhB-0005Wn-HF for emacs-devel@gnu.org; Sun, 11 Feb 2007 12:41:02 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HGIhB-0005Wg-7b for emacs-devel@gnu.org; Sun, 11 Feb 2007 12:41:01 -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 1HGIhA-0004z5-Lx for emacs-devel@gnu.org; Sun, 11 Feb 2007 12:41:01 -0500 Original-Received: (qmail 50066 invoked by uid 3782); 11 Feb 2007 17:40:53 -0000 Original-Received: from acm.muc.de (p54A3ECDA.dip.t-dialin.net [84.163.236.218]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Sun, 11 Feb 2007 18:40:51 +0100 Original-Received: (qmail 8534 invoked by uid 1000); 11 Feb 2007 18:55:24 -0000 Original-Date: Sun, 11 Feb 2007 18:55:23 +0000 Content-Disposition: inline In-Reply-To: <87hctvhvlq.fsf@stupidchicken.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:66266 Archived-At: Hi, Chong! On Fri, Feb 09, 2007 at 04:25:21PM -0500, Chong Yidong wrote: > Alan Mackenzie writes: > I think the problem is that when the buffer is in the state > foo > bar (); > foo looks like a type, so it is inserted in the cache variable > c-found-types. Exactly! Thanks for that. > When you add the "()": > foo() > bar(); > this guess is no longer valid, but foo is not removed from > c-found-types. Therefore, when you insert the final ";", > foo(); > bar(); > the call to foo(); is highlighted as though it were a constructor. > Note that if you do M-: (c-clear-found-types) prior to inserting the > final ";", the misfontification does not occur. > I don't know what the Right Fix is, however. Once a variable has been inserted into c-found-types, it will stay there almost for ever; it will stay there until re-fontification is done from BOB (I'm not sure whether or not that also means (point-min) on a narrowed buffer). This permanence seems to be the fundamental problem. To Simon: Sorry about my saying that "M-o M-o will clear the spurious font-lock-type-face". It only does that when point is within 16 lines of BOB. :-( I think a solution might be to remove "foo" from c-found-types whenever text is inserted/deleted in the vicinity of "foo\n bar ();" which syntactically destroys its status as a type identifier. I'll need to think a lot more about this. -- Alan.