--- /dev/null
+Return-Path: <bremner@unb.ca>\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 CB35C431FAF\r
+ for <notmuch@notmuchmail.org>; Wed, 26 Dec 2012 05:23:34 -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=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 fveILabMZHis for <notmuch@notmuchmail.org>;\r
+ Wed, 26 Dec 2012 05:23:33 -0800 (PST)\r
+Received: from tesseract.cs.unb.ca (tesseract.cs.unb.ca [131.202.240.238])\r
+ (using TLSv1 with cipher AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 05049431FAE\r
+ for <notmuch@notmuchmail.org>; Wed, 26 Dec 2012 05:23:33 -0800 (PST)\r
+Received: from fctnnbsc30w-156034082078.dhcp-dynamic.fibreop.nb.bellaliant.net\r
+ ([156.34.82.78] helo=zancas.localnet)\r
+ by tesseract.cs.unb.ca with esmtpsa\r
+ (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72)\r
+ (envelope-from <bremner@unb.ca>)\r
+ id 1TnqxC-0002PM-W7; Wed, 26 Dec 2012 09:23:27 -0400\r
+Received: from bremner by zancas.localnet with local (Exim 4.80)\r
+ (envelope-from <bremner@unb.ca>)\r
+ id 1Tnqwm-0003UO-3a; Wed, 26 Dec 2012 09:23:00 -0400\r
+From: David Bremner <david@tethera.net>\r
+To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: Xapian-quoting based batch-tagging.\r
+In-Reply-To: <87ehid5h64.fsf@qmul.ac.uk>\r
+References: <1356464567-21779-1-git-send-email-david@tethera.net>\r
+ <87ehid5h64.fsf@qmul.ac.uk>\r
+User-Agent: Notmuch/0.14+213~g4af1ac6 (http://notmuchmail.org) Emacs/24.2.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Wed, 26 Dec 2012 09:23:00 -0400\r
+Message-ID: <87txr9q763.fsf@zancas.localnet>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-Spam_bar: -\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, 26 Dec 2012 13:23:34 -0000\r
+\r
+Mark Walters <markwalters1009@gmail.com> writes:\r
+\r
+> I am unclear about how this is going to deal with queries containing\r
+> newlines. For dump/restore I think this is not a problem (as Austin and\r
+> others have said), but for batch tagging I think it could be; for\r
+> example the query could be for a tag containing a newline.\r
+\r
+Yes, that's true, this patch series does not support queries with tags\r
+with embedded newlines. They can still be removed (and added) via either\r
+batch tagging or the command line. We could just live with this, or\r
+\r
+- The current syntax allows for detecting options at the start of the\r
+ line; perhaps a future fix would be to have the batch tagging and\r
+ command line tagging accept an optionally hex encoded query, something\r
+ like:\r
+\r
+ --hex +found%20it -- tag:%22stupid%0Atag%22\r
+\r
+- Alternatively, we could add hex decoding on top of xapian quoting for\r
+ queries. One UI downside is that people have to remember that % are\r
+ special.\r
+\r
+ +found%25it -- tag:lost%25it\r
+\r
+ Another is that quoting is still (surprisingly) necessary for encoded\r
+ spaces\r
+ \r
+ +found%20it -- tag:"lost%20it"\r
+ \r
+ Introducing yet another escape format, e.g. "\n" would require more\r
+ code, and not really much benefit afaict versus re-using hex-encoding.\r
+ Offhand I don't see how to avoid this without some level of query\r
+ pre-processing a-la\r
+ \r
+ id:1356313183-9266-1-git-send-email-david@tethera.net\r
+\r
+d\r