[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Setting jit-lock-defer-time disables font locking.
From: |
Stefan Monnier |
Subject: |
Re: Setting jit-lock-defer-time disables font locking. |
Date: |
Mon, 20 Mar 2006 02:37:38 -0500 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
> Start a session with jit-lock enabled and jit-lock-defer-time set to nil.
> (This is the default configuration). Set jit-lock-defer-time to a
> non-nil value, either directly or through M-x customize-group <ret>
> jit-lock <ret>. Edit a buffer. After-change font-locking is now
> broken.
> The reason for this problem is that jit-lock-function (the defun called
> directly from the display engine) sets the text property 'fontified to
> 'defer whenever jit-lock-defer-time is non-nil. However, when the
> pertinent timer hasn't been activated, the handling function
> (jit-lock-deferred-fontify) never gets called.
Indeed. I think the patch below DTRT.
> However, this still seems suboptimal - a user might well be experimenting
> with jit-lock-defer by customizing jit-lock-defer-time, and will get very
> frustrated on discovering his changes only take effect after restarting
> Emacs - if he ever discovers this. So I've added customize :set functions
> to do this - these changes now take place immediately.
These look overkill to me (many Emacs options don't take effect until you
restart some part of it), but otherwise seem harmless.
> I think there's another bug: jit-lock-contextually's doc-string says it
> has three distinct values: nil, t, and anything else (e.g.
> 'syntax-driven). I can't see any code which codes up 'syntax-driven.
There is:
;; Initialize contextual fontification if requested.
(when (eq jit-lock-contextually t)
(unless jit-lock-context-timer
[...]
(when (and contextual jit-lock-contextually)
(set (make-local-variable 'jit-lock-contextually) t))
> + *** When the customizable variables
> + jit-lock-\(stealth\|context\|defer\)-time and jit-lock-contextually are
> + customized, they now take effect immediately.
The NEWS is already much too long. Let's not add this kind of "news".
Stefan
--- jit-lock.el 07 fév 2006 12:22:36 -0500 1.48
+++ jit-lock.el 20 mar 2006 02:24:50 -0500
@@ -301,7 +301,7 @@
This function is added to `fontification-functions' when `jit-lock-mode'
is active."
(when (and jit-lock-mode (not memory-full))
- (if (null jit-lock-defer-time)
+ (if (null jit-lock-defer-timer)
;; No deferral.
(jit-lock-fontify-now start (+ start jit-lock-chunk-size))
;; Record the buffer for later fontification.
@@ -510,7 +510,7 @@
(setq pos (next-single-property-change pos
'fontified)))))))))
(setq jit-lock-defer-buffers nil)
;; Force fontification of the visible parts.
- (let ((jit-lock-defer-time nil))
+ (let ((jit-lock-defer-timer nil))
;; (message "Jit-Defer Now")
(sit-for 0)
;; (message "Jit-Defer Done")