--- /dev/null
+Return-Path: <awg@lagos.xvx.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 4C1A6431FCF\r
+ for <notmuch@notmuchmail.org>; Tue, 21 Feb 2012 22:46:46 -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 rE43QEJXpuzf for <notmuch@notmuchmail.org>;\r
+ Tue, 21 Feb 2012 22:46:45 -0800 (PST)\r
+Received: from smtp-out-04.shaw.ca (smtp-out-04.shaw.ca [64.59.134.12])\r
+ by olra.theworths.org (Postfix) with ESMTP id A50BB431FAE\r
+ for <notmuch@notmuchmail.org>; Tue, 21 Feb 2012 22:46:45 -0800 (PST)\r
+Received: from lb7f8hsrpno-svcs.dcs.int.inet (HELO pd5ml1no-ssvc.prod.shaw.ca)\r
+ ([10.0.144.222])\r
+ by pd5mo1no-svcs.prod.shaw.ca with ESMTP; 21 Feb 2012 23:46:45 -0700\r
+X-Cloudmark-SP-Filtered: true\r
+X-Cloudmark-SP-Result: v=1.1 cv=bD0CuDYpMgGTku+nVSbZuKP/9fNjspX1F8zuwcoBWhM=\r
+ c=1 sm=1\r
+ a=9pECzfXRGIEA:10 a=BLceEmwcHowA:10 a=yQp6g8lIsgqumF79BAsFDg==:17\r
+ a=QDwvV1CsnJkeiAAkpzgA:9 a=UXqUYI6nDuMlVyhDXWAA:7\r
+ a=HpAAvcLHHh0Zw7uRqdWCyQ==:117\r
+Received: from unknown (HELO lagos.xvx.ca) ([96.52.216.56])\r
+ by pd5ml1no-dmz.prod.shaw.ca with ESMTP; 21 Feb 2012 23:46:45 -0700\r
+Received: by lagos.xvx.ca (Postfix, from userid 1000)\r
+ id 90E058095C4D; Tue, 21 Feb 2012 23:46:44 -0700 (MST)\r
+From: Adam Wolfe Gordon <awg+notmuch@xvx.ca>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v6 03/10] reply: Require that only one message is returned\r
+Date: Tue, 21 Feb 2012 23:46:32 -0700\r
+Message-Id: <1329893199-21630-4-git-send-email-awg+notmuch@xvx.ca>\r
+X-Mailer: git-send-email 1.7.5.4\r
+In-Reply-To: <1329893199-21630-1-git-send-email-awg+notmuch@xvx.ca>\r
+References: <1329893199-21630-1-git-send-email-awg+notmuch@xvx.ca>\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, 22 Feb 2012 06:46:46 -0000\r
+\r
+As the semantics of replying to multiple messages have not yet been\r
+defined well, make notmuch reply require that the search given returns\r
+only a single message.\r
+---\r
+ notmuch-reply.c | 36 +++++++++++++++++++-----------------\r
+ 1 files changed, 19 insertions(+), 17 deletions(-)\r
+\r
+diff --git a/notmuch-reply.c b/notmuch-reply.c\r
+index 8e56245..177e6ca 100644\r
+--- a/notmuch-reply.c\r
++++ b/notmuch-reply.c\r
+@@ -572,30 +572,32 @@ notmuch_reply_format_default(void *ctx,\r
+ notmuch_message_t *message;\r
+ const notmuch_show_format_t *format = &format_reply;\r
+ \r
+- for (messages = notmuch_query_search_messages (query);\r
+- notmuch_messages_valid (messages);\r
+- notmuch_messages_move_to_next (messages))\r
+- {\r
+- message = notmuch_messages_get (messages);\r
++ if (notmuch_query_count_messages (query) != 1) {\r
++ fprintf (stderr, "Error: search term did not match precisely one message.\n");\r
++ return 1;\r
++ }\r
+ \r
+- reply = create_reply_message (ctx, config, message, reply_all);\r
++ messages = notmuch_query_search_messages (query);\r
++ message = notmuch_messages_get (messages);\r
+ \r
+- if (!reply)\r
+- continue;\r
++ reply = create_reply_message (ctx, config, message, reply_all);\r
+ \r
+- show_reply_headers (reply);\r
++ if (!reply)\r
++ return 1;\r
+ \r
+- g_object_unref (G_OBJECT (reply));\r
+- reply = NULL;\r
++ show_reply_headers (reply);\r
+ \r
+- printf ("On %s, %s wrote:\n",\r
+- notmuch_message_get_header (message, "date"),\r
+- notmuch_message_get_header (message, "from"));\r
++ g_object_unref (G_OBJECT (reply));\r
++ reply = NULL;\r
+ \r
+- show_message_body (message, format, params);\r
++ printf ("On %s, %s wrote:\n",\r
++ notmuch_message_get_header (message, "date"),\r
++ notmuch_message_get_header (message, "from"));\r
++\r
++ show_message_body (message, format, params);\r
++\r
++ notmuch_message_destroy (message);\r
+ \r
+- notmuch_message_destroy (message);\r
+- }\r
+ return 0;\r
+ }\r
+ \r
+-- \r
+1.7.5.4\r
+\r