From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#20146: font-lock-extend-jit-lock-region-after-change: results are discarded instead of being returned. Date: Sat, 21 Mar 2015 21:03:25 +0000 Message-ID: <20150321210325.GC3001@acm.fritz.box> References: <20150319230136.GC2753@acm.fritz.box> <20150320160744.GA3493@acm.fritz.box> <20150321000003.GF3493@acm.fritz.box> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1426971866 30499 80.91.229.3 (21 Mar 2015 21:04:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 21 Mar 2015 21:04:26 +0000 (UTC) Cc: 20146@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Mar 21 22:04:14 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1YZQYz-0003bw-FL for geb-bug-gnu-emacs@m.gmane.org; Sat, 21 Mar 2015 22:04:09 +0100 Original-Received: from localhost ([::1]:48972 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YZQYy-0003uO-PC for geb-bug-gnu-emacs@m.gmane.org; Sat, 21 Mar 2015 17:04:08 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56995) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YZQYv-0003uI-T8 for bug-gnu-emacs@gnu.org; Sat, 21 Mar 2015 17:04:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YZQYs-0001iK-Ls for bug-gnu-emacs@gnu.org; Sat, 21 Mar 2015 17:04:05 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:42086) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YZQYs-0001iG-Iq for bug-gnu-emacs@gnu.org; Sat, 21 Mar 2015 17:04:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YZQYs-0000Gh-CK for bug-gnu-emacs@gnu.org; Sat, 21 Mar 2015 17:04:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 21 Mar 2015 21:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20146 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 20146-submit@debbugs.gnu.org id=B20146.14269718281004 (code B ref 20146); Sat, 21 Mar 2015 21:04:02 +0000 Original-Received: (at 20146) by debbugs.gnu.org; 21 Mar 2015 21:03:48 +0000 Original-Received: from localhost ([127.0.0.1]:60095 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YZQYe-0000G7-5i for submit@debbugs.gnu.org; Sat, 21 Mar 2015 17:03:48 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:20299 helo=mail.muc.de) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YZQYb-0000Fx-Ha for 20146@debbugs.gnu.org; Sat, 21 Mar 2015 17:03:46 -0400 Original-Received: (qmail 53175 invoked by uid 3782); 21 Mar 2015 21:03:42 -0000 Original-Received: from acm.muc.de (pD951A26C.dip0.t-ipconnect.de [217.81.162.108]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 21 Mar 2015 22:03:42 +0100 Original-Received: (qmail 5689 invoked by uid 1000); 21 Mar 2015 21:03:25 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:100760 Archived-At: Hi, Stefan. On Fri, Mar 20, 2015 at 10:29:16PM -0400, Stefan Monnier wrote: > >> No the core of the API is font-lock-fontify-region and it should work > >> with *any* bounds (i.e. if these need to be extended, it should be done > >> by font-lock-extend-region-function). > > However, when the bounds are set by the major mode, those bounds should > > be respected by Font Lock. > The major mode sets font-lock-extend-region-function and this functions' > result should be (and is) respected by the rest of font-lock. If only, but this is simply not the case at the moment. jit-lock-fontify-now has a hard-coded extension to whole lines, regardless of the contents of font-lock-extend-region-functions. It is this hard-coded extended region that jit-lock-fontify-now passes to font-lock-fontify-region, which then attempts to extend this region further. This is surely a bug. ;; Until someone has a better idea, let's start ;; at the start of the line containing START and ;; stop at the start of the line following NEXT. As a better idea, why not have jit-lock-fontify-now use f-l-extend-region-functions, and then pass the original `start' and `next' to f-l-fontify-region. That way, we would be sure that the two functions, one setting/clearing text properties, the other doing the fontification, would actually be working on the same portion of the buffer. It would bring jit-lock closer to behaving the same as unassisted font-lock. And it would allow a major mode to set an arbitrary font-lock region, of course. > But callers of font-lock-fontify-region (such as > font-lock-after-change-function, or jit-lock) can choose *any* bounds > they feel like and font-lock-fontify-region should behave correctly. This seems to be true. When I (setq font-lock-support-mode nil), things seem to behave properly. It seems a poor workaround, though. [ ... ] > Stefan -- Alan Mackenzie (Nuremberg, Germany).