From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Tobias C. Rittweiler" Newsgroups: gmane.emacs.devel Subject: Re: `font-lock-extend-region-functions' vs. `font-lock-extend-after-change-region-function' Date: Wed, 29 Apr 2009 12:42:56 +0200 Message-ID: <873abr211r.fsf@freebits.de> References: <87prewlrl9.fsf@freebits.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1241001813 6153 80.91.229.12 (29 Apr 2009 10:43:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 29 Apr 2009 10:43:33 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 29 12:43:23 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Lz7G6-0001mM-LY for ged-emacs-devel@m.gmane.org; Wed, 29 Apr 2009 12:43:22 +0200 Original-Received: from localhost ([127.0.0.1]:60726 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lz7G5-00005v-Vn for ged-emacs-devel@m.gmane.org; Wed, 29 Apr 2009 06:43:22 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lz7Fz-00005a-Hz for emacs-devel@gnu.org; Wed, 29 Apr 2009 06:43:15 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lz7Fw-0008WU-0x for emacs-devel@gnu.org; Wed, 29 Apr 2009 06:43:15 -0400 Original-Received: from [199.232.76.173] (port=36024 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lz7Fv-0008WO-MS for emacs-devel@gnu.org; Wed, 29 Apr 2009 06:43:11 -0400 Original-Received: from main.gmane.org ([80.91.229.2]:53587 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Lz7Fv-0000We-2y for emacs-devel@gnu.org; Wed, 29 Apr 2009 06:43:11 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Lz7Fq-0007Xz-QF for emacs-devel@gnu.org; Wed, 29 Apr 2009 10:43:06 +0000 Original-Received: from host145.natpool.mwn.de ([138.246.7.145]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 29 Apr 2009 10:43:06 +0000 Original-Received: from tcr by host145.natpool.mwn.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 29 Apr 2009 10:43:06 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 36 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: host145.natpool.mwn.de User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:9wFzAa2w7xqMQFNayUo/OXVFWxM= X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) 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:110542 Archived-At: Stefan Monnier writes: > The "right" answer is usually font-lock-extend-region-functions, but > it's hard to tell without knowing anything more (sometimes it's > difficult/impossible to write the necessary > font-lock-extend-region-functions). Let EXTEND be a function that's pushed onto `font-lock-extend-region-functions', and let MARKER be font-lock search function that's specified in `font-lock-keywords'. I get the following call chain: extend: (1, 523) --> t (1, 701) extend: (1, 701) --> nil (1, 701) marker: pt=1 limit=701 ==> nil extend: (523, 1034) --> t (483, 1156) ^^^ extend: (483, 1156) --> nil (483, 1156) marker: pt=483 limit=1156 (The values in parentheses are font-lock-beg, and font-lock-end.) As you see, EXTEND extends the region to be fontified from (1, 523) to (1, 701). MARKER cannot find anything in that region. But the new region that EXTEND is called with begins at 523, and not 701 even though we processed the region between 523 and 701 already. This seems more inefficient than it needs to be if I'm not missing anything. -T. PS: I'm using `jit-lock' as font-lock-support-mode.