all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Phillip Lord <p.lord@russet.org.uk>
Subject: problems with idle timers
Date: 17 Jun 2004 10:34:25 +0100	[thread overview]
Message-ID: <vfhdtah6ji.fsf@rpc71.cs.man.ac.uk> (raw)





I have a problem with getting the idle timers to work properly. I've
just written a package which runs desktop.el in the idle timer. This
is nice because it can take a long time for the desktop to open
sometimes. 


I start a timer up like this...

(setq lazy-desktop-timer
          (run-with-idle-timer 5 t 'lazy-desktop-idle-timer))


which waits for 5 seconds into the idle cycle and then runs
repeatedly. 


This runs the following function...


(defun lazy-desktop-idle-timer()
  "Loop run in idle.
Open up some more buffers, until the user does something, then stop.
If there are no buffers left to open, then stop, kill the timer,
and thats it."
  (let ((repeat 1))
    (while (and repeat lazy-desktop-create-buffer-stack)
      (save-window-excursion
        (lazy-desktop-open-next-buffer))
      (setq repeat (sit-for 0.2)))
    (unless lazy-desktop-create-buffer-stack
      (message "Lazy desktop load complete")
      (sit-for 3)
      (message "")
      (cancel-timer lazy-desktop-timer))))


which iterates through all of the buffers to be opened. Eventually
when all the buffers are open it cancels the timer. 

So good so far. This has pretty much the behaviour I want. But there
is problem. While the timer works mostly as I want, and stops when I
do anything to Emacs, I notice that it sometimes gets stuck. So I'll
go and make some tea, and the idle timer will not have started
again. If I do something with emacs and then let it idle generally the
timer will start again happily. 

Are there any circumstances which the timer will not run properly
following an idle? Are there ways in which the "(sit-for 0.2)" will
return false (which will stop the loop) but not restart the idle timer
count? 

And is there any way around this? 

Cheers

Phil

             reply	other threads:[~2004-06-17  9:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-17  9:34 Phillip Lord [this message]
2004-07-01 10:31 ` problems with idle timers Kai Grossjohann
2004-07-01 11:49   ` Kai Grossjohann

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

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

  git send-email \
    --in-reply-to=vfhdtah6ji.fsf@rpc71.cs.man.ac.uk \
    --to=p.lord@russet.org.uk \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.