--- /dev/null
+Return-Path: <amdragon@mit.edu>\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 B0325431FC4\r
+ for <notmuch@notmuchmail.org>; Tue, 11 Mar 2014 15:20:16 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[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 4Y9umFKgm-Oy for <notmuch@notmuchmail.org>;\r
+ Tue, 11 Mar 2014 15:20:12 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-4.mit.edu (dmz-mailsec-scanner-4.mit.edu\r
+ [18.9.25.15])\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 A1B35431FBD\r
+ for <notmuch@notmuchmail.org>; Tue, 11 Mar 2014 15:20:12 -0700 (PDT)\r
+X-AuditID: 1209190f-f790b6d000000c3a-e6-531f8c196c74\r
+Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
+ (using TLS with cipher AES256-SHA (256/256 bits))\r
+ (Client did not present a certificate)\r
+ by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id 19.C8.03130.91C8F135; Tue, 11 Mar 2014 18:20:10 -0400 (EDT)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+ by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id s2BMK792009794; \r
+ Tue, 11 Mar 2014 18:20:08 -0400\r
+Received: from drake.dyndns.org (31-33-67.wireless.csail.mit.edu\r
+ [128.31.33.67]) (authenticated bits=0)\r
+ (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+ by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s2BMK62J024773\r
+ (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+ Tue, 11 Mar 2014 18:20:07 -0400\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+ (envelope-from <amdragon@mit.edu>)\r
+ id 1WNV1p-0003MX-Nj; Tue, 11 Mar 2014 18:20:05 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 1/2] test: Add broken test for Emacs boolean term escaping\r
+Date: Tue, 11 Mar 2014 18:19:53 -0400\r
+Message-Id: <1394576394-12816-1-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.8.4.rc3\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=UTF-8\r
+Content-Transfer-Encoding: 8bit\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFrrHIsWRmVeSWpSXmKPExsUixCmqrSvVIx9sMEfA4vrNmcwOjB7PVt1i\r
+ DmCM4rJJSc3JLEst0rdL4Mo439zJVtDOUfHo0F6mBsa/bF2MHBwSAiYS59YldzFyApliEhfu\r
+ rQcKc3EICcxmkmi+MhfK2cgo8X3VQkYI5xiTxJ61y5ggnLmMEksPvWEB6WcT0JDYtn85I4gt\r
+ IiAtsfPubFaQFcwCahJ/ulRAwsICXhKztuxlArFZBFQlFr6cDHYFr4CDxJZ94hBXKEksPLWN\r
+ FcTmFRCUODnzCQvEFHWJ9fOEQMLMAvISzVtnM09gFJiFpGoWQtUsJFULGJlXMcqm5Fbp5iZm\r
+ 5hSnJusWJyfm5aUW6Zro5WaW6KWmlG5iBAejJP8Oxm8HlQ4xCnAwKvHwzlCSDxZiTSwrrsw9\r
+ xCjJwaQkyju7AyjEl5SfUpmRWJwRX1Sak1p8iFGCg1lJhPejJlCONyWxsiq1KB8mJc3BoiTO\r
+ 23dWIlhIID2xJDU7NbUgtQgmK8PBoSTBu7wLqFGwKDU9tSItM6cEIc3EwQkynAdoOEM3yPDi\r
+ gsTc4sx0iPwpRkUpcd6FIM0CIImM0jy4XliyeMUoDvSKMG8USBUPMNHAdb8CGswENPhHANjg\r
+ kkSElFQDo7C/zpy37lvmusmmXkrSiJJ/f+WmUp3GTt39VQ8PVdu2MHPe6FVImd8WJ7Dt3XFW\r
+ qzgmLtOUH9IdVzb571GRZNTr+/TG0/de86MXy98p6vZey3j698ZdQYXZD/Qu7X2/yNrHZpoy\r
+ z44rN9yNTzpVM4ty3r94aUqr0u0DTQsXlMd7d3zTcJXbocRSnJFoqMVcVJwIAFPsrxTxAgAA\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: Tue, 11 Mar 2014 22:20:16 -0000\r
+\r
+The current term escaper gets most of these right, but fails to escape\r
+things containing Unicode "fancy quotes" or things containing\r
+non-whitespace control characters.\r
+---\r
+ test/T310-emacs.sh | 12 ++++++++++++\r
+ 1 file changed, 12 insertions(+)\r
+\r
+diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh\r
+index 00ae96a..6c18bbd 100755\r
+--- a/test/T310-emacs.sh\r
++++ b/test/T310-emacs.sh\r
+@@ -953,4 +953,16 @@ test_emacs '(notmuch-search "subject:\"search race test\" -subject:two")\r
+ output=$(notmuch search --output=messages 'tag:search-global-race-tag')\r
+ test_expect_equal "$output" "id:$gen_msg_id_1"\r
+ \r
++test_begin_subtest "Term escaping"\r
++test_subtest_known_broken\r
++output=$(test_emacs "(mapcar 'notmuch-escape-boolean-term (list\r
++ \"\"\r
++ \"abc\`~\!@#\$%^&*-=_+123\"\r
++ \"(abc\"\r
++ \")abc\"\r
++ \"\\\"abc\"\r
++ \"\x01xyz\"\r
++ \"\\x201cxyz\\x201d\"))")\r
++test_expect_equal "$output" '("\"\"" "abc`~!@#$%^&*-=_+123" "\"(abc\"" "\")abc\"" "\"\"\"abc\"" "\"'$'\x01''xyz\"" "\"“xyz”\"")'\r
++\r
+ test_done\r
+-- \r
+1.8.4.rc3\r
+\r