unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* jit-lock simplification?
@ 2006-09-13 12:25 Kim F. Storm
  2006-09-13 13:03 ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Kim F. Storm @ 2006-09-13 12:25 UTC (permalink / raw)



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))))))))
  
  \f
  ;;; 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))))
+ 
+ 
  \f
  ;;; Stealth fontification.
  

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-09-14 11:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-13 12:25 jit-lock simplification? Kim F. Storm
2006-09-13 13:03 ` Stefan Monnier
2006-09-13 13:31   ` David Kastrup
2006-09-13 14:43     ` Stefan Monnier
2006-09-13 13:49   ` Kim F. Storm
2006-09-13 19:24     ` Richard Stallman
2006-09-14 11:08       ` Kim F. Storm

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).