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 B3697431E62 for ; Fri, 3 Aug 2012 05:15:58 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] 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 X6Boq9Wku4NS for ; Fri, 3 Aug 2012 05:15:56 -0700 (PDT) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by olra.theworths.org (Postfix) with ESMTP id 60666431FAE for ; Fri, 3 Aug 2012 05:15:56 -0700 (PDT) Received: by guru.guru-group.fi (Postfix, from userid 501) id 49A35100372; Fri, 3 Aug 2012 15:16:05 +0300 (EEST) From: Tomi Ollila To: notmuch@notmuchmail.org Subject: [PATCH] test: test-lib.el: replace sleep-for with sit-for in notmuch-test-wait Date: Fri, 3 Aug 2012 15:16:03 +0300 Message-Id: <1343996163-26720-1-git-send-email-tomi.ollila@iki.fi> X-Mailer: git-send-email 1.7.1 Cc: Tomi Ollila 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 12:15:58 -0000 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." -- 1.7.1