--- /dev/null
+Return-Path: <m.walters@qmul.ac.uk>\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 13798431FAF\r
+ for <notmuch@notmuchmail.org>; Sun, 9 Jun 2013 13:23:01 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.098\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
+ tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+ NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 8jBMmSTZU7YR for <notmuch@notmuchmail.org>;\r
+ Sun, 9 Jun 2013 13:22:51 -0700 (PDT)\r
+Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\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 EED08431FAE\r
+ for <notmuch@notmuchmail.org>; Sun, 9 Jun 2013 13:22:50 -0700 (PDT)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+ by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1Ulm8S-00053s-TJ; Sun, 09 Jun 2013 21:22:47 +0100\r
+Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)\r
+ by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1Ulm8S-0005jS-IL; Sun, 09 Jun 2013 21:22:44 +0100\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v2 1/7] cli: add --duplicate=N option to notmuch search\r
+In-Reply-To:\r
+ <61ed86f221d65b4dba438cbc2b4c5b77a484a534.1370775663.git.jani@nikula.org>\r
+References: <cover.1370775663.git.jani@nikula.org>\r
+ <61ed86f221d65b4dba438cbc2b4c5b77a484a534.1370775663.git.jani@nikula.org>\r
+User-Agent: Notmuch/0.15.2+171~ge2f30a2 (http://notmuchmail.org) Emacs/23.4.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Sun, 09 Jun 2013 21:22:42 +0100\r
+Message-ID: <871u8b11bh.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Sender-Host-Address: 93.97.24.31\r
+X-QM-SPAM-Info: Sender has good ham record. :)\r
+X-QM-Body-MD5: 5887149924c26243538d1a921c1476d2 (of first 20000 bytes)\r
+X-SpamAssassin-Score: -0.0\r
+X-SpamAssassin-SpamBar: /\r
+X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
+ determine if it is\r
+ spam. We require at least 5.0 points to mark a message as spam.\r
+ This message scored -0.0 points.\r
+ Summary of the scoring: \r
+ * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
+ provider * (markwalters1009[at]gmail.com)\r
+ * -0.0 AWL AWL: From: address is in the auto white-list\r
+X-QM-Scan-Virus: ClamAV says the message is clean\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: Sun, 09 Jun 2013 20:23:01 -0000\r
+\r
+\r
+Overall I like this series and am happy to give it a +1 as is but have a\r
+few comments which might be worth considering.\r
+\r
+Is the order of filenames clear? eg is it the order that notmuch new met\r
+them? In particular is duplicate=1 the oldest and duplicate=N the\r
+newest? If so that might be worth mentioning in the manpage.\r
+\r
+On Sun, 09 Jun 2013, Jani Nikula <jani@nikula.org> wrote:\r
+> Effective with --output=files, output the Nth filename associated with\r
+> each message matching the query (N is 0-based). If N is equal to or\r
+> greater than the number of files associated with the message, don't\r
+> print anything.\r
+> ---\r
+> notmuch-search.c | 18 ++++++++++++------\r
+> 1 file changed, 12 insertions(+), 6 deletions(-)\r
+>\r
+> diff --git a/notmuch-search.c b/notmuch-search.c\r
+> index 4323201..196934b 100644\r
+> --- a/notmuch-search.c\r
+> +++ b/notmuch-search.c\r
+> @@ -177,7 +177,8 @@ do_search_messages (sprinter_t *format,\r
+> notmuch_query_t *query,\r
+> output_t output,\r
+> int offset,\r
+> - int limit)\r
+> + int limit,\r
+> + int dupe)\r
+> {\r
+> notmuch_message_t *message;\r
+> notmuch_messages_t *messages;\r
+> @@ -206,14 +207,17 @@ do_search_messages (sprinter_t *format,\r
+> message = notmuch_messages_get (messages);\r
+> \r
+> if (output == OUTPUT_FILES) {\r
+> + int j;\r
+> filenames = notmuch_message_get_filenames (message);\r
+> \r
+> - for (;\r
+> + for (j = 1;\r
+> notmuch_filenames_valid (filenames);\r
+> - notmuch_filenames_move_to_next (filenames))\r
+> + notmuch_filenames_move_to_next (filenames), j++)\r
+> {\r
+> - format->string (format, notmuch_filenames_get (filenames));\r
+> - format->separator (format);\r
+> + if (dupe < 0 || dupe == j) {\r
+> + format->string (format, notmuch_filenames_get (filenames));\r
+> + format->separator (format);\r
+\r
+Is it deliberate that dupe == 0 is not covered? If my newest oldest\r
+thing above is correct then maybe dupe == 0 could be the all option +N\r
+the Nth oldest and -N the Nth newest. This may be not-trivial enough\r
+it's not worth doing.\r
+\r
+> + }\r
+> }\r
+> \r
+> notmuch_filenames_destroy( filenames );\r
+> @@ -303,6 +307,7 @@ notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])\r
+> int offset = 0;\r
+> int limit = -1; /* unlimited */\r
+> int exclude = EXCLUDE_TRUE;\r
+> + int dupe = -1;\r
+> unsigned int i;\r
+> \r
+> enum {\r
+> @@ -339,6 +344,7 @@ notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])\r
+> { 0, 0 } } },\r
+> { NOTMUCH_OPT_INT, &offset, "offset", 'O', 0 },\r
+> { NOTMUCH_OPT_INT, &limit, "limit", 'L', 0 },\r
+> + { NOTMUCH_OPT_INT, &dupe, "duplicate", 'D', 0 },\r
+> { 0, 0, 0, 0, 0 }\r
+> };\r
+> \r
+> @@ -424,7 +430,7 @@ notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])\r
+> break;\r
+> case OUTPUT_MESSAGES:\r
+> case OUTPUT_FILES:\r
+> - ret = do_search_messages (format, query, output, offset, limit);\r
+> + ret = do_search_messages (format, query, output, offset, limit, dupe);\r
+\r
+Should there be an error message if duplicate=x is chosen with\r
+output!=files?\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\r
+> break;\r
+> case OUTPUT_TAGS:\r
+> ret = do_search_tags (notmuch, format, query);\r
+> -- \r
+> 1.7.10.4\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r