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: Wed, 18 Mar 2015 12:08:07 +0000 Message-ID: <20150318120806.GA4160@acm.fritz.box> References: <20150201212213.17840.3710@vcs.savannah.gnu.org> <55076CF8.60309@dancol.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1426680629 2868 80.91.229.3 (18 Mar 2015 12:10:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 18 Mar 2015 12:10:29 +0000 (UTC) Cc: emacs-devel@gnu.org To: Daniel Colascione Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 18 13:10:21 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 1YYCm8-0006Gc-Lk for ged-emacs-devel@m.gmane.org; Wed, 18 Mar 2015 13:08:40 +0100 Original-Received: from localhost ([::1]:33117 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYCm7-0002De-T3 for ged-emacs-devel@m.gmane.org; Wed, 18 Mar 2015 08:08:39 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39398) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYCm4-0002DR-Bf for emacs-devel@gnu.org; Wed, 18 Mar 2015 08:08:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YYCly-0000CK-Ht for emacs-devel@gnu.org; Wed, 18 Mar 2015 08:08:36 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:34357 helo=mail.muc.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYCly-0000Bc-8R for emacs-devel@gnu.org; Wed, 18 Mar 2015 08:08:30 -0400 Original-Received: (qmail 55444 invoked by uid 3782); 18 Mar 2015 12:08:27 -0000 Original-Received: from acm.muc.de (pD951AEED.dip0.t-ipconnect.de [217.81.174.237]) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 18 Mar 2015 13:08:26 +0100 Original-Received: (qmail 4328 invoked by uid 1000); 18 Mar 2015 12:08:07 -0000 Content-Disposition: inline In-Reply-To: <55076CF8.60309@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:183989 Archived-At: Hello, Daniel. 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. diff -r cffcacba7345 cc-mode.el --- a/cc-mode.el Sun Feb 01 21:06:18 2015 +0000 +++ b/cc-mode.el Wed Mar 18 12:04:00 2015 +0000 @@ -1208,7 +1208,17 @@ ;; Type a space in the first blank line, and the fontification of the next ;; line was fouled up by context fontification. (let ((new-beg beg) (new-end end) new-region case-fold-search - open-paren-in-column-0-is-defun-start) + open-paren-in-column-0-is-defun-start + ;; Except in the after-change case, prevent + ;; `font-lock-default-fontify-region' extending the region it will + ;; fontify to whole lines. The following binding removes + ;; `font-lock-extend-region-whole-lines' from + ;; `font-lock-extend-region-functions'. (Emacs only). This fixes + ;; Emacs bug #19669. + (font-lock-extend-region-functions + (and (boundp 'font-lock-extend-region-functions) + c-in-after-change-fontification + font-lock-extend-region-functions))) (if c-in-after-change-fontification (setq c-in-after-change-fontification nil) (save-restriction @@ -1247,13 +1257,13 @@ (font-lock-mark-block-function . c-mark-function))) - ;; Prevent `font-lock-default-fontify-region' extending the region it will - ;; fontify to whole lines by removing `font-lock-extend-region-whole-lines' - ;; (and, coincidentally, `font-lock-extend-region-multiline' (which we do - ;; not need)) from `font-lock-extend-region-functions'. (Emacs only). This - ;; fixes Emacs bug #19669. - (when (boundp 'font-lock-extend-region-functions) - (setq font-lock-extend-region-functions nil)) + ;; ;; Prevent `font-lock-default-fontify-region' extending the region it will + ;; ;; fontify to whole lines by removing `font-lock-extend-region-whole-lines' + ;; ;; (and, coincidentally, `font-lock-extend-region-multiline' (which we do + ;; ;; not need)) from `font-lock-extend-region-functions'. (Emacs only). This + ;; ;; fixes Emacs bug #19669. + ;; (when (boundp 'font-lock-extend-region-functions) + ;; (setq font-lock-extend-region-functions nil)) (make-local-variable 'font-lock-fontify-region-function) (setq font-lock-fontify-region-function 'c-font-lock-fontify-region) -- Alan Mackenzie (Nuremberg, Germany).