emacs-devel
[Top][All Lists]
Advanced

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

Re: jit-lock timer etc.


From: Chong Yidong
Subject: Re: jit-lock timer etc.
Date: Mon, 21 Aug 2006 14:51:12 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

martin rudalics <address@hidden> writes:

>> Martin, would you like to try to update your patch ?
>
> Apparently, my patch works also without restricting the values of
> `run-at-time' as I did earlier.  Could you please try the attached
> revision with "pathological" values for `jit-lock-stealth-time' and
> `jit-lock-stealth-nice'.

The patch looks very good to me.  I have just one serious question
plus a few nitpicks:

Each time Emacs becomes idle, `jit-lock-stealth-fontify' is called;
with this patch, it requeues itself as a non-idle timer until it
finishes fontifying.  What happens if Emacs becomes idle again before
fontification finishes?  (This may happen if jit-lock-stealth-time is
very short, or if a timer or process filter makes Emacs idle.)  It
seems to me that this will set off another series of non-idle timers,
which is not what we want.

I think that if jit-lock-stealth-fontify is called with no argument,
and fontification is proceeding, it should do nothing.  One way to do
this is to introduce a new `jit-lock-stealth-fontifying' variable.
(This may not work well if stealth fontification is so slow that the
buffer list changes significantly before fontification finishes, but I
think there's not much we can do about this.)

Now the nitpicks.  First, jit-lock-stealth-buffers should be
defvar'ed.

Second, this part is rather hard to read:

    (let (....
          load-delay)
      (when (or (not jit-lock-stealth-load)
                (or (<= (car (load-average)) jit-lock-stealth-load)
                    (not (setq load-delay t))))
         ...))

I suggest changing it to

    (let (...
          (load-delay (and jit-lock-stealth-load
                           (>= (car (load-average)) jit-lock-stealth-load))))
      (when (not load-delay)
         ...))

Finally, is it really necessary to test jit-lock-stealth-time here?
If it's invalid, jit-lock-stealth-fontify wouldn't get called in the
first place.

  (when (and jit-lock-stealth-buffers jit-lock-stealth-time)
    (run-at-time
      (if load-delay jit-lock-stealth-time (or jit-lock-stealth-nice 0))
      nil 'jit-lock-stealth-fontify t))

Other than that, I think this proposal is good.




reply via email to

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