From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel,gmane.emacs.pretest.bugs Subject: Re: [simon.marshall@misys.com: Font Lock on-the-fly misfontification in C++] Date: Mon, 24 Jul 2006 10:36:08 -0400 Message-ID: References: <20060723142630.GB1433@muc.de> <20060724133343.GA1111@muc.de> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1153751796 30023 80.91.229.2 (24 Jul 2006 14:36:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 24 Jul 2006 14:36:36 +0000 (UTC) Cc: bug-cc-mode@gnu.org, emacs-pretest-bug@gnu.org, "Marshall, Simon" , Richard Stallman , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 24 16:36:34 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 1G51Xr-0008K5-M5 for ged-emacs-devel@m.gmane.org; Mon, 24 Jul 2006 16:36:32 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G51Xr-0002wj-5S for ged-emacs-devel@m.gmane.org; Mon, 24 Jul 2006 10:36:31 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1G51Xd-0002u5-RC for emacs-devel@gnu.org; Mon, 24 Jul 2006 10:36:17 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1G51Xd-0002t8-1t for emacs-devel@gnu.org; Mon, 24 Jul 2006 10:36:17 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G51Xc-0002sp-UI; Mon, 24 Jul 2006 10:36:16 -0400 Original-Received: from [132.204.24.67] (helo=mercure.iro.umontreal.ca) by monty-python.gnu.org with esmtp (Exim 4.52) id 1G51Yh-0007kK-Nf; Mon, 24 Jul 2006 10:37:23 -0400 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id A81A92CEB63; Mon, 24 Jul 2006 10:36:14 -0400 (EDT) Original-Received: from faina.iro.umontreal.ca (faina.iro.umontreal.ca [132.204.26.177]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 1A84D445C; Mon, 24 Jul 2006 10:36:08 -0400 (EDT) Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 131A44C6DEA; Mon, 24 Jul 2006 10:36:08 -0400 (EDT) Original-To: Alan Mackenzie In-Reply-To: <20060724133343.GA1111@muc.de> (Alan Mackenzie's message of "Mon, 24 Jul 2006 14:33:43 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.82, requis 5, autolearn=not spam, ALL_TRUSTED -2.82) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca 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:57537 gmane.emacs.pretest.bugs:13109 Archived-At: >> >> 3. Append a space to the fourth commented line. Bug: >> >> fontification of Foo, bar, Snafu and snafu is removed from that >> >> line. >> > The problem is that after a textual change, the changed line gets >> > fontified as an atomic entity, i.e. yanked out of its context. The >> If you placed a font-lock-multiline property on the whole thing, >> font-lock would know not to yank that one line out of its context. > We've already been through this at some length. > I think we're agreed that it's not possible to put this property exactly > where it's needed (at the boundaries of the region to fontify, and > nowhere else) when it's needed (at the time of the change, before Font > Lock starts fontifying). I'm talking about this specific example, which is about refontification, not about the original fontification. As you know, the two problems are closely related yet separate. >> > solution is to determine the bounds of the region to fontify by >> > analysing the surrounding text syntactically. >> Presumably, at the moment when Emacs fontified it correctly, it knew >> the corresponding bounds, so it could have added the >> font-lock-multiline property at that time, thus avoiding the need to >> re-determine those bounds later when refontifying. > The buffer was originally fontified as a whole, thus the corresponding > bounds were BOB and EOB. Is that what is called a strawman argument? Come on, be more constructive, please. In the pattern rules where you add the correct highlighting, you probably have a pretty good idea about where the relevant boundaries are. Have you taken the time to look at my cc-awk.el patch example (I mean, other than to try and find some superficial flaw in it). It should give you a pretty good idea of what the above paragraph refers to. Check also my sample patch for problems number 2 and 3 for another example. > When the buffer is changed, in the most general case, the bounds of the > region to be refontified are going to have to be recalculated before > fontifying. You keep saying that, but that's not the case. When *re*fontifying, you don't need to recalculate those context bounds, as long as you were careful to store them (e.g. in a font-lock-multiline property) when you knew them. > As you are aware, I intensely dislike the notion that an entire buffer > should have to be left constantly marked with all places where it > fontification might have to straddle line boundaries, rather than > determining these things as they are needed. That's OK: your likes an dislikes only bother you. BTW the entire buffer already needs to be left constantly marked with face information (takes a lot more resources) as well as `fontified' information. Try C-u C-x = a few times to get an idea. > I also dislike being unable to specify an exact fontification region to > Font Lock (such as the bounds of one of Simon's comments). I don't understand what you're referring to. Stefan