unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* sleep-for documentation and how to pause reliably
@ 2013-02-15  9:22 Eli Zaretskii
  2013-02-15 10:19 ` Thierry Volpiatto
  2013-02-15 16:11 ` Stefan Monnier
  0 siblings, 2 replies; 12+ messages in thread
From: Eli Zaretskii @ 2013-02-15  9:22 UTC (permalink / raw)
  To: emacs-devel

Am I missing something, or is our current docs of sleep-for misleading?

The doc string says:

  (sleep-for SECONDS &optional MILLISECONDS)

  Pause, without updating display, for SECONDS seconds.

The only way I can interpret this is that sleep-for _always_ pauses
for that number of seconds.

The ELisp manual goes even further:

   -- Function: sleep-for seconds &optional millisec
       This function simply pauses for SECONDS seconds without updating
       the display.  It pays no attention to available input.  It returns
       `nil'.        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

       [...]

       Use `sleep-for' when you wish to guarantee a delay.
                                        ^^^^^^^^^^^^^^^^^

"Guarantee a delay".  No "buts".

However, in fact, sleep-for will return as soon as any input from any
subprocess arrives.  E.g., try this in *scratch*:

  (progn (setq proc (start-process-shell-command "ls" nil "ls"))
         (sleep-for 20)
	 (message "hi"))

You will see no delay at all before the message is displayed.

Am I missing something?  If not, apart of fixing the docs, _is_ there
any way to wait reliably when async subprocesses are running and
producing output?



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-03-02 20:48 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-15  9:22 sleep-for documentation and how to pause reliably Eli Zaretskii
2013-02-15 10:19 ` Thierry Volpiatto
2013-02-15 13:18   ` Eli Zaretskii
2013-02-15 20:36     ` Thierry Volpiatto
2013-02-16  8:40       ` Eli Zaretskii
2013-02-17 11:58         ` Xue Fuqiao
2013-02-17 16:26           ` Eli Zaretskii
2013-02-17 23:41             ` Xue Fuqiao
2013-02-15 16:11 ` Stefan Monnier
2013-02-15 18:24   ` Eli Zaretskii
2013-02-15 20:36     ` Stefan Monnier
2013-03-02 20:48     ` Johan Bockgård

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).