emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: jit-lock simplification?


From: Stefan Monnier
Subject: Re: jit-lock simplification?
Date: Wed, 13 Sep 2006 09:03:31 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> 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?

I see no reason why it shouldn't work as well.
I just find it less elegant ;-)


        Stefan


> *** 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 <address@hidden> http://www.cua.dk



> _______________________________________________
> Emacs-devel mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-devel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]