From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ralf Angeli Newsgroups: gmane.emacs.devel Subject: Re: Excessive refontification when setting jit-lock-context-unfontify-pos Date: Fri, 27 Apr 2007 23:11:35 +0200 Message-ID: <873b2la5fc.fsf@neutrino.caeruleus.net> References: <87bqhdaajz.fsf@neutrino.caeruleus.net> <877is1wjti.fsf@neutrino.caeruleus.net> <87ps5tufmf.fsf@neutrino.caeruleus.net> <87k5vxvh4x.fsf@neutrino.caeruleus.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1177708311 32511 80.91.229.12 (27 Apr 2007 21:11:51 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 27 Apr 2007 21:11:51 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Apr 27 23:11:49 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 1HhXjG-0007FU-F2 for ged-emacs-devel@m.gmane.org; Fri, 27 Apr 2007 23:11:46 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HhXp9-0004NL-4p for ged-emacs-devel@m.gmane.org; Fri, 27 Apr 2007 17:17:51 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HhXp6-0004NG-6f for emacs-devel@gnu.org; Fri, 27 Apr 2007 17:17:48 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HhXp2-0004KB-LE for emacs-devel@gnu.org; Fri, 27 Apr 2007 17:17:47 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HhXp2-0004Jt-Fv for emacs-devel@gnu.org; Fri, 27 Apr 2007 17:17:44 -0400 Original-Received: from moutng.kundenserver.de ([212.227.126.179]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HhXj8-0006qB-QO for emacs-devel@gnu.org; Fri, 27 Apr 2007 17:11:39 -0400 Original-Received: from [84.165.14.137] (helo=neutrino.caeruleus.net) by mrelayeu.kundenserver.de (node=mrelayeu0) with ESMTP (Nemesis), id 0MKwh2-1HhXj64C1y-0006K2; Fri, 27 Apr 2007 23:11:37 +0200 In-Reply-To: (Stefan Monnier's message of "Fri\, 27 Apr 2007 14\:54\:00 -0400") User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.96 (gnu/linux) X-Provags-ID: V01U2FsdGVkX180cPwJeRigS4A8RqfaOVv0/ood7xQLLMb2AaZ OuaoQZTAOjMyZjkKX4/T+4VYhd6naW3/QWGQWtN/qpgb2Njsqh lBADcgXJ36x0sh/3TdlHA== X-detected-kernel: Linux 2.6? (barebone, rare!) 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:70291 Archived-At: * Stefan Monnier (2007-04-27) writes: >> When typing `C-l' highlighting appears. Is there a possibility to >> enforce such redisplay in an efficient way? I could probably call >> `sit-for' somewhere in the code but I am not sure if this would be the >> right way. > > I understand the problem, then. Your code is working fine, it's just that > some part of the text your re-highlight is re-highlighted by jit-lock but > *after* having been rendered by the redisplay engine. > Typically it works like this: [...] Thanks very much for the explanations. > So in your case you can either use > jit-lock-after-change-extend-region-functions; Unfortunately this hook is not available in Emacs 21. > or you can use a similar > run-with-timer in your font-lock-fontify-region-function. If you look at > jit-lock-force-redisplay, you'll see that it should not cause infinite > looping because it only causes redisplay (like C-l would) but not > re-highlighting. This is probably the way to go. I tried this and it works very well. (For Emacs 21 I put the contents of `jit-lock-force-redisplay' into an anonymous function passed to `run-with-timer'.) > In Emacs>22 we should fix the font-lock/jit-lock interface so that jit-lock > can handle this case automatically. That would be nice, yes. For now I am relieved that this could be solved from within AUCTeX as well. Thank you very much for your valuable help. -- Ralf