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: [Emacs-diffs] emacs-24 d69e9f1: CC Mode: Stop Font Lock forcing fontification from BOL. Fixes debbugs#19669. Date: Thu, 19 Mar 2015 09:31:11 +0000 Message-ID: <20150319093110.GA2753@acm.fritz.box> References: <20150201212213.17840.3710@vcs.savannah.gnu.org> <55076CF8.60309@dancol.org> <20150318120806.GA4160@acm.fritz.box> <550A43BB.3070904@dancol.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1426757514 31214 80.91.229.3 (19 Mar 2015 09:31:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 19 Mar 2015 09:31:54 +0000 (UTC) Cc: emacs-devel@gnu.org To: Daniel Colascione Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 19 10:31:44 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YYWnm-0002N1-7B for ged-emacs-devel@m.gmane.org; Thu, 19 Mar 2015 10:31:42 +0100 Original-Received: from localhost ([::1]:37988 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYWnl-00063c-6U for ged-emacs-devel@m.gmane.org; Thu, 19 Mar 2015 05:31:41 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38776) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYWnh-00060d-RR for emacs-devel@gnu.org; Thu, 19 Mar 2015 05:31:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YYWnd-0006hp-R6 for emacs-devel@gnu.org; Thu, 19 Mar 2015 05:31:37 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:16232 helo=mail.muc.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYWnd-0006hZ-Gg for emacs-devel@gnu.org; Thu, 19 Mar 2015 05:31:33 -0400 Original-Received: (qmail 30256 invoked by uid 3782); 19 Mar 2015 09:31:31 -0000 Original-Received: from acm.muc.de (pD951A075.dip0.t-ipconnect.de [217.81.160.117]) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 19 Mar 2015 10:31:30 +0100 Original-Received: (qmail 2798 invoked by uid 1000); 19 Mar 2015 09:31:11 -0000 Content-Disposition: inline In-Reply-To: <550A43BB.3070904@dancol.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x X-Received-From: 193.149.48.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:184012 Archived-At: Hello, Daniel. On Wed, Mar 18, 2015 at 08:34:19PM -0700, Daniel Colascione wrote: > On 03/18/2015 05:08 AM, Alan Mackenzie wrote: > > On Mon, Mar 16, 2015 at 04:53:28PM -0700, Daniel Colascione wrote: > >> On 02/01/2015 01:22 PM, Alan Mackenzie wrote: > >>> branch: emacs-24 > >>> commit d69e9f1c24f37f36af33b0468c5a4e100dbb09b6 > >>> Author: Alan Mackenzie > >>> Commit: Alan Mackenzie > >>> CC Mode: Stop Font Lock forcing fontification from BOL. Fixes debbugs#19669. > >>> cc-mode.el (c-font-lock-init): Setq font-lock-extend-region-functions to > >>> nil. > >> This change is driving me nuts. Consider the following buffer, with @ > >> representing point: > >> void foo() { > >> @ > >> } > >> If I type [f o r SPC], then depending on timing, I see only the "or", or > >> only the "r", fontified in font-lock-keyword-face. A moment later, > >> jit-lock kicks in and refontifies the entire chunk properly. > > Sorry about this. > >> Can we please extend the start of the region back to at least the last `}'? > > This could be a tricky one to solve. For the sake of your sanity, please > > consider applying the following temporary patch; it "solves" the current > > problem, but unfortunately leaves bug #19669's symptoms apparent again. > I've been doing the equivalent in a mode hook. I'm not sure that > reverting to the previous behavior is the right thing either. > Fundamentally, it just feels wrong that the solution to any > fontification correctness bug should be to fontify less. The problem in #19669 was that Font Lock's extension of the region to be font locked to the beginning of the line was changing the syntactic context, hence CC Mode's font locking didn't work in that case. The solution was to prevent that extension in the pertinent case. However, I got it wrong. The solution I'm looking at at the moment is to allow Font Lock to extend to BOL except where CC Mode itself has extended the region for syntactic reasons. As I said, it's tricky. Fundamentally, the problem is that Font Lock doesn't distinguish between the region which needs fontifying, and the region which supplies the syntactic context. -- Alan Mackenzie (Nuremberg, Germany).