Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 417C6431FAF for ; Fri, 3 Aug 2012 13:52:24 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TIw1N-qKU50e for ; Fri, 3 Aug 2012 13:52:22 -0700 (PDT) Received: from dmz-mailsec-scanner-5.mit.edu (DMZ-MAILSEC-SCANNER-5.MIT.EDU [18.7.68.34]) by olra.theworths.org (Postfix) with ESMTP id 22CF7431FAE for ; Fri, 3 Aug 2012 13:52:22 -0700 (PDT) X-AuditID: 12074422-b7f1f6d00000090b-10-501c3a05f66e Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP id 56.C8.02315.50A3C105; Fri, 3 Aug 2012 16:52:21 -0400 (EDT) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q73KqK9H023417; Fri, 3 Aug 2012 16:52:21 -0400 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q73KqGcu005055 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Fri, 3 Aug 2012 16:52:19 -0400 (EDT) Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) (envelope-from ) id 1SxOr2-00017v-MF; Fri, 03 Aug 2012 16:52:16 -0400 Date: Fri, 3 Aug 2012 16:52:16 -0400 From: Austin Clements To: Tomi Ollila Subject: Re: [PATCH] test: test-lib.el: replace sleep-for with sit-for in notmuch-test-wait Message-ID: <20120803205216.GG22601@mit.edu> References: <1343996163-26720-1-git-send-email-tomi.ollila@iki.fi> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1343996163-26720-1-git-send-email-tomi.ollila@iki.fi> User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmphleLIzCtJLcpLzFFi42IR4hRV1mW1kgkwmHFE0+L6zZnMFm9WzmN1 YPI4/HUhi8ezVbeYA5iiuGxSUnMyy1KL9O0SuDKW7tnCXHCBt2LDxIlMDYzfuLoYOTkkBEwk Dh68xwhhi0lcuLeerYuRi0NIYB+jxIKfD1kgnPWMEoc2HYdyTjBJnHgxnx3CWcIocXjZRVaQ fhYBFYlN34+xg9hsAhoS2/YvB5srAhR/0LYerIZZQFri2+9mJhBbWCBWYt+MRWD1vAI6En/O 9IDZQgJOEje//ICKC0qcnPmEBaJXS+LGv5dAvRxgc5b/4wAJcwo4S0x6+BmsXBRo1ZST29gm MArNQtI9C0n3LITuBYzMqxhlU3KrdHMTM3OKU5N1i5MT8/JSi3RN9XIzS/RSU0o3MYICm91F aQfjz4NKhxgFOBiVeHiTVWQChFgTy4orcw8xSnIwKYny5hgBhfiS8lMqMxKLM+KLSnNSiw8x SnAwK4nw7lIEyvGmJFZWpRblw6SkOViUxHmvpdz0FxJITyxJzU5NLUgtgsnKcHAoSfC6WgI1 ChalpqdWpGXmlCCkmTg4QYbzAA2PBanhLS5IzC3OTIfIn2JUlBLnlQBJCIAkMkrz4HphiecV ozjQK8K85iBVPMCkBdf9CmgwE9BgOzMpkMEliQgpqQbG+LBFnquN/y1w8ayZ9enMHP7ieR63 Tzto6aQeiVeckLKwsqWff7p3M2/LmVmCXUdNtDcLCy0tZny4NF54iU+Mj7ZKx4TlCyfIzNLc E7nv8e5NNav731f02hUfWrHrmMzXxNOhk+98US+RyPr78GHP+kkVHvdDfY9sVNMvtbG/erOr 0Dtu94ZyJZbijERDLeai4kQA7hXvLBcDAAA= Cc: notmuch@notmuchmail.org X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Aug 2012 20:52:24 -0000 Code LGTM, but maybe the comment should explain that this is a workaround for a bug in Emacs, given that both sleep-for and sit-for are supposed to process process output and run sentinels (which has been stated in the Elisp reference at least as far back as Emacs 21). In light of this (and our better understanding of sleep-for and sit-for from IRC discussions), the commit message is also misleading. Quoth Tomi Ollila on Aug 03 at 3:16 pm: > The function `notmuch-test-wait` called `get-buffer-process` and > `sleep-for` in a loop. On some emacses neither of these cause emacs > to check whether the process has exited and update it's status > accordingly. In this case the loop does not exit. > > The function `sit-for` goes into event loop via `read-event` function > call. `read-event` does not return when process exits but the event > loop used to determine whether there is keyboard, mouse, etc. event > updates the process status as a side effect of the (more generic) > event loop. `sit-for` is used here to restore the event into queue > in the improbable case `read-event` consumes an event. > --- > test/test-lib.el | 3 ++- > 1 files changed, 2 insertions(+), 1 deletions(-) > > diff --git a/test/test-lib.el b/test/test-lib.el > index 5dd6271..d14246a 100644 > --- a/test/test-lib.el > +++ b/test/test-lib.el > @@ -38,7 +38,8 @@ > (defun notmuch-test-wait () > "Wait for process completion." > (while (get-buffer-process (current-buffer)) > - (sleep-for 0.1))) > + ;; sit-for visits event loop for process exit notification. > + (sit-for 0.1))) > > (defun test-output (&optional filename) > "Save current buffer to file FILENAME. Default FILENAME is OUTPUT."