v3 of message properties patches
[notmuch-archives.git] / 60 / 3e541284a22136c0cb5ae7028d36d6edda7178
1 Return-Path: <too@guru.guru-group.fi>\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 8A18C429E36\r
6         for <notmuch@notmuchmail.org>; Wed, 25 Jan 2012 07:21:26 -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\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         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 dh0vufp3OLVM for <notmuch@notmuchmail.org>;\r
16         Wed, 25 Jan 2012 07:21:25 -0800 (PST)\r
17 Received: from guru.guru-group.fi (guru-group.fi [87.108.86.66])\r
18         by olra.theworths.org (Postfix) with ESMTP id 79C7B431FBC\r
19         for <notmuch@notmuchmail.org>; Wed, 25 Jan 2012 07:21:25 -0800 (PST)\r
20 Received: by guru.guru-group.fi (Postfix, from userid 501)\r
21         id C3FCA68056; Wed, 25 Jan 2012 17:21:27 +0200 (EET)\r
22 From: Tomi Ollila <tomi.ollila@iki.fi>\r
23 To: <notmuch@notmuchmail.org>\r
24 Subject: [RFC PATCH] bikeshed uncrustify options\r
25 Date: Wed, 25 Jan 2012 17:21:26 +0200\r
26 Message-Id: <1327504886-8730-1-git-send-email-tomi.ollila@iki.fi>\r
27 X-Mailer: git-send-email 1.7.6.1\r
28 Cc: Tomi Ollila <tomi.ollila@iki.fi>\r
29 X-BeenThere: notmuch@notmuchmail.org\r
30 X-Mailman-Version: 2.1.13\r
31 Precedence: list\r
32 List-Id: "Use and development of the notmuch mail system."\r
33         <notmuch.notmuchmail.org>\r
34 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
35         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
36 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
37 List-Post: <mailto:notmuch@notmuchmail.org>\r
38 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
39 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
40         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
41 X-List-Received-Date: Wed, 25 Jan 2012 15:21:26 -0000\r
42 \r
43 Look or try. thoughts ?\r
44 \r
45 Questions:\r
46 \r
47 Is (generally) using *INDENT-(OFF|ON)*  ok ? \r
48         \r
49 Would it be ok to have\r
50 #define STRINGIFY(s) STRINGIFY_ (s)\r
51 \r
52 (now such expansion disabled by INDENT-OFF)\r
53 When used, it is still thought as function call,\r
54 and whitespace added.\r
55 \r
56 What about enum { } \n format_sel change below ?\r
57 \r
58 After applying this patch and running:\r
59 \r
60 $ uncrustify --replace -c devel/uncrustify.cfg *.[ch]\r
61 \r
62 one can discuss (at least):\r
63 \r
64 * should there be space after '!'\r
65 * should there be space after (cast)\r
66 \r
67 ---\r
68  devel/uncrustify.cfg |    3 ++-\r
69  notmuch-client.h     |    5 ++++-\r
70  notmuch-reply.c      |    2 ++\r
71  notmuch-search.c     |   13 +++++++++----\r
72  notmuch-show.c       |    8 ++++++++\r
73  notmuch-time.c       |    3 +++\r
74  6 files changed, 28 insertions(+), 6 deletions(-)\r
75 \r
76 diff --git a/devel/uncrustify.cfg b/devel/uncrustify.cfg\r
77 index d8075ba..a752fae 100644\r
78 --- a/devel/uncrustify.cfg\r
79 +++ b/devel/uncrustify.cfg\r
80 @@ -58,7 +58,8 @@ nl_after_struct = 0\r
81  # Extra types used in notmuch source.\r
82  # (add more on demand)\r
83  \r
84 -type GMimeObject mime_node_t\r
85 +type GMimeObject GMimeCryptoContext GMimeCipherContext\r
86 +type mime_node_t notmuch_message_t\r
87  \r
88  #\r
89  # inter-character spacing options\r
90 diff --git a/notmuch-client.h b/notmuch-client.h\r
91 index e0eb594..131e453 100644\r
92 --- a/notmuch-client.h\r
93 +++ b/notmuch-client.h\r
94 @@ -59,8 +59,10 @@\r
95  \r
96  #define unused(x) x __attribute__ ((unused))\r
97  \r
98 +/* *INDENT-OFF* */\r
99  #define STRINGIFY(s) STRINGIFY_(s)\r
100  #define STRINGIFY_(s) #s\r
101 +/* *INDENT-ON* */\r
102  \r
103  struct mime_node;\r
104  struct notmuch_show_params;\r
105 @@ -377,7 +379,8 @@ mime_node_t *\r
106  mime_node_child (mime_node_t *parent, int child);\r
107  \r
108  /* Return the nth child of node in a depth-first traversal.  If n is\r
109 - * 0, returns node itself.  Returns NULL if there is no such part. */\r
110 + * 0, returns node itself.  Returns NULL if there is no such part.\r
111 + */\r
112  mime_node_t *\r
113  mime_node_seek_dfs (mime_node_t *node, int n);\r
114  \r
115 diff --git a/notmuch-reply.c b/notmuch-reply.c\r
116 index f55b1d2..57742c4 100644\r
117 --- a/notmuch-reply.c\r
118 +++ b/notmuch-reply.c\r
119 @@ -31,6 +31,7 @@ static void\r
120  reply_part_content (GMimeObject *part);\r
121  \r
122  static const notmuch_show_format_t format_reply = {\r
123 +/* *INDENT-OFF* */\r
124      "", NULL,\r
125         "", NULL,\r
126             "", NULL, reply_headers_message_part, ">\n",\r
127 @@ -44,6 +45,7 @@ static const notmuch_show_format_t format_reply = {\r
128             "",\r
129         "", "",\r
130      ""\r
131 +/* *INDENT-ON* */\r
132  };\r
133  \r
134  static void\r
135 diff --git a/notmuch-search.c b/notmuch-search.c\r
136 index d504051..57ec603 100644\r
137 --- a/notmuch-search.c\r
138 +++ b/notmuch-search.c\r
139 @@ -65,6 +65,7 @@ format_thread_text (const void *ctx,\r
140                     const char *authors,\r
141                     const char *subject);\r
142  static const search_format_t format_text = {\r
143 +/* *INDENT-OFF* */\r
144      "",\r
145         "",\r
146             format_item_id_text,\r
147 @@ -75,6 +76,7 @@ static const search_format_t format_text = {\r
148         "",\r
149      "\n",\r
150      "",\r
151 +/* *INDENT-ON* */\r
152  };\r
153  \r
154  static void\r
155 @@ -91,6 +93,7 @@ format_thread_json (const void *ctx,\r
156                     const char *authors,\r
157                     const char *subject);\r
158  static const search_format_t format_json = {\r
159 +/* *INDENT-OFF* */\r
160      "[",\r
161         "{",\r
162             format_item_id_json,\r
163 @@ -101,6 +104,7 @@ static const search_format_t format_json = {\r
164         "}",\r
165      "]\n",\r
166      "]\n",\r
167 +/* *INDENT-ON* */\r
168  };\r
169  \r
170  static void\r
171 @@ -160,7 +164,7 @@ format_item_id_json (const void *ctx,\r
172      printf ("%s", json_quote_str (ctx_quote, item_id));\r
173  \r
174      talloc_free (ctx_quote);\r
175 -    \r
176 +\r
177  }\r
178  \r
179  static void\r
180 @@ -333,7 +337,7 @@ do_search_messages (const search_format_t *format,\r
181  \r
182                 first_message = 0;\r
183             }\r
184 -           \r
185 +\r
186             notmuch_filenames_destroy( filenames );\r
187  \r
188         } else { /* output == OUTPUT_MESSAGES */\r
189 @@ -427,8 +431,9 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
190      size_t search_exclude_tags_length;\r
191      unsigned int i;\r
192  \r
193 -    enum { NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT }\r
194 -       format_sel = NOTMUCH_FORMAT_TEXT;\r
195 +    enum { /* note: also emacs indents this wrongly if not like this. */\r
196 +       NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT\r
197 +    } format_sel = NOTMUCH_FORMAT_TEXT;\r
198  \r
199      notmuch_opt_desc_t options[] = {\r
200         { NOTMUCH_OPT_KEYWORD, &sort, "sort", 's',\r
201 diff --git a/notmuch-show.c b/notmuch-show.c\r
202 index dec799c..dfe37bc 100644\r
203 --- a/notmuch-show.c\r
204 +++ b/notmuch-show.c\r
205 @@ -42,6 +42,7 @@ static void\r
206  format_part_end_text (GMimeObject *part);\r
207  \r
208  static const notmuch_show_format_t format_text = {\r
209 +    /* *INDENT-OFF* */\r
210      "", NULL,\r
211         "\fmessage{ ", format_message_text,\r
212             "\fheader{\n", format_headers_text, format_headers_message_part_text, "\fheader}\n",\r
213 @@ -55,6 +56,7 @@ static const notmuch_show_format_t format_text = {\r
214             "\fbody}\n",\r
215         "\fmessage}\n", "",\r
216      ""\r
217 +    /* *INDENT-ON* */\r
218  };\r
219  \r
220  static void\r
221 @@ -89,6 +91,7 @@ static void\r
222  format_part_end_json (GMimeObject *part);\r
223  \r
224  static const notmuch_show_format_t format_json = {\r
225 +    /* *INDENT-OFF* */\r
226      "[", NULL,\r
227         "{", format_message_json,\r
228             "\"headers\": {", format_headers_json, format_headers_message_part_json, "}",\r
229 @@ -102,6 +105,7 @@ static const notmuch_show_format_t format_json = {\r
230             "]",\r
231         "}", ", ",\r
232      "]"\r
233 +    /* *INDENT-ON* */\r
234  };\r
235  \r
236  static void\r
237 @@ -110,6 +114,7 @@ format_message_mbox (const void *ctx,\r
238                      unused (int indent));\r
239  \r
240  static const notmuch_show_format_t format_mbox = {\r
241 +    /* *INDENT-OFF* */\r
242      "", NULL,\r
243          "", format_message_mbox,\r
244              "", NULL, NULL, "",\r
245 @@ -123,12 +128,14 @@ static const notmuch_show_format_t format_mbox = {\r
246              "",\r
247          "", "",\r
248      ""\r
249 +    /* *INDENT-ON* */\r
250  };\r
251  \r
252  static void\r
253  format_part_content_raw (GMimeObject *part);\r
254  \r
255  static const notmuch_show_format_t format_raw = {\r
256 +    /* *INDENT-OFF* */\r
257      "", NULL,\r
258         "", NULL,\r
259             "", NULL, format_headers_message_part_text, "\n",\r
260 @@ -142,6 +149,7 @@ static const notmuch_show_format_t format_raw = {\r
261              "",\r
262         "", "",\r
263      ""\r
264 +    /* *INDENT-ON* */\r
265  };\r
266  \r
267  static const char *\r
268 diff --git a/notmuch-time.c b/notmuch-time.c\r
269 index e250c3d..a223a99 100644\r
270 --- a/notmuch-time.c\r
271 +++ b/notmuch-time.c\r
272 @@ -38,9 +38,12 @@\r
273   * (if any) will be reclaimed.\r
274   *\r
275   */\r
276 +\r
277  #define MINUTE (60)\r
278 +/* *INDENT-OFF* -- smells like a bug in uncrustify (up to 0.59...) */\r
279  #define HOUR (60 * MINUTE)\r
280  #define DAY (24 * HOUR)\r
281 +/* *INDENT-ON* */\r
282  #define RELATIVE_DATE_MAX 20\r
283  const char *\r
284  notmuch_time_relative_date (const void *ctx, time_t then)\r
285 -- \r
286 1.7.8.2\r
287 \r