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 19:53:02 +0200 Message-ID: <87k5vxvh4x.fsf@neutrino.caeruleus.net> References: <87bqhdaajz.fsf@neutrino.caeruleus.net> <877is1wjti.fsf@neutrino.caeruleus.net> <87ps5tufmf.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 1177696393 15358 80.91.229.12 (27 Apr 2007 17:53:13 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 27 Apr 2007 17:53:13 +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 19:53:12 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 1HhUd2-0007v7-Vt for ged-emacs-devel@m.gmane.org; Fri, 27 Apr 2007 19:53:09 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HhUiu-0007wG-Eh for ged-emacs-devel@m.gmane.org; Fri, 27 Apr 2007 13:59:12 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HhUir-0007wB-HI for emacs-devel@gnu.org; Fri, 27 Apr 2007 13:59:09 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HhUiq-0007vz-3F for emacs-devel@gnu.org; Fri, 27 Apr 2007 13:59:09 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HhUip-0007vw-VM for emacs-devel@gnu.org; Fri, 27 Apr 2007 13:59:07 -0400 Original-Received: from moutng.kundenserver.de ([212.227.126.187]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HhUcx-00039t-9Y for emacs-devel@gnu.org; Fri, 27 Apr 2007 13:53:03 -0400 Original-Received: from [84.165.14.137] (helo=neutrino.caeruleus.net) by mrelayeu.kundenserver.de (node=mrelayeu5) with ESMTP (Nemesis), id 0ML25U-1HhUcu0ufC-0006Zw; Fri, 27 Apr 2007 19:53:01 +0200 In-Reply-To: (Stefan Monnier's message of "Wed\, 25 Apr 2007 03\:28\:15 -0400") User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.96 (gnu/linux) X-Provags-ID: V01U2FsdGVkX1/LMYaUEca/DBG8dXC0Tg6BB3/smRl60RMnJiE Nm59oTJdM11bWNRP7/9qRMB7wfoshrYwCSmj6VTQzb+Km359fs HFzzTuIZjyPG1epyXqISg== 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:70271 Archived-At: * Stefan Monnier (2007-04-25) writes: >> That's what I do. (See `font-latex-fontify-region'.) But the >> multiline construct does not get fully highlighted if I don't set >> j-l-c-u-p or set the fontified property to nil. > > Try C-l to make sure that the highlighting is really absent from the buffer, > rather than merely being "not yet displayed". 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. Anyway, below you can find the testcase I promised. Just execute it and type ''. Then you should see that only the line where '' was typed is highlighted. If you uncomment the line setting j-l-c-u-p you should see that the region gets highlighted after a short delay without having to type `C-l'. Here is the code: (progn (defun my-match-quote (limit) (let (start) (when (setq start (search-forward "``" limit t)) (if (search-forward "''" nil t) ; Do not limit forward search ; for this testcase. (progn (set-match-data (list start end)) t) (set-match-data (list 0 0)))))) (defun my-f-l-fontify-region (beg end &optional loudly) ;; For testing purposes we assume that the region should be extended ;; to the start of the buffer. ;; (setq jit-lock-context-unfontify-pos 1) (font-lock-default-fontify-region 1 end loudly)) (switch-to-buffer (get-buffer-create "*foo*")) (setq my-f-l-keywords '((my-match-quote . font-lock-string-face))) (setq font-lock-defaults '(my-f-l-keywords)) (setq font-lock-fontify-region-function 'my-f-l-fontify-region) (insert "``") (dotimes (i 1000) (insert "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n")) (font-lock-mode 1) (backward-char)) -- Ralf