From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: jit-lock timer etc. Date: Mon, 21 Aug 2006 14:51:12 -0400 Message-ID: <87fyfpq5wf.fsf@stupidchicken.com> References: <44E9E5F5.8000400@gmx.at> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1156186327 11968 80.91.229.2 (21 Aug 2006 18:52:07 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 21 Aug 2006 18:52:07 +0000 (UTC) Cc: emacs-devel@gnu.org, rms@gnu.org, "Kim F. Storm" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 21 20:52:03 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 1GFEra-0003Cl-JZ for ged-emacs-devel@m.gmane.org; Mon, 21 Aug 2006 20:51:06 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GFEra-0002jR-24 for ged-emacs-devel@m.gmane.org; Mon, 21 Aug 2006 14:51:06 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GFEqR-0001cM-GA for emacs-devel@gnu.org; Mon, 21 Aug 2006 14:49:55 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GFEqO-0001aa-0z for emacs-devel@gnu.org; Mon, 21 Aug 2006 14:49:55 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GFEqN-0001aX-Rx for emacs-devel@gnu.org; Mon, 21 Aug 2006 14:49:51 -0400 Original-Received: from [18.19.1.138] (helo=cyd) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GFExk-0000eT-Bb; Mon, 21 Aug 2006 14:57:28 -0400 Original-Received: by cyd (Postfix, from userid 1000) id 981FA4E2C2; Mon, 21 Aug 2006 14:51:12 -0400 (EDT) Original-To: martin rudalics In-Reply-To: <44E9E5F5.8000400@gmx.at> (martin rudalics's message of "Mon, 21 Aug 2006 18:57:25 +0200") 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:58660 Archived-At: martin rudalics 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.