[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: run-with-idle-timer and sit-for/sleep-for

From: Lennart Borgman (gmail)
Subject: Re: run-with-idle-timer and sit-for/sleep-for
Date: Tue, 08 Jul 2008 19:08:34 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20071031 Thunderbird/ Mnenhy/

Andreas Röhler wrote:
Am Dienstag, 8. Juli 2008 schrieb Lennart Borgman (gmail):
  (defun temp-idle()
    (message "temp-idle"))

  (defun temp()
    (message "temp a")
    (run-with-idle-timer 1 nil 'temp-idle)
    (sit-for 4)
    (message "temp b"))


here it works.

I.e. if I wait after `run-with-idle-timer'

"temp-idle" is shown in the message buffer.

I am not sure what you mean. With the above I get the output

  temp a
  tamp b

With `sit-for' emacs probably isn`t idle, but counting.

Yes, it is not idle in the sense I want it to be here. (But is it really counting?)

Maybe describe the case you will test, so we may find a solution.

Thanks, I want to test fontification with mumamo. However I think I have found a recipe now that works:

  (defun be-really-idle (seconds)
    (with-timeout (4 (message "timed out: %s"
                              (format-time-string "%M:%S")))
      (read-minibuffer (format-time-string
                        "Just waiting: %M:%S"))))

  (defun temp-idle()
    (message "temp-idle: %s" (format-time-string "%M:%S")))

  (defun temp()
    (message "temp a: %s" (format-time-string "%M:%S"))
    (run-with-idle-timer 1 nil 'temp-idle)
    (be-really-idle 4)
    (message "temp b: %s" (format-time-string "%M:%S")))

This gives me the output I want:

 temp a: 01:14
 temp-idle: 01:15
 timed out: 01:18
 temp b: 01:18


Andreas Röhler

reply via email to

[Prev in Thread] Current Thread [Next in Thread]