Re: [PATCH] NEWS: initial NEWS for 0.22.1
[notmuch-archives.git] / 98 / a07ef3151e564d1ba51bf95cd8cc626df5a88f
1 Return-Path: <jani@nikula.org>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 24C56431FCB\r
6         for <notmuch@notmuchmail.org>; Mon, 13 May 2013 11:27:15 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
9 X-Spam-Flag: NO\r
10 X-Spam-Score: -0.7\r
11 X-Spam-Level: \r
12 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
13         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id 66yGVp3Q2ZQ3 for <notmuch@notmuchmail.org>;\r
17         Mon, 13 May 2013 11:27:08 -0700 (PDT)\r
18 Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com\r
19         [209.85.217.172]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 55B6B431FB6\r
22         for <notmuch@notmuchmail.org>; Mon, 13 May 2013 11:27:08 -0700 (PDT)\r
23 Received: by mail-lb0-f172.google.com with SMTP id y6so6753519lbh.17\r
24         for <notmuch@notmuchmail.org>; Mon, 13 May 2013 11:27:07 -0700 (PDT)\r
25 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
26         d=google.com; s=20120113;\r
27         h=x-received:from:to:subject:date:message-id:x-mailer:in-reply-to\r
28         :references:in-reply-to:references:x-gm-message-state;\r
29         bh=L9oiFgYVSiNm4FJrD523wA+nQgGpV1nAEupggcD1yTE=;\r
30         b=RTkyUBNfZt8PeU+cZ27YuHEcTZ2rcNC6ZFydkcniu0Hzr70OmCcTI3qwM+FQ2ERa7f\r
31         s0zygtNUC1nXWc7Smdj/ts7OyD3zFj/hoPEMyqRsHvO1Z1trld1XaTiTQmPiCg1z4SIA\r
32         SNXi+XmebADb6LoUsXNG4/8iCIEyJtgIxBv5RyOBMsXH64G4e0YqPkCiRg2GncQ65AV/\r
33         Y+Cs3YinC3OPfZSTT4XPTLFaCWeBGVup2Thv+7SMAsxh0gGDKDfzuxO1UJ/kCZWHCkZu\r
34         4V0ZHh9AYYwW8WqidmYGHlHP3XyCIwHT73ezghcuy1sXcZpLorGH1oXXBWsQN74+BOLr\r
35         zE2A==\r
36 X-Received: by 10.112.151.3 with SMTP id um3mr13527711lbb.102.1368469626920;\r
37         Mon, 13 May 2013 11:27:06 -0700 (PDT)\r
38 Received: from localhost (dsl-hkibrasgw2-58c376-211.dhcp.inet.fi.\r
39         [88.195.118.211])\r
40         by mx.google.com with ESMTPSA id y3sm5913558lby.12.2013.05.13.11.27.05\r
41         for <notmuch@notmuchmail.org>\r
42         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
43         Mon, 13 May 2013 11:27:06 -0700 (PDT)\r
44 From: Jani Nikula <jani@nikula.org>\r
45 To: notmuch@notmuchmail.org\r
46 Subject: [PATCH 1/6] cli: add --duplicate=N option to notmuch search\r
47 Date: Mon, 13 May 2013 21:26:56 +0300\r
48 Message-Id:\r
49  <8f40230af59a6d13eaf986cb0793202a8686c097.1368467532.git.jani@nikula.org>\r
50 X-Mailer: git-send-email 1.7.10.4\r
51 In-Reply-To: <cover.1368467532.git.jani@nikula.org>\r
52 References: <cover.1368467532.git.jani@nikula.org>\r
53 In-Reply-To: <cover.1368467532.git.jani@nikula.org>\r
54 References: <cover.1368467532.git.jani@nikula.org>\r
55 X-Gm-Message-State:\r
56  ALoCoQlguMF6jpHLB1lbmx9MytrI8q5B2dERITw37bM8/oXFmEm4POaKLj9fq6il7yold4apLrzU\r
57 X-BeenThere: notmuch@notmuchmail.org\r
58 X-Mailman-Version: 2.1.13\r
59 Precedence: list\r
60 List-Id: "Use and development of the notmuch mail system."\r
61         <notmuch.notmuchmail.org>\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
63         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
65 List-Post: <mailto:notmuch@notmuchmail.org>\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
68         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
69 X-List-Received-Date: Mon, 13 May 2013 18:27:15 -0000\r
70 \r
71 Effective with --output=files, output the Nth filename associated with\r
72 each message matching the query (N is 0-based). If N is equal to or\r
73 greater than the number of files associated with the message, don't\r
74 print anything.\r
75 ---\r
76  notmuch-search.c |   18 ++++++++++++------\r
77  1 file changed, 12 insertions(+), 6 deletions(-)\r
78 \r
79 diff --git a/notmuch-search.c b/notmuch-search.c\r
80 index e658639..b113883 100644\r
81 --- a/notmuch-search.c\r
82 +++ b/notmuch-search.c\r
83 @@ -177,7 +177,8 @@ do_search_messages (sprinter_t *format,\r
84                     notmuch_query_t *query,\r
85                     output_t output,\r
86                     int offset,\r
87 -                   int limit)\r
88 +                   int limit,\r
89 +                   int dupe)\r
90  {\r
91      notmuch_message_t *message;\r
92      notmuch_messages_t *messages;\r
93 @@ -206,14 +207,17 @@ do_search_messages (sprinter_t *format,\r
94         message = notmuch_messages_get (messages);\r
95  \r
96         if (output == OUTPUT_FILES) {\r
97 +           int j;\r
98             filenames = notmuch_message_get_filenames (message);\r
99  \r
100 -           for (;\r
101 +           for (j = 0;\r
102                  notmuch_filenames_valid (filenames);\r
103 -                notmuch_filenames_move_to_next (filenames))\r
104 +                notmuch_filenames_move_to_next (filenames), j++)\r
105             {\r
106 -               format->string (format, notmuch_filenames_get (filenames));\r
107 -               format->separator (format);\r
108 +               if (dupe < 0 || dupe == j) {\r
109 +                   format->string (format, notmuch_filenames_get (filenames));\r
110 +                   format->separator (format);\r
111 +               }\r
112             }\r
113             \r
114             notmuch_filenames_destroy( filenames );\r
115 @@ -302,6 +306,7 @@ notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])\r
116      int offset = 0;\r
117      int limit = -1; /* unlimited */\r
118      int exclude = EXCLUDE_TRUE;\r
119 +    int dupe = -1;\r
120      unsigned int i;\r
121  \r
122      enum {\r
123 @@ -337,6 +342,7 @@ notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])\r
124                                    { 0, 0 } } },\r
125         { NOTMUCH_OPT_INT, &offset, "offset", 'O', 0 },\r
126         { NOTMUCH_OPT_INT, &limit, "limit", 'L', 0  },\r
127 +       { NOTMUCH_OPT_INT, &dupe, "duplicate", 'D', 0  },\r
128         { 0, 0, 0, 0, 0 }\r
129      };\r
130  \r
131 @@ -420,7 +426,7 @@ notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])\r
132         break;\r
133      case OUTPUT_MESSAGES:\r
134      case OUTPUT_FILES:\r
135 -       ret = do_search_messages (format, query, output, offset, limit);\r
136 +       ret = do_search_messages (format, query, output, offset, limit, dupe);\r
137         break;\r
138      case OUTPUT_TAGS:\r
139         ret = do_search_tags (notmuch, format, query);\r
140 -- \r
141 1.7.10.4\r
142 \r