[PATCH] configure: add --without-api-docs option
[notmuch-archives.git] / c1 / 16af034aac3037157786971d19d934a4b536ab
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 57163431FAF\r
6         for <notmuch@notmuchmail.org>; Fri,  7 Dec 2012 14:21:12 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id VjEnDJeUL7qT for <notmuch@notmuchmail.org>;\r
16         Fri,  7 Dec 2012 14:21:11 -0800 (PST)\r
17 Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com\r
18         [209.85.217.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 713C9431FAE\r
21         for <notmuch@notmuchmail.org>; Fri,  7 Dec 2012 14:21:11 -0800 (PST)\r
22 Received: by mail-lb0-f181.google.com with SMTP id ge1so803644lbb.26\r
23         for <notmuch@notmuchmail.org>; Fri, 07 Dec 2012 14:21:09 -0800 (PST)\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
25         d=google.com; s=20120113;\r
26         h=from:to:cc:subject:in-reply-to:references:user-agent:date\r
27         :message-id:mime-version:content-type:x-gm-message-state;\r
28         bh=TmR61HfWCaUUGzHCyQax1XCknNQepPqVyDMufpCFIz0=;\r
29         b=k5IZcrMMCEJv83fcH96NChi4t1auzit3/HVJ7pHPVfUIyYdknSX1D0cgdC3k+B3qEC\r
30         FjFInKn8iMRbESXtjfQbjX+qsbL+A/ntZxy/NGtS7eMQmD2+iYtFzLVn8kUeA7cdsnlU\r
31         ja5StRX0JP/v9r8bbYVW+WgfeMs5fUH7/BTJv250hNb3oAmu6B/P96vpSEti0FwSfpxU\r
32         KPIRpRASBo2ddT7IhD9ItMd0t0R6DSzl1sHgjoSwFO1/qU/2LaOD+61HcR0sud4o31Ab\r
33         muAF/g6B2Uy9NVyPL9CQhuGV/363UrYGopEZDSUGgP11/ULKHIc41CCjfP9DihvtrKvR\r
34         zlMQ==\r
35 Received: by 10.112.11.68 with SMTP id o4mr3096487lbb.128.1354918869767;\r
36         Fri, 07 Dec 2012 14:21:09 -0800 (PST)\r
37 Received: from localhost (dsl-hkibrasgw4-fe51df00-27.dhcp.inet.fi.\r
38         [80.223.81.27])\r
39         by mx.google.com with ESMTPS id oj5sm5081024lab.8.2012.12.07.14.21.07\r
40         (version=SSLv3 cipher=OTHER); Fri, 07 Dec 2012 14:21:08 -0800 (PST)\r
41 From: Jani Nikula <jani@nikula.org>\r
42 To: david@tethera.net, notmuch@notmuchmail.org\r
43 Subject: Re: [Patch v3b 1/9] notmuch-dump: add --format=(batch-tag|sup)\r
44 In-Reply-To: <1354843607-17980-2-git-send-email-david@tethera.net>\r
45 References: <1354843607-17980-1-git-send-email-david@tethera.net>\r
46         <1354843607-17980-2-git-send-email-david@tethera.net>\r
47 User-Agent: Notmuch/0.14+138~g7041c56 (http://notmuchmail.org) Emacs/23.4.1\r
48         (i686-pc-linux-gnu)\r
49 Date: Sat, 08 Dec 2012 00:21:06 +0200\r
50 Message-ID: <8738zhzep9.fsf@nikula.org>\r
51 MIME-Version: 1.0\r
52 Content-Type: text/plain; charset=us-ascii\r
53 X-Gm-Message-State:\r
54  ALoCoQldKxD3TeDpGdMB77FlSXb7xnCq0ujcjIB3xYCPn+afTHp3ftyGUBKQ3gilR+jRW9btyd28\r
55 Cc: David Bremner <bremner@debian.org>\r
56 X-BeenThere: notmuch@notmuchmail.org\r
57 X-Mailman-Version: 2.1.13\r
58 Precedence: list\r
59 List-Id: "Use and development of the notmuch mail system."\r
60         <notmuch.notmuchmail.org>\r
61 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
62         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
63 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
64 List-Post: <mailto:notmuch@notmuchmail.org>\r
65 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
66 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
67         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
68 X-List-Received-Date: Fri, 07 Dec 2012 22:21:12 -0000\r
69 \r
70 \r
71 LGTM.\r
72 \r
73 On Fri, 07 Dec 2012, david@tethera.net wrote:\r
74 > From: David Bremner <bremner@debian.org>\r
75 >\r
76 > sup is the old format, and remains the default, at least until\r
77 > restore is converted to parse this format.\r
78 >\r
79 > Each line of the batch-tag format is modelled on the syntax of notmuch tag:\r
80 > - "notmuch tag" is omitted from the front of the line\r
81 > - The dump format only uses query strings of a single message-id.\r
82 > - Each space seperated tag/message-id is 'hex-encoded' to remove\r
83 >   trouble-making characters.\r
84 > - It is permitted (and will be useful) for there to be no tags before\r
85 >   the query.\r
86 >\r
87 > In particular this format won't have the same problem with e.g. spaces\r
88 > in message-ids or tags; they will be round-trip-able.\r
89 > ---\r
90 >  dump-restore-private.h |   13 +++++++++++++\r
91 >  notmuch-dump.c         |   48 ++++++++++++++++++++++++++++++++++++++++++------\r
92 >  2 files changed, 55 insertions(+), 6 deletions(-)\r
93 >  create mode 100644 dump-restore-private.h\r
94 >\r
95 > diff --git a/dump-restore-private.h b/dump-restore-private.h\r
96 > new file mode 100644\r
97 > index 0000000..896a004\r
98 > --- /dev/null\r
99 > +++ b/dump-restore-private.h\r
100 > @@ -0,0 +1,13 @@\r
101 > +#ifndef DUMP_RESTORE_PRIVATE_H\r
102 > +#define DUMP_RESTORE_PRIVATE_H\r
103 > +\r
104 > +#include "hex-escape.h"\r
105 > +#include "command-line-arguments.h"\r
106 > +\r
107 > +typedef enum dump_formats {\r
108 > +    DUMP_FORMAT_AUTO,\r
109 > +    DUMP_FORMAT_BATCH_TAG,\r
110 > +    DUMP_FORMAT_SUP\r
111 > +} dump_format_t;\r
112 > +\r
113 > +#endif\r
114 > diff --git a/notmuch-dump.c b/notmuch-dump.c\r
115 > index 88f598a..d2dad40 100644\r
116 > --- a/notmuch-dump.c\r
117 > +++ b/notmuch-dump.c\r
118 > @@ -19,6 +19,7 @@\r
119 >   */\r
120 >  \r
121 >  #include "notmuch-client.h"\r
122 > +#include "dump-restore-private.h"\r
123 >  \r
124 >  int\r
125 >  notmuch_dump_command (unused (void *ctx), int argc, char *argv[])\r
126 > @@ -43,7 +44,13 @@ notmuch_dump_command (unused (void *ctx), int argc, char *argv[])\r
127 >      char *output_file_name = NULL;\r
128 >      int opt_index;\r
129 >  \r
130 > +    int output_format = DUMP_FORMAT_SUP;\r
131 > +\r
132 >      notmuch_opt_desc_t options[] = {\r
133 > +     { NOTMUCH_OPT_KEYWORD, &output_format, "format", 'f',\r
134 > +       (notmuch_keyword_t []){ { "sup", DUMP_FORMAT_SUP },\r
135 > +                               { "batch-tag", DUMP_FORMAT_BATCH_TAG },\r
136 > +                               { 0, 0 } } },\r
137 >       { NOTMUCH_OPT_STRING, &output_file_name, "output", 'o', 0  },\r
138 >       { 0, 0, 0, 0, 0 }\r
139 >      };\r
140 > @@ -83,27 +90,56 @@ notmuch_dump_command (unused (void *ctx), int argc, char *argv[])\r
141 >       */\r
142 >      notmuch_query_set_sort (query, NOTMUCH_SORT_UNSORTED);\r
143 >  \r
144 > +    char *buffer = NULL;\r
145 > +    size_t buffer_size = 0;\r
146 > +\r
147 >      for (messages = notmuch_query_search_messages (query);\r
148 >        notmuch_messages_valid (messages);\r
149 >        notmuch_messages_move_to_next (messages)) {\r
150 >       int first = 1;\r
151 > +     const char *message_id;\r
152 > +\r
153 >       message = notmuch_messages_get (messages);\r
154 > +     message_id = notmuch_message_get_message_id (message);\r
155 >  \r
156 > -     fprintf (output,\r
157 > -              "%s (", notmuch_message_get_message_id (message));\r
158 > +     if (output_format == DUMP_FORMAT_SUP) {\r
159 > +         fprintf (output, "%s (", message_id);\r
160 > +     }\r
161 >  \r
162 >       for (tags = notmuch_message_get_tags (message);\r
163 >            notmuch_tags_valid (tags);\r
164 >            notmuch_tags_move_to_next (tags)) {\r
165 > -         if (! first)\r
166 > -             fprintf (output, " ");\r
167 > +         const char *tag_str = notmuch_tags_get (tags);\r
168 >  \r
169 > -         fprintf (output, "%s", notmuch_tags_get (tags));\r
170 > +         if (! first)\r
171 > +             fputs (" ", output);\r
172 >  \r
173 >           first = 0;\r
174 > +\r
175 > +         if (output_format == DUMP_FORMAT_SUP) {\r
176 > +             fputs (tag_str, output);\r
177 > +         } else {\r
178 > +             if (hex_encode (notmuch, tag_str,\r
179 > +                             &buffer, &buffer_size) != HEX_SUCCESS) {\r
180 > +                 fprintf (stderr, "Error: failed to hex-encode tag %s\n",\r
181 > +                          tag_str);\r
182 > +                 return 1;\r
183 > +             }\r
184 > +             fprintf (output, "+%s", buffer);\r
185 > +         }\r
186 >       }\r
187 >  \r
188 > -     fprintf (output, ")\n");\r
189 > +     if (output_format == DUMP_FORMAT_SUP) {\r
190 > +         fputs (")\n", output);\r
191 > +     } else {\r
192 > +         if (hex_encode (notmuch, message_id,\r
193 > +                         &buffer, &buffer_size) != HEX_SUCCESS) {\r
194 > +                 fprintf (stderr, "Error: failed to hex-encode msg-id %s\n",\r
195 > +                          message_id);\r
196 > +                 return 1;\r
197 > +         }\r
198 > +         fprintf (output, " -- id:%s\n", buffer);\r
199 > +     }\r
200 >  \r
201 >       notmuch_message_destroy (message);\r
202 >      }\r
203 > -- \r
204 > 1.7.10.4\r
205 >\r
206 > _______________________________________________\r
207 > notmuch mailing list\r
208 > notmuch@notmuchmail.org\r
209 > http://notmuchmail.org/mailman/listinfo/notmuch\r