--- /dev/null
+Return-Path: <ma.skies@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 16FF6429E26\r
+ for <notmuch@notmuchmail.org>; Fri, 24 Jun 2011 16:26:59 -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 XIzE-ZhFdieX for <notmuch@notmuchmail.org>;\r
+ Fri, 24 Jun 2011 16:26:58 -0700 (PDT)\r
+Received: from mail-iw0-f181.google.com (mail-iw0-f181.google.com\r
+ [209.85.214.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 771CF429E25\r
+ for <notmuch@notmuchmail.org>; Fri, 24 Jun 2011 16:26:58 -0700 (PDT)\r
+Received: by iwn37 with SMTP id 37so3145830iwn.26\r
+ for <notmuch@notmuchmail.org>; Fri, 24 Jun 2011 16:26:57 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+ h=domainkey-signature:from:to:subject:user-agent:date:message-id\r
+ :mime-version:content-type;\r
+ bh=XleEkWu9mwomieay0zl8/4DmCvvK/oIWbMT9M5ZJo24=;\r
+ b=qf7WsuIyuvR+KxT9dvzC/q58QWnUtYHP/xHQQyUjDRDTvXraJXClPFBcZ+qUgQMOKh\r
+ IcQbpXoZybk8WydWv9u9kVFJ6cEvvEWOLOjjOxiCeSIG95hurRuY0x7IXerJi8DI5EDM\r
+ raRlu1cqFsUlrfEBdXulEmZeJYdUPA5PzOvDM=\r
+DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;\r
+ h=from:to:subject:user-agent:date:message-id:mime-version\r
+ :content-type;\r
+ b=mEfxWfYfGKvn6oeD5thspH+aySLoOQWVbvzzMKwFjZWdXb6oZ7dTfzOwL5s3EWZJJ4\r
+ Ku0RdEMOGz/XjGh/5qhWoVzs4ShEjyf9ayJQvXfHWUxpqaCTWpwDvprhQSRTpk7eJ6aC\r
+ kgcJ3w0ZbMBBReryLriKN4pcyIJmj2icNBgKk=\r
+Received: by 10.42.147.201 with SMTP id o9mr3959903icv.412.1308958017281;\r
+ Fri, 24 Jun 2011 16:26:57 -0700 (PDT)\r
+Received: from localhost ([74.205.145.146])\r
+ by mx.google.com with ESMTPS id y1sm3044316ica.4.2011.06.24.16.26.56\r
+ (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Fri, 24 Jun 2011 16:26:56 -0700 (PDT)\r
+From: Mark Anderson <ma.skies@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/2] search --output=files: Output all filenames for each\r
+ matching message\r
+User-Agent: Notmuch/0.5-283-gb744eac (http://notmuchmail.org) Emacs/23.2.1\r
+ (i686-pc-linux-gnu)\r
+Date: Fri, 24 Jun 2011 17:26:55 -0600\r
+Message-ID: <878vsqdd4w.fsf@gmail.com>\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, 24 Jun 2011 23:26:59 -0000\r
+\r
+\r
+Messages in the database can have multiple files associated with a\r
+single message-id, but until now only one filename for each message\r
+has been reported by "notmuch search --output=files"\r
+\r
+Signed-off-by: Mark Anderson <ma.skies@gmail.com>\r
+---\r
+\r
+Perhaps someone can offer a little help making the "separator" code\r
+tighter, but this works.\r
+\r
+ notmuch-search.c | 29 ++++++++++++++++++++++-------\r
+ 1 files changed, 22 insertions(+), 7 deletions(-)\r
+\r
+diff --git a/notmuch-search.c b/notmuch-search.c\r
+index 616fe68..faccaf7 100644\r
+--- a/notmuch-search.c\r
++++ b/notmuch-search.c\r
+@@ -275,6 +275,7 @@ do_search_messages (const search_format_t *format,\r
+ {\r
+ notmuch_message_t *message;\r
+ notmuch_messages_t *messages;\r
++ notmuch_filenames_t *filenames;\r
+ int first_message = 1;\r
+ \r
+ messages = notmuch_query_search_messages (query);\r
+@@ -289,19 +290,33 @@ do_search_messages (const search_format_t *format,\r
+ {\r
+ message = notmuch_messages_get (messages);\r
+ \r
+- if (! first_message)\r
+- fputs (format->item_sep, stdout);\r
+-\r
+ if (output == OUTPUT_FILES) {\r
+- format->item_id (message, "",\r
+- notmuch_message_get_filename (message));\r
++ filenames = notmuch_message_get_filenames (message);\r
++\r
++ for (;\r
++ notmuch_filenames_valid (filenames);\r
++ notmuch_filenames_move_to_next (filenames))\r
++ {\r
++ if (! first_message)\r
++ fputs (format->item_sep, stdout);\r
++\r
++ format->item_id (message, "",\r
++ notmuch_filenames_get (filenames));\r
++\r
++ first_message = 0;\r
++ }\r
++ \r
++ notmuch_filenames_destroy( filenames );\r
++\r
+ } else { /* output == OUTPUT_MESSAGES */\r
++ if (! first_message)\r
++ fputs (format->item_sep, stdout);\r
++\r
+ format->item_id (message, "id:",\r
+ notmuch_message_get_message_id (message));\r
++ first_message = 0;\r
+ }\r
+ \r
+- first_message = 0;\r
+-\r
+ notmuch_message_destroy (message);\r
+ }\r
+ \r
+-- \r
+1.7.4.1\r
+\r