From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: sleep-for documentation and how to pause reliably Date: Fri, 15 Feb 2013 11:22:00 +0200 Message-ID: <83mwv6szif.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1360920162 6713 80.91.229.3 (15 Feb 2013 09:22:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 15 Feb 2013 09:22:42 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 15 10:23:04 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1U6HVW-00056y-UI for ged-emacs-devel@m.gmane.org; Fri, 15 Feb 2013 10:23:03 +0100 Original-Received: from localhost ([::1]:60158 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6HVD-0008Pi-5p for ged-emacs-devel@m.gmane.org; Fri, 15 Feb 2013 04:22:43 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:38448) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6HV7-0008L4-RZ for emacs-devel@gnu.org; Fri, 15 Feb 2013 04:22:41 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U6HV6-0000oI-6m for emacs-devel@gnu.org; Fri, 15 Feb 2013 04:22:37 -0500 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:36618) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6HV5-0000o4-Vm for emacs-devel@gnu.org; Fri, 15 Feb 2013 04:22:36 -0500 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0MI9008008KXWM00@a-mtaout22.012.net.il> for emacs-devel@gnu.org; Fri, 15 Feb 2013 11:21:42 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MI9007WU8O518I1@a-mtaout22.012.net.il> for emacs-devel@gnu.org; Fri, 15 Feb 2013 11:21:42 +0200 (IST) X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.172 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:157042 Archived-At: 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?