[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: jit-lock simplification?
From: |
Kim F. Storm |
Subject: |
Re: jit-lock simplification? |
Date: |
Wed, 13 Sep 2006 15:49:43 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
Stefan Monnier <address@hidden> writes:
>> 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 ;-)
I disagree, but YMMV.
Also, it's definitely not elegant when you look at the value of
timer-list :-)
Compare:
([nil 17671 61974 726488 nil (lambda (&rest --cl-rest--) (apply #[(G40900
G40901 G40902) "rJq\210\306 \307\216\310\211\211\211\311\211\211
\312JJ\313\310$.
\207" [G40900 modified buffer-file-truename buffer-file-name deactivate-mark
inhibit-modification-hooks buffer-modified-p ((byte-code
"\204\301\302!\210\302\207" [modified restore-buffer-modified-p nil] 2)) t
nil put-text-property fontified inhibit-point-motion-hooks inhibit-read-only
buffer-undo-list G40902 G40901] 7] (quote --buf--) (quote --orig-start--)
(quote --start--) --cl-rest--)) nil nil] [t 17671 61975 225097 0.5
blink-cursor-timer-function nil nil] [nil 17671 62024 0 60
display-time-event-handler nil nil])
to:
([nil 17671 61974 726488 nil jit-lock-fontify-again nil nil] [t 17671 61975
225097 0.5 blink-cursor-timer-function nil nil] [nil 17671 62024 0 60
display-time-event-handler nil nil])
>
>
>> *** 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
>
>
--
Kim F. Storm <address@hidden> http://www.cua.dk