--- /dev/null
+Return-Path: <dmitry.kurochkin@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 1289742118E\r
+ for <notmuch@notmuchmail.org>; Wed, 29 Jun 2011 12:42:49 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id jOb2lcxdM+X3 for <notmuch@notmuchmail.org>;\r
+ Wed, 29 Jun 2011 12:42:47 -0700 (PDT)\r
+Received: from mail-bw0-f53.google.com (mail-bw0-f53.google.com\r
+ [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 437D6421186\r
+ for <notmuch@notmuchmail.org>; Wed, 29 Jun 2011 12:42:47 -0700 (PDT)\r
+Received: by bwg12 with SMTP id 12so1456477bwg.26\r
+ for <notmuch@notmuchmail.org>; Wed, 29 Jun 2011 12:42:45 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+ h=from:to:cc:subject:date:message-id:x-mailer;\r
+ bh=DXeJ8xscgeeP8aDKoXUlubzj57/+JUc3bjUJeMmcA08=;\r
+ b=NweTFQuaJy9wxaj43QEe/pA0Grixpiv8Pcg28ab/TF8a7M3bxRTQZYgWNbGdzF3Rxg\r
+ zoH7Gj5kE8VGLygvEwtk745b135zz76BgwteCm5ToW3m4zIzBAUDefvBpLsN9o24fvJw\r
+ QK1WcqIP653OIlTB5nRLHNO6ihT19ruuviVGU=\r
+Received: by 10.204.32.207 with SMTP id e15mr1128218bkd.60.1309376565762;\r
+ Wed, 29 Jun 2011 12:42:45 -0700 (PDT)\r
+Received: from localhost ([91.144.186.21])\r
+ by mx.google.com with ESMTPS id o3sm1437581bka.0.2011.06.29.12.42.44\r
+ (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Wed, 29 Jun 2011 12:42:45 -0700 (PDT)\r
+From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 1/6] test: run emacs inside screen\r
+Date: Wed, 29 Jun 2011 23:42:33 +0400\r
+Message-Id: <1309376558-26284-1-git-send-email-dmitry.kurochkin@gmail.com>\r
+X-Mailer: git-send-email 1.7.5.4\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 29 Jun 2011 19:42:49 -0000\r
+\r
+Before the change, emacs run in daemon mode without any visible\r
+buffers. Turns out that this affects emacs behavior in some\r
+cases. In particular, `window-end' function returns `point-max'\r
+instead of the last visible position. That makes it hard or\r
+impossible to implement some tests. The patch runs emacs in a\r
+detached screen(1) session. So that it works exactly as if it\r
+has a visible window.\r
+\r
+Note: screen terminates when emacs exits. So the patch does not\r
+introduce new "running processes left behind" issues.\r
+---\r
+ test/test-lib.sh | 10 ++++++++--\r
+ 1 files changed, 8 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/test/test-lib.sh b/test/test-lib.sh\r
+index 079d7db..8d7c98d 100755\r
+--- a/test/test-lib.sh\r
++++ b/test/test-lib.sh\r
+@@ -873,10 +873,16 @@ EOF\r
+ test_emacs () {\r
+ if [ -z "$EMACS_SERVER" ]; then\r
+ EMACS_SERVER="notmuch-test-suite-$$"\r
+- "$TMP_DIRECTORY/run_emacs" \\r
+- --daemon \\r
++ # start a detached screen session with an emacs server\r
++ screen -S "$EMACS_SERVER" -d -m "$TMP_DIRECTORY/run_emacs" \\r
++ --no-window-system \\r
+ --eval "(setq server-name \"$EMACS_SERVER\")" \\r
++ --eval '(server-start)' \\r
+ --eval "(orphan-watchdog $$)" || return\r
++ # wait until the emacs server is up\r
++ until test_emacs '()'; do\r
++ sleep 1\r
++ done\r
+ fi\r
+ \r
+ emacsclient --socket-name="$EMACS_SERVER" --eval "(progn $@)"\r
+-- \r
+1.7.5.4\r
+\r