--- /dev/null
+Return-Path: <tomi.ollila@nixu.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 B4206429E25\r
+ for <notmuch@notmuchmail.org>; Fri, 11 Nov 2011 12:49:05 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ autolearn=unavailable\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 5J5LySTNCmpz for <notmuch@notmuchmail.org>;\r
+ Fri, 11 Nov 2011 12:49:05 -0800 (PST)\r
+Received: from taco2.nixu.fi (taco2.nixu.fi [194.197.118.31])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 5206B431FB6\r
+ for <notmuch@notmuchmail.org>; Fri, 11 Nov 2011 12:49:05 -0800 (PST)\r
+Received: from taco2.nixu.fi (taco2.nixu.fi [194.197.118.31])\r
+ by taco2.nixu.fi (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id\r
+ pABKn20c010394; Fri, 11 Nov 2011 22:49:02 +0200\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: Jameson Graef Rollins <jrollins@finestructure.net>,\r
+ Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: [PATCH] test: use dtach(1) instead of screen(1) in emacs tests\r
+In-Reply-To: <1320963737-1666-1-git-send-email-jrollins@finestructure.net>\r
+References: <yf6mxc3ab4t.fsf@taco2.nixu.fi>\r
+ <1320963737-1666-1-git-send-email-jrollins@finestructure.net>\r
+User-Agent: Notmuch/0.9+23~g556c5fa (http://notmuchmail.org) Emacs/23.3.1\r
+ (i686-pc-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+ $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+ !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Fri, 11 Nov 2011 22:49:02 +0200\r
+Message-ID: <yf639due669.fsf@taco2.nixu.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\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: Fri, 11 Nov 2011 20:49:05 -0000\r
+\r
+dtach is simpler than screen and is not setuid/setgid program so\r
+TMPDIR does not get cleared by dynamic loader when executed.\r
+---\r
+\r
+Updated version after discussion with DmitryKurochkin and amdragon\r
+on IRC. Thank you.\r
+\r
+ test/test-lib.sh | 25 +++++++++++++------------\r
+ 1 files changed, 13 insertions(+), 12 deletions(-)\r
+\r
+diff --git a/test/test-lib.sh b/test/test-lib.sh\r
+index c81c709..c232130 100755\r
+--- a/test/test-lib.sh\r
++++ b/test/test-lib.sh\r
+@@ -39,7 +39,7 @@ done,*)\r
+ ;;\r
+ esac\r
+ \r
+-# Keep the original TERM for say_color\r
++# Keep the original TERM for say_color and emacs tests\r
+ ORIGINAL_TERM=$TERM\r
+ \r
+ # For repeatability, reset the environment to known value.\r
+@@ -843,12 +841,15 @@ EOF\r
+ test_emacs () {\r
+ if [ -z "$EMACS_SERVER" ]; then\r
+ EMACS_SERVER="notmuch-test-suite-$$"\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
++ # start a detached session with an emacs server\r
++ # user's TERM is given to dtach which assumes a minimally\r
++ # VT100-compatible terminal -- and emacs inherits that\r
++ TERM=$ORIGINAL_TERM dtach -n "$TMP_DIRECTORY/emacs-dtach-socket.$$" \\r
++ sh -c "stty rows 24 cols 80; exec '$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 '()' 2>/dev/null; do\r
+ sleep 1\r
+-- \r
+1.7.6.1\r
+\r