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 B089D429E36
\r
6 for <notmuch@notmuchmail.org>; Wed, 25 Jan 2012 07:48:09 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 TPXGcwaIso-G for <notmuch@notmuchmail.org>;
\r
16 Wed, 25 Jan 2012 07:48:08 -0800 (PST)
\r
17 Received: from mail-qy0-f181.google.com (mail-qy0-f181.google.com
\r
18 [209.85.216.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 B88DF431FBC
\r
21 for <notmuch@notmuchmail.org>; Wed, 25 Jan 2012 07:48:08 -0800 (PST)
\r
22 Received: by qcpx40 with SMTP id x40so3367323qcp.26
\r
23 for <notmuch@notmuchmail.org>; Wed, 25 Jan 2012 07:48:08 -0800 (PST)
\r
24 Received: by 10.224.42.10 with SMTP id q10mr44548qae.26.1327506488064;
\r
25 Wed, 25 Jan 2012 07:48:08 -0800 (PST)
\r
26 Received: from localhost (nikula.org. [92.243.24.172])
\r
27 by mx.google.com with ESMTPS id de9sm2594899qab.9.2012.01.25.07.48.05
\r
28 (version=SSLv3 cipher=OTHER); Wed, 25 Jan 2012 07:48:06 -0800 (PST)
\r
29 From: Jani Nikula <jani@nikula.org>
\r
30 To: Tomi Ollila <tomi.ollila@iki.fi>, notmuch@notmuchmail.org
\r
31 Subject: Re: [RFC PATCH] bikeshed uncrustify options
\r
32 In-Reply-To: <1327504886-8730-1-git-send-email-tomi.ollila@iki.fi>
\r
33 References: <1327504886-8730-1-git-send-email-tomi.ollila@iki.fi>
\r
34 User-Agent: Notmuch/0.10.2+187~g43d4f26 (http://notmuchmail.org) Emacs/23.1.1
\r
36 Date: Wed, 25 Jan 2012 15:48:03 +0000
\r
37 Message-ID: <87mx9b6ax8.fsf@nikula.org>
\r
40 ALoCoQlheOU+uLcHSeG2NgvKMiZUYSB4naQur7fYrP3WERwYIVvaDDWuRojSmpseecKYIe6kq5bf
\r
41 Content-Type: text/plain; charset=us-ascii
\r
42 Cc: Tomi Ollila <tomi.ollila@iki.fi>
\r
43 X-BeenThere: notmuch@notmuchmail.org
\r
44 X-Mailman-Version: 2.1.13
\r
46 List-Id: "Use and development of the notmuch mail system."
\r
47 <notmuch.notmuchmail.org>
\r
48 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
49 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
50 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
51 List-Post: <mailto:notmuch@notmuchmail.org>
\r
52 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
53 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
54 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
55 X-List-Received-Date: Wed, 25 Jan 2012 15:48:09 -0000
\r
58 Coding style bikeshedding, wonderful. :)
\r
60 On Wed, 25 Jan 2012 17:21:26 +0200, Tomi Ollila <tomi.ollila@iki.fi> wrote:
\r
61 > Is (generally) using *INDENT-(OFF|ON)* ok ?
\r
63 Obviously I wish we could do without.
\r
65 You should cook up a wrapper for uncrustify that takes a patch, applies
\r
66 it, and checks if it introduces new coding style issues, but ignores the
\r
69 > Would it be ok to have
\r
70 > #define STRINGIFY(s) STRINGIFY_ (s)
\r
72 Why not, it's the notmuch style?
\r
74 > (now such expansion disabled by INDENT-OFF)
\r
75 > When used, it is still thought as function call,
\r
76 > and whitespace added.
\r
78 > What about enum { } \n format_sel change below ?
\r
80 See comment inline below.
\r
82 > After applying this patch and running:
\r
84 > $ uncrustify --replace -c devel/uncrustify.cfg *.[ch]
\r
86 > one can discuss (at least):
\r
88 > * should there be space after '!'
\r
90 That's like having space in '- foo' or '~ foo', isn't it? I'd prefer no
\r
91 space after unary operators.
\r
93 > * should there be space after (cast)
\r
99 > devel/uncrustify.cfg | 3 ++-
\r
100 > notmuch-client.h | 5 ++++-
\r
101 > notmuch-reply.c | 2 ++
\r
102 > notmuch-search.c | 13 +++++++++----
\r
103 > notmuch-show.c | 8 ++++++++
\r
104 > notmuch-time.c | 3 +++
\r
105 > 6 files changed, 28 insertions(+), 6 deletions(-)
\r
107 > diff --git a/devel/uncrustify.cfg b/devel/uncrustify.cfg
\r
108 > index d8075ba..a752fae 100644
\r
109 > --- a/devel/uncrustify.cfg
\r
110 > +++ b/devel/uncrustify.cfg
\r
111 > @@ -58,7 +58,8 @@ nl_after_struct = 0
\r
112 > # Extra types used in notmuch source.
\r
113 > # (add more on demand)
\r
115 > -type GMimeObject mime_node_t
\r
116 > +type GMimeObject GMimeCryptoContext GMimeCipherContext
\r
117 > +type mime_node_t notmuch_message_t
\r
120 > # inter-character spacing options
\r
121 > diff --git a/notmuch-client.h b/notmuch-client.h
\r
122 > index e0eb594..131e453 100644
\r
123 > --- a/notmuch-client.h
\r
124 > +++ b/notmuch-client.h
\r
125 > @@ -59,8 +59,10 @@
\r
127 > #define unused(x) x __attribute__ ((unused))
\r
129 > +/* *INDENT-OFF* */
\r
130 > #define STRINGIFY(s) STRINGIFY_(s)
\r
131 > #define STRINGIFY_(s) #s
\r
132 > +/* *INDENT-ON* */
\r
134 > struct mime_node;
\r
135 > struct notmuch_show_params;
\r
136 > @@ -377,7 +379,8 @@ mime_node_t *
\r
137 > mime_node_child (mime_node_t *parent, int child);
\r
139 > /* Return the nth child of node in a depth-first traversal. If n is
\r
140 > - * 0, returns node itself. Returns NULL if there is no such part. */
\r
141 > + * 0, returns node itself. Returns NULL if there is no such part.
\r
144 > mime_node_seek_dfs (mime_node_t *node, int n);
\r
146 > diff --git a/notmuch-reply.c b/notmuch-reply.c
\r
147 > index f55b1d2..57742c4 100644
\r
148 > --- a/notmuch-reply.c
\r
149 > +++ b/notmuch-reply.c
\r
150 > @@ -31,6 +31,7 @@ static void
\r
151 > reply_part_content (GMimeObject *part);
\r
153 > static const notmuch_show_format_t format_reply = {
\r
154 > +/* *INDENT-OFF* */
\r
156 What does it do here without the comment?
\r
160 > "", NULL, reply_headers_message_part, ">\n",
\r
161 > @@ -44,6 +45,7 @@ static const notmuch_show_format_t format_reply = {
\r
165 > +/* *INDENT-ON* */
\r
169 > diff --git a/notmuch-search.c b/notmuch-search.c
\r
170 > index d504051..57ec603 100644
\r
171 > --- a/notmuch-search.c
\r
172 > +++ b/notmuch-search.c
\r
173 > @@ -65,6 +65,7 @@ format_thread_text (const void *ctx,
\r
174 > const char *authors,
\r
175 > const char *subject);
\r
176 > static const search_format_t format_text = {
\r
177 > +/* *INDENT-OFF* */
\r
180 > format_item_id_text,
\r
181 > @@ -75,6 +76,7 @@ static const search_format_t format_text = {
\r
185 > +/* *INDENT-ON* */
\r
189 > @@ -91,6 +93,7 @@ format_thread_json (const void *ctx,
\r
190 > const char *authors,
\r
191 > const char *subject);
\r
192 > static const search_format_t format_json = {
\r
193 > +/* *INDENT-OFF* */
\r
196 > format_item_id_json,
\r
197 > @@ -101,6 +104,7 @@ static const search_format_t format_json = {
\r
201 > +/* *INDENT-ON* */
\r
205 > @@ -160,7 +164,7 @@ format_item_id_json (const void *ctx,
\r
206 > printf ("%s", json_quote_str (ctx_quote, item_id));
\r
208 > talloc_free (ctx_quote);
\r
214 > @@ -333,7 +337,7 @@ do_search_messages (const search_format_t *format,
\r
216 > first_message = 0;
\r
220 > notmuch_filenames_destroy( filenames );
\r
222 > } else { /* output == OUTPUT_MESSAGES */
\r
223 > @@ -427,8 +431,9 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
\r
224 > size_t search_exclude_tags_length;
\r
227 > - enum { NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT }
\r
228 > - format_sel = NOTMUCH_FORMAT_TEXT;
\r
229 > + enum { /* note: also emacs indents this wrongly if not like this. */
\r
230 > + NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT
\r
231 > + } format_sel = NOTMUCH_FORMAT_TEXT;
\r
233 I prefer this style anyway. Compare with:
\r
235 struct { int foo; int bar; } baz;
\r
237 which I think would be frowned upon.
\r
240 > notmuch_opt_desc_t options[] = {
\r
241 > { NOTMUCH_OPT_KEYWORD, &sort, "sort", 's',
\r
242 > diff --git a/notmuch-show.c b/notmuch-show.c
\r
243 > index dec799c..dfe37bc 100644
\r
244 > --- a/notmuch-show.c
\r
245 > +++ b/notmuch-show.c
\r
246 > @@ -42,6 +42,7 @@ static void
\r
247 > format_part_end_text (GMimeObject *part);
\r
249 > static const notmuch_show_format_t format_text = {
\r
250 > + /* *INDENT-OFF* */
\r
252 > "\fmessage{ ", format_message_text,
\r
253 > "\fheader{\n", format_headers_text, format_headers_message_part_text, "\fheader}\n",
\r
254 > @@ -55,6 +56,7 @@ static const notmuch_show_format_t format_text = {
\r
256 > "\fmessage}\n", "",
\r
258 > + /* *INDENT-ON* */
\r
262 > @@ -89,6 +91,7 @@ static void
\r
263 > format_part_end_json (GMimeObject *part);
\r
265 > static const notmuch_show_format_t format_json = {
\r
266 > + /* *INDENT-OFF* */
\r
268 > "{", format_message_json,
\r
269 > "\"headers\": {", format_headers_json, format_headers_message_part_json, "}",
\r
270 > @@ -102,6 +105,7 @@ static const notmuch_show_format_t format_json = {
\r
274 > + /* *INDENT-ON* */
\r
278 > @@ -110,6 +114,7 @@ format_message_mbox (const void *ctx,
\r
279 > unused (int indent));
\r
281 > static const notmuch_show_format_t format_mbox = {
\r
282 > + /* *INDENT-OFF* */
\r
284 > "", format_message_mbox,
\r
285 > "", NULL, NULL, "",
\r
286 > @@ -123,12 +128,14 @@ static const notmuch_show_format_t format_mbox = {
\r
290 > + /* *INDENT-ON* */
\r
294 > format_part_content_raw (GMimeObject *part);
\r
296 > static const notmuch_show_format_t format_raw = {
\r
297 > + /* *INDENT-OFF* */
\r
300 > "", NULL, format_headers_message_part_text, "\n",
\r
301 > @@ -142,6 +149,7 @@ static const notmuch_show_format_t format_raw = {
\r
305 > + /* *INDENT-ON* */
\r
308 > static const char *
\r
309 > diff --git a/notmuch-time.c b/notmuch-time.c
\r
310 > index e250c3d..a223a99 100644
\r
311 > --- a/notmuch-time.c
\r
312 > +++ b/notmuch-time.c
\r
313 > @@ -38,9 +38,12 @@
\r
314 > * (if any) will be reclaimed.
\r
318 > #define MINUTE (60)
\r
319 > +/* *INDENT-OFF* -- smells like a bug in uncrustify (up to 0.59...) */
\r
320 > #define HOUR (60 * MINUTE)
\r
321 > #define DAY (24 * HOUR)
\r
322 > +/* *INDENT-ON* */
\r
323 > #define RELATIVE_DATE_MAX 20
\r
325 > notmuch_time_relative_date (const void *ctx, time_t then)
\r
329 > _______________________________________________
\r
330 > notmuch mailing list
\r
331 > notmuch@notmuchmail.org
\r
332 > http://notmuchmail.org/mailman/listinfo/notmuch
\r