From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: Excessive refontification when setting jit-lock-context-unfontify-pos Date: Tue, 24 Apr 2007 10:33:21 +0200 Message-ID: <462DC0D1.8070304@gmx.at> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1177403599 24862 80.91.229.12 (24 Apr 2007 08:33:19 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 24 Apr 2007 08:33:19 +0000 (UTC) Cc: emacs-devel@gnu.org To: Ralf Angeli Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 24 10:33:17 2007 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 1HgGSa-0003PV-BZ for ged-emacs-devel@m.gmane.org; Tue, 24 Apr 2007 10:33:16 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HgGY4-0005P6-5P for ged-emacs-devel@m.gmane.org; Tue, 24 Apr 2007 04:38:56 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HgGXv-0005Md-Ia for emacs-devel@gnu.org; Tue, 24 Apr 2007 04:38:47 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HgGXu-0005Lm-Ix for emacs-devel@gnu.org; Tue, 24 Apr 2007 04:38:46 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HgGXu-0005LX-8Q for emacs-devel@gnu.org; Tue, 24 Apr 2007 04:38:46 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1HgGSP-0004DU-5g for emacs-devel@gnu.org; Tue, 24 Apr 2007 04:33:05 -0400 Original-Received: (qmail invoked by alias); 24 Apr 2007 08:33:03 -0000 Original-Received: from N909P017.adsl.highway.telekom.at (EHLO [62.47.57.145]) [62.47.57.145] by mail.gmx.net (mp036) with SMTP; 24 Apr 2007 10:33:03 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX18sxPVO6rIsfPykcGOXALuZT5+Mne+WCn9rO/jkXq kUU6OYB7gjPeGo User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en In-Reply-To: X-Y-GMX-Trusted: 0 X-detected-kernel: 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:69909 Archived-At: > in AUCTeX I am extending the region to be fontified by > `font-lock-default-fontify-region' backwards in order to cater for > large multiline constructs. In order to force refontification with > jit-lock, `jit-lock-context-unfontify-pos' is set to the start of such > a multiline construct. Now when this is done it seems that the > affected regions are refontified over and over again. That's the purpose of setting `jit-lock-context-unfontify-pos' when `jit-lock-contextually' is non-nil. jit-lock will trigger refontifying the _entire visible_ text below `jit-lock-context-unfontify-pos' after `jit-lock-context-time' seconds. > > Here is a testcase: > > (progn > (defun my-font-lock-fontify-region (beg end &optional loudly) > (setq jit-lock-context-unfontify-pos (- beg 1000)) > (message (format "Fontifying ... (buffer: %s, beg: %d)" > (prin1-to-string (current-buffer)) beg)) > (font-lock-default-fontify-region beg end loudly)) > (find-library "lisp-mode") > (setq font-lock-fontify-region-function 'my-font-lock-fontify-region)) > > After executing the form lisp-mode.el should be opened and the > `font-lock-fontify-region-function' will be set to the new one defined > in the code which always sets `jit-lock-context-unfontify-pos'. If > you now scroll to the bottom of the buffer with `C-v' the function > obviously gets called a lot. But once the bottom of the buffer is > reached I'd expect that to stop unless something changed in the > buffer. However, only some activity like scrolling or activating the > minibuffer will make the fontification function be called again. Everything's correct. Scrolling will move you into some text marked as not fontified and will trigger fontification from there which will, due to your setting, eventually mark the text as not fontified again, which will ... > This does not happen in Emacs 21, so it looks like this is a > regression. I got a bit tangled up in the font-lock and jit-lock code > and hope that somebody has an idea of what might be going wrong. It's the desired behavior. `jit-lock-context-unfontify-pos' should be set by jit-lock only. You are supposed to set this only in extreme cases and exercise care to never set this repeatedly. Why can't you use font-lock's new extend-region stuff for this purpose?