From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: Nested sit-for's Date: Thu, 17 Aug 2006 13:15:47 +0200 Message-ID: References: <87y7tp90i1.fsf@stupidchicken.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1155813459 29228 80.91.229.2 (17 Aug 2006 11:17:39 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 17 Aug 2006 11:17:39 +0000 (UTC) Cc: cyd@stupidchicken.com, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Aug 17 13:17:37 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 1GDfsU-00014H-0b for ged-emacs-devel@m.gmane.org; Thu, 17 Aug 2006 13:17:34 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GDfsT-0008Df-Cm for ged-emacs-devel@m.gmane.org; Thu, 17 Aug 2006 07:17:33 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GDfsF-0008Bw-RC for emacs-devel@gnu.org; Thu, 17 Aug 2006 07:17:19 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GDfsC-0008BL-QT for emacs-devel@gnu.org; Thu, 17 Aug 2006 07:17:19 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GDfsC-0008B8-Lx for emacs-devel@gnu.org; Thu, 17 Aug 2006 07:17:16 -0400 Original-Received: from [195.41.46.237] (helo=pfepc.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GDfyd-0007Pf-H6; Thu, 17 Aug 2006 07:23:55 -0400 Original-Received: from kfs-l.imdomain.dk.cua.dk (unknown [80.165.4.124]) by pfepc.post.tele.dk (Postfix) with SMTP id 284F38A0071; Thu, 17 Aug 2006 13:17:06 +0200 (CEST) Original-To: rms@gnu.org In-Reply-To: (Richard Stallman's message of "Thu, 17 Aug 2006 02:02:48 -0400") 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:58462 Archived-At: Richard Stallman writes: > >> What about the change that we discussed where nested sit-for calls > >> should not wait longer than any of the outer calls?? > > I am not sure it is really a bug. Whether this behavior is incorrect > depends on how you think of sit-for's purpose, and there is a natural > way to think of it which makes this behavior correct. For the inner > sit-for fail to wait for the time specified seems clearly wrong. > > My conclusion is that it is wrong for a timer to do a sit-for that > lasts any substantial time. It should instead schedule a new timer. > As long as jit-lock-stealth-nice is a short period such as 0.5, its > sit-for cannot cause a big delay to anything else. > > The potential problem I do see is that jit-lock-stealth-fontify will > keep looping as long as input-pending-p is nil. If it were to run > from inside some other idle timer, that other idle timer would not get > control back until fontification is finished. Making > jit-lock-stealth-fontify's sit-for return faster won't avoid this > problem, only reduce it, since jit-lock-stealth-fontify still would > not return until it finishes fontification. The only solutions are > (1) that jit-lock-stealth-fontify reschedule itself instead of using > sit-for, or (2) that the other timer function avoid using sit-for. > If several timers try this sit-for trick, then no matter what we make > sit-for do, they can't all get the behavior they want, which is to do > some more processing at a certain time in the future. The only method > they can all use that enables them all to get this behavior is that of > rescheduling timers. > > It would work to have ONE timer that does sit-for if we make a rule > that no others can do so. We could define jit-lock as this one > exception. (This has the advantage of not involving any change in the > code, just comments and the Lisp Manual.) > > What do people think of that? I agree with your analysis. The "max sit-for" timeout hack may cause more problems than it solves, so it is not TRT. In general, timers should never use sit-for, so I think we should document that in the manual. But, IMO, if we make it a rule that timers should generally not use sit-for, then a central function like jit-lock should definitely not use sit-for! -- Kim F. Storm http://www.cua.dk