From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: jit-lock simplification? Date: Wed, 13 Sep 2006 14:25:00 +0200 Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1158150413 26168 80.91.229.2 (13 Sep 2006 12:26:53 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 13 Sep 2006 12:26:53 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 13 14:26:48 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 1GNTpD-00086Y-Dm for ged-emacs-devel@m.gmane.org; Wed, 13 Sep 2006 14:26:44 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GNTpC-0003gh-QG for ged-emacs-devel@m.gmane.org; Wed, 13 Sep 2006 08:26:42 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GNToe-0003Uj-3F for emacs-devel@gnu.org; Wed, 13 Sep 2006 08:26:08 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GNToa-0003RQ-Rx for emacs-devel@gnu.org; Wed, 13 Sep 2006 08:26:07 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GNToa-0003R2-D4 for emacs-devel@gnu.org; Wed, 13 Sep 2006 08:26:04 -0400 Original-Received: from [195.41.46.235] (helo=pfepa.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GNTqI-0003Kx-QG for emacs-devel@gnu.org; Wed, 13 Sep 2006 08:27:50 -0400 Original-Received: from kfs-l.imdomain.dk.cua.dk (unknown [80.165.4.124]) by pfepa.post.tele.dk (Postfix) with SMTP id 5A754FAC01B for ; Wed, 13 Sep 2006 14:26:03 +0200 (CEST) Original-To: emacs-devel@gnu.org User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) 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:59765 Archived-At: I was debugging a timer problem, and noticed some very odd lambda forms in the timer-list. It turns out to be the lambda generated by the jit-lock code below. Wouldn't it work just as well with the following patch? *** jit-lock.el 25 Aug 2006 08:57:52 +0200 1.55 --- jit-lock.el 13 Sep 2006 14:12:18 +0200 *************** *** 397,415 **** ;; eagerly extend the refontified region with ;; jit-lock-after-change-extend-region-functions. (when (< start orig-start) ! (lexical-let ((start start) ! (orig-start orig-start) ! (buf (current-buffer))) ! (run-with-timer ! 0 nil (lambda () ! (with-current-buffer buf ! (with-buffer-prepared-for-jit-lock ! (put-text-property start orig-start ! 'fontified t))))))) ;; Find the start of the next chunk, if any. (setq start (text-property-any next end 'fontified nil)))))))) ;;; Stealth fontification. --- 397,415 ---- ;; eagerly extend the refontified region with ;; jit-lock-after-change-extend-region-functions. (when (< start orig-start) ! (run-with-timer 0 nil 'jit-lock-fontify-again ! (current-buffer) start orig-start)) ;; Find the start of the next chunk, if any. (setq start (text-property-any next end 'fontified nil)))))))) + (defun jit-lock-fontify-again (buf start end) + "Fontify in buffer BUF from START to END." + (with-current-buffer buf + (with-buffer-prepared-for-jit-lock + (put-text-property start end 'fontified t)))) + + ;;; Stealth fontification. -- Kim F. Storm http://www.cua.dk