From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Setting jit-lock-defer-time disables font locking. Date: Mon, 20 Mar 2006 02:37:38 -0500 Message-ID: <873bhdinrq.fsf-monnier+emacs@gnu.org> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1142840286 7331 80.91.229.2 (20 Mar 2006 07:38:06 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 20 Mar 2006 07:38:06 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Mar 20 08:38:04 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FLExm-0001lv-Ju for ged-emacs-devel@m.gmane.org; Mon, 20 Mar 2006 08:38:02 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FLExm-0002SO-0H for ged-emacs-devel@m.gmane.org; Mon, 20 Mar 2006 02:38:02 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FLExU-0002Ry-6m for emacs-devel@gnu.org; Mon, 20 Mar 2006 02:37:44 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FLExS-0002Ra-60 for emacs-devel@gnu.org; Mon, 20 Mar 2006 02:37:43 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FLExS-0002RT-4K for emacs-devel@gnu.org; Mon, 20 Mar 2006 02:37:42 -0500 Original-Received: from [209.226.175.97] (helo=tomts40-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FLF2x-0003fW-CD for emacs-devel@gnu.org; Mon, 20 Mar 2006 02:43:23 -0500 Original-Received: from alfajor ([70.55.140.81]) by tomts40-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20060320073741.JIJX1823.tomts40-srv.bellnexxia.net@alfajor>; Mon, 20 Mar 2006 02:37:41 -0500 Original-Received: by alfajor (Postfix, from userid 1000) id 026AFD73BE; Mon, 20 Mar 2006 02:37:38 -0500 (EST) Original-To: Alan Mackenzie In-Reply-To: (Alan Mackenzie's message of "Sun, 19 Mar 2006 17:25:35 +0000 (GMT)") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:51873 Archived-At: > 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 > jit-lock . 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=E9v 2006 12:22:36 -0500 1.48 +++ jit-lock.el 20 mar 2006 02:24:50 -0500=09 @@ -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")