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: font-lock-extend-region-function: Final refinements. Date: Mon, 7 Aug 2006 23:49:15 +0100 Message-ID: <20060807224915.GA1909@muc.de> References: <20060803163040.GC1282@muc.de> <20060804085536.GA1107@muc.de> <20060806134849.GA1245@muc.de> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1154987619 31044 80.91.229.2 (7 Aug 2006 21:53:39 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 7 Aug 2006 21:53:39 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 07 23:53:38 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 1GAD2T-0001QG-Rk for ged-emacs-devel@m.gmane.org; Mon, 07 Aug 2006 23:53:34 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GAD2T-0008DB-D4 for ged-emacs-devel@m.gmane.org; Mon, 07 Aug 2006 17:53:33 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GAD2G-0008AJ-5i for emacs-devel@gnu.org; Mon, 07 Aug 2006 17:53:20 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GAD2F-00089G-Cm for emacs-devel@gnu.org; Mon, 07 Aug 2006 17:53:19 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GAD2F-000892-46 for emacs-devel@gnu.org; Mon, 07 Aug 2006 17:53:19 -0400 Original-Received: from [193.149.48.1] (helo=mail.muc.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1GAD6Y-0005Z5-QR for emacs-devel@gnu.org; Mon, 07 Aug 2006 17:57:47 -0400 Original-Received: (qmail 34031 invoked from network); 7 Aug 2006 21:53:13 -0000 Original-Received: from acm.muc.de (HELO localhost.localdomain) (Debian-exim@193.149.49.134) by mail.muc.de with SMTP; 7 Aug 2006 21:53:13 -0000 Original-Received: from acm by localhost.localdomain with local (Exim 4.50) id 1GADuN-0001IU-Br; Mon, 07 Aug 2006 23:49:15 +0100 Original-To: Stefan Monnier Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i 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:58166 Archived-At: Evening, Stefan! On Mon, Aug 07, 2006 at 01:45:02PM -0400, Stefan Monnier wrote: [ .... ] > If you mean a major mode "Foo", then no: major modes typically don't > use jit-lock: they use font-lock (which may or may not internally use > jit-lock, but that's mostly none of their business, unless they fiddle > with font-lock-support-mode). OK. > > Are you saying that j-l-a-c-extend-region-f is a hook purely for the > > use of font-lock itself (i.e. only in the three files font-lock.el, > > font-core.el and jit-lock.el)? > And glasses.el, yes. glasses.el is a really neat mode! > > I'm fairly confused at the moment, particularly by some of the > > function names. For example, what does the "jit-lock" part of the > > name `font-lock-extend-jit-lock-region-after-change' mean? Does it > > mean that this function only gets called when jit-lock is active? > Yes. > > Could you possibly give these new functions doc strings (or even > > comments) which explain the context in which they're called? > It's on the way. Thanks. > > But I'm not sure you've answered my question; if you have, I've not > > understood the answer. So let me ask it again: why are there two > > separate hooks for extending the region after a buffer change [that's > > jit-lock-after-change-region-functions and > > font-lock-extend-after-change-region-function]? > Because you can use jit-lock without font-lock and vice-versa. One is > for jit-lock clients (e.g. font-lock), and the other for font-lock > clients (e.g. c-mode). EUREKA!!! I hadn't realised that jit-lock could be used for things other than fontification. You just have to stuff a different function, such as the glasses one, into `jit-lock-functions'. Thanks for the clarification! Actually, there are places, quite a lot of them, in jit-lock.el (e.g. the doc string for j-l-after-change-extend-r-f) which explicitly refer to fontification. Maybe these could be reformulated with words more accurate and more abstract than "fontify". > > Again, would it be possible to simplify the whole mechanism by using > > only one of the pairs `font-lock-beg/end' and `jit-lock-start/end'? > Why would you care? > c-mode should never need to know about jit-lock-(beg|end). I'm happy about that! > Stefan -- Alan.