From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.cc-mode.general,gmane.emacs.devel Subject: Re: [sigra@home.se: C++-mode: Syntax highlighting: wrong color for function identifier depending on the kind of whitespace that follows] Date: Thu, 10 Mar 2005 08:00:42 +0000 (GMT) Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: sea.gmane.org 1110441821 21537 80.91.229.2 (10 Mar 2005 08:03:41 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 10 Mar 2005 08:03:41 +0000 (UTC) Cc: emacs-devel@gnu.org, bug-cc-mode@gnu.org Original-X-From: cc-mode-help-admin@lists.sourceforge.net Thu Mar 10 09:03:40 2005 Original-Received: from lists-outbound.sourceforge.net ([66.35.250.225]) by ciao.gmane.org with esmtp (Exim 4.43) id 1D9Idl-0007Fr-Ks for sf-cc-mode-help@m.gmane.org; Thu, 10 Mar 2005 09:03:30 +0100 Original-Received: from projects.sourceforge.net (sc8-sf-list1-b.sourceforge.net [10.3.1.7]) by sc8-sf-spam2.sourceforge.net (Postfix) with ESMTP id 08BFE1282F; Thu, 10 Mar 2005 00:03:21 -0800 (PST) Original-Received: from sc8-sf-mx1-b.sourceforge.net ([10.3.1.11] helo=sc8-sf-mx1.sourceforge.net) by sc8-sf-list1.sourceforge.net with esmtp (Exim 4.30) id 1D9IdL-0007ib-DE for cc-mode-help@lists.sourceforge.net; Thu, 10 Mar 2005 00:03:03 -0800 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by sc8-sf-mx1.sourceforge.net with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.41) id 1D9IdJ-0007fz-Ly for cc-mode-help@lists.sourceforge.net; Thu, 10 Mar 2005 00:03:03 -0800 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by fencepost.gnu.org with esmtp (Exim 4.34) id 1D9IdI-0006Wf-9y for bug-cc-mode@gnu.org; Thu, 10 Mar 2005 03:03:00 -0500 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.34) id 1D9IXi-0003Qy-CR for bug-cc-mode@gnu.org; Thu, 10 Mar 2005 02:57:14 -0500 Original-Received: from [193.149.49.134] (helo=acm.acm) by monty-python.gnu.org with esmtp (Exim 4.34) id 1D9IXg-0003Qf-TS; Thu, 10 Mar 2005 02:57:14 -0500 Original-Received: from localhost (root@localhost) by acm.acm (8.8.8/8.8.8) with SMTP id IAA00462; Thu, 10 Mar 2005 08:00:44 GMT X-Sender: root@acm.acm Original-To: Stefan Monnier In-Reply-To: X-Spam-Status: No, hits=-1.5 required=5.0 tests=EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT,RCVD_IN_ORBS, REPLY_WITH_QUOTES,USER_AGENT_PINE version=2.55 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) X-Spam-Score: 1.0 (+) X-Spam-Report: Spam Filtering performed by sourceforge.net. See http://spamassassin.org/tag/ for more details. Report problems to http://sf.net/tracker/?func=add&group_id=1&atid=200001 1.0 FORGED_RCVD_HELO Received: contains a forged HELO 0.0 SF_CHICKENPOX_PERIOD BODY: Text interparsed with . 0.0 SF_CHICKENPOX_MINUS BODY: Text interparsed with - 0.0 SF_CHICKENPOX_AT BODY: Text interparsed with @ 0.0 SF_CHICKENPOX_APOSTROPHE BODY: Text interparsed with ' 0.0 AWL AWL: From: address is in the auto white-list Original-Sender: cc-mode-help-admin@lists.sourceforge.net Errors-To: cc-mode-help-admin@lists.sourceforge.net X-BeenThere: cc-mode-help@lists.sourceforge.net X-Mailman-Version: 2.0.9-sf.net Precedence: bulk List-Unsubscribe: , List-Id: Bug reports, feature requests, and general talk about CC Mode. List-Post: List-Help: List-Subscribe: , List-Archive: X-Original-Date: Thu, 10 Mar 2005 08:00:42 +0000 (GMT) X-MailScanner-From: cc-mode-help-admin@lists.sourceforge.net X-MailScanner-To: sf-cc-mode-help@m.gmane.org Xref: news.gmane.org gmane.emacs.cc-mode.general:2270 gmane.emacs.devel:34404 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:34404 Hi, Stefan. On Wed, 9 Mar 2005, Stefan Monnier wrote: >> [The discussion is about a font-locking problem reported in CC Mode: The >> user types the start of a C function, but puts a NL in the middle: >> void function >> (int x); >> The second line gets incorrectly fontified, because in its >> after-change-functions, font-lock considers only that line in and of >> itself.] >[...] >> However: I did complain about this shortcoming of font-lock on >> gnu.emacs.bug way back, on Friday 10th May 2002 (Subject: Font-lock: >> Major mode should be able to specify region to fontify. Message-Id: >> ), and that post of mine contained a patch to add >> the facility to font-lock. Nobody apart from Kim Storm (who objected >> (quite reasonably) to the prolix function names I'd used) responded to >> the post at the time, and nothing happened. That's when I decided that >> advising font-lock was the least bad way of solving the problem. >Hmm... I can't remember such a post and I have a hard time imagining why >I wouldn't have jumped on it. We talked about it in bug-cc-mode just after CC Mode 5.30 had been released. (Subject: Advising in cc-awk.el and namespace Date: Wed, 09 Jul 2003 13:20:20 -0400). I drew attention then (Jul 2003) to the patch I had submitted in 2002, which you acknowledged. However, the topic of conversation drifted onto why jit-lock consumed so much processor power. >Could you explain some more about your two cases (the one in awk and the >one in the subject of this article): >- how do they use your new before-font-lock-after-change-function hook? The one in AWK is with a string like this: print "multi-l\ ine\ string ^ | point The opening quote has been given warning font, since it is an unmated quote. When the closing quote is typed, the opening quote's face gets changed to string face. This is done by the advice on font-lock-after-change-function (or the jit-lock thingy ...) amending the BEGIN parameter to point to the start of the "print" line, before passing this into font-lock. The C example at the top is essentially the same; the single line containing "(int x);" currently gets fontified by after-change in isolation; correct fontification requires that it be fontified with the previous line as a unit. The patch I proposed would achieve this result via a user supplied function. >- why can't they use the font-lock-multiline property? I couldn't find any documentation for the facility back in 2002, and I couldn't figure out from the source code exactly what it did. I've now got it working for me in Texinfo mode, though. Also, font-lock-multiline doesn't (yet?) exist in XEmacs, so I'd need to implement a second solution for XEmacs if f-l-multiline was used. CC Mode still supports Emacs 20.x, and I think I found that f-l-multiline was introduced later than 20.1 (though I can't remember exactly). >- why can't they use the jit-lock-defer-multiline property? I'll have to look at that one. But presumably that doesn't exist in both of XEmacs and Emacs 20.x either. >This will allow us the better judge which is the better course of >action. Using advice on font-lock functions from awk-mode is pretty >ugly, so it's important we come up with a better way to solve this >issue. Agreed on all points. I think, as I have done since 2002, that the major-mode should be able to supply functions to determine the start and end of the region to be fontified. It seems a natural and idiomatic Emacsy way of doing things. Even so, it would be several years before major modes could start using it in earnest, due to the need to continue supporting older Emacs versions. (CC Mode 5.30 gave up support for 19.34 by starting to use text properties.) How long is it going to be before 22.1 becomes the oldest Emacs version supported by a major mode? > Stefan -- Alan Mackenzie (Munich, Germany) ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click