unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: storm@cua.dk (Kim F. Storm)
Cc: cyd@stupidchicken.com, emacs-devel@gnu.org
Subject: Re: Nested sit-for's
Date: Thu, 17 Aug 2006 13:15:47 +0200	[thread overview]
Message-ID: <m3y7tnfw9o.fsf@kfs-l.imdomain.dk> (raw)
In-Reply-To: <E1GDaxs-0000xM-MG@fencepost.gnu.org> (Richard Stallman's message of "Thu, 17 Aug 2006 02:02:48 -0400")

Richard Stallman <rms@gnu.org> 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 <storm@cua.dk> http://www.cua.dk

  reply	other threads:[~2006-08-17 11:15 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1GD2sr-0005PH-UP@savannah.gnu.org>
     [not found] ` <m3bqqlka7e.fsf@kfs-l.imdomain.dk>
     [not found]   ` <87y7tp90i1.fsf@stupidchicken.com>
2006-08-16  8:14     ` Nested sit-for's Kim F. Storm
2006-08-16 19:08       ` Chong Yidong
2006-08-17  6:02       ` Richard Stallman
2006-08-17 11:15         ` Kim F. Storm [this message]
2006-08-17 14:02           ` David Kastrup
2006-08-18 15:47             ` Richard Stallman
2006-08-17 14:14           ` Chong Yidong
2006-08-17 15:09             ` Kim F. Storm
2006-08-17 17:21               ` Chong Yidong
2006-08-17 21:28                 ` Kim F. Storm
2006-08-17 22:42                   ` Chong Yidong
2006-08-17 16:05             ` martin rudalics
2006-08-17 21:33               ` Kim F. Storm
2006-08-18  9:03                 ` martin rudalics
2006-08-18  9:26                   ` Kim F. Storm
2006-08-20 13:54                     ` Chong Yidong
2006-08-20 21:05                       ` Kim F. Storm
2006-08-20 21:52                         ` martin rudalics
2006-08-20 22:05                           ` Kim F. Storm
2006-08-21 11:13                         ` Richard Stallman
2006-08-21 11:45                           ` Kim F. Storm
2006-08-21 16:14                             ` Stefan Monnier
2006-08-21 17:18                               ` martin rudalics
2006-08-22  1:40                                 ` Stefan Monnier
2006-08-22  7:42                               ` Richard Stallman
2006-08-17 14:21         ` Chong Yidong
2006-08-18 15:47           ` Richard Stallman
2007-10-17 14:41             ` Juanma Barranquero
2007-10-18  5:02               ` Richard Stallman
2007-10-18  7:40                 ` Juanma Barranquero
2007-10-23  7:13                   ` Richard Stallman
2006-08-17 15:33         ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3y7tnfw9o.fsf@kfs-l.imdomain.dk \
    --to=storm@cua.dk \
    --cc=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).