* [RFC PATCH] bikeshed uncrustify options @ 2012-01-25 15:21 Tomi Ollila 2012-01-25 15:48 ` Jani Nikula 2012-01-25 16:41 ` Jameson Graef Rollins 0 siblings, 2 replies; 6+ messages in thread From: Tomi Ollila @ 2012-01-25 15:21 UTC (permalink / raw) To: notmuch; +Cc: Tomi Ollila Look or try. thoughts ? Questions: Is (generally) using *INDENT-(OFF|ON)* ok ? Would it be ok to have #define STRINGIFY(s) STRINGIFY_ (s) (now such expansion disabled by INDENT-OFF) When used, it is still thought as function call, and whitespace added. What about enum { } \n format_sel change below ? After applying this patch and running: $ uncrustify --replace -c devel/uncrustify.cfg *.[ch] one can discuss (at least): * should there be space after '!' * should there be space after (cast) --- devel/uncrustify.cfg | 3 ++- notmuch-client.h | 5 ++++- notmuch-reply.c | 2 ++ notmuch-search.c | 13 +++++++++---- notmuch-show.c | 8 ++++++++ notmuch-time.c | 3 +++ 6 files changed, 28 insertions(+), 6 deletions(-) diff --git a/devel/uncrustify.cfg b/devel/uncrustify.cfg index d8075ba..a752fae 100644 --- a/devel/uncrustify.cfg +++ b/devel/uncrustify.cfg @@ -58,7 +58,8 @@ nl_after_struct = 0 # Extra types used in notmuch source. # (add more on demand) -type GMimeObject mime_node_t +type GMimeObject GMimeCryptoContext GMimeCipherContext +type mime_node_t notmuch_message_t # # inter-character spacing options diff --git a/notmuch-client.h b/notmuch-client.h index e0eb594..131e453 100644 --- a/notmuch-client.h +++ b/notmuch-client.h @@ -59,8 +59,10 @@ #define unused(x) x __attribute__ ((unused)) +/* *INDENT-OFF* */ #define STRINGIFY(s) STRINGIFY_(s) #define STRINGIFY_(s) #s +/* *INDENT-ON* */ struct mime_node; struct notmuch_show_params; @@ -377,7 +379,8 @@ mime_node_t * mime_node_child (mime_node_t *parent, int child); /* Return the nth child of node in a depth-first traversal. If n is - * 0, returns node itself. Returns NULL if there is no such part. */ + * 0, returns node itself. Returns NULL if there is no such part. + */ mime_node_t * mime_node_seek_dfs (mime_node_t *node, int n); diff --git a/notmuch-reply.c b/notmuch-reply.c index f55b1d2..57742c4 100644 --- a/notmuch-reply.c +++ b/notmuch-reply.c @@ -31,6 +31,7 @@ static void reply_part_content (GMimeObject *part); static const notmuch_show_format_t format_reply = { +/* *INDENT-OFF* */ "", NULL, "", NULL, "", NULL, reply_headers_message_part, ">\n", @@ -44,6 +45,7 @@ static const notmuch_show_format_t format_reply = { "", "", "", "" +/* *INDENT-ON* */ }; static void diff --git a/notmuch-search.c b/notmuch-search.c index d504051..57ec603 100644 --- a/notmuch-search.c +++ b/notmuch-search.c @@ -65,6 +65,7 @@ format_thread_text (const void *ctx, const char *authors, const char *subject); static const search_format_t format_text = { +/* *INDENT-OFF* */ "", "", format_item_id_text, @@ -75,6 +76,7 @@ static const search_format_t format_text = { "", "\n", "", +/* *INDENT-ON* */ }; static void @@ -91,6 +93,7 @@ format_thread_json (const void *ctx, const char *authors, const char *subject); static const search_format_t format_json = { +/* *INDENT-OFF* */ "[", "{", format_item_id_json, @@ -101,6 +104,7 @@ static const search_format_t format_json = { "}", "]\n", "]\n", +/* *INDENT-ON* */ }; static void @@ -160,7 +164,7 @@ format_item_id_json (const void *ctx, printf ("%s", json_quote_str (ctx_quote, item_id)); talloc_free (ctx_quote); - + } static void @@ -333,7 +337,7 @@ do_search_messages (const search_format_t *format, first_message = 0; } - + notmuch_filenames_destroy( filenames ); } else { /* output == OUTPUT_MESSAGES */ @@ -427,8 +431,9 @@ notmuch_search_command (void *ctx, int argc, char *argv[]) size_t search_exclude_tags_length; unsigned int i; - enum { NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT } - format_sel = NOTMUCH_FORMAT_TEXT; + enum { /* note: also emacs indents this wrongly if not like this. */ + NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT + } format_sel = NOTMUCH_FORMAT_TEXT; notmuch_opt_desc_t options[] = { { NOTMUCH_OPT_KEYWORD, &sort, "sort", 's', diff --git a/notmuch-show.c b/notmuch-show.c index dec799c..dfe37bc 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -42,6 +42,7 @@ static void format_part_end_text (GMimeObject *part); static const notmuch_show_format_t format_text = { + /* *INDENT-OFF* */ "", NULL, "\fmessage{ ", format_message_text, "\fheader{\n", format_headers_text, format_headers_message_part_text, "\fheader}\n", @@ -55,6 +56,7 @@ static const notmuch_show_format_t format_text = { "\fbody}\n", "\fmessage}\n", "", "" + /* *INDENT-ON* */ }; static void @@ -89,6 +91,7 @@ static void format_part_end_json (GMimeObject *part); static const notmuch_show_format_t format_json = { + /* *INDENT-OFF* */ "[", NULL, "{", format_message_json, "\"headers\": {", format_headers_json, format_headers_message_part_json, "}", @@ -102,6 +105,7 @@ static const notmuch_show_format_t format_json = { "]", "}", ", ", "]" + /* *INDENT-ON* */ }; static void @@ -110,6 +114,7 @@ format_message_mbox (const void *ctx, unused (int indent)); static const notmuch_show_format_t format_mbox = { + /* *INDENT-OFF* */ "", NULL, "", format_message_mbox, "", NULL, NULL, "", @@ -123,12 +128,14 @@ static const notmuch_show_format_t format_mbox = { "", "", "", "" + /* *INDENT-ON* */ }; static void format_part_content_raw (GMimeObject *part); static const notmuch_show_format_t format_raw = { + /* *INDENT-OFF* */ "", NULL, "", NULL, "", NULL, format_headers_message_part_text, "\n", @@ -142,6 +149,7 @@ static const notmuch_show_format_t format_raw = { "", "", "", "" + /* *INDENT-ON* */ }; static const char * diff --git a/notmuch-time.c b/notmuch-time.c index e250c3d..a223a99 100644 --- a/notmuch-time.c +++ b/notmuch-time.c @@ -38,9 +38,12 @@ * (if any) will be reclaimed. * */ + #define MINUTE (60) +/* *INDENT-OFF* -- smells like a bug in uncrustify (up to 0.59...) */ #define HOUR (60 * MINUTE) #define DAY (24 * HOUR) +/* *INDENT-ON* */ #define RELATIVE_DATE_MAX 20 const char * notmuch_time_relative_date (const void *ctx, time_t then) -- 1.7.8.2 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [RFC PATCH] bikeshed uncrustify options 2012-01-25 15:21 [RFC PATCH] bikeshed uncrustify options Tomi Ollila @ 2012-01-25 15:48 ` Jani Nikula 2012-01-25 16:41 ` Jameson Graef Rollins 1 sibling, 0 replies; 6+ messages in thread From: Jani Nikula @ 2012-01-25 15:48 UTC (permalink / raw) To: Tomi Ollila, notmuch; +Cc: Tomi Ollila Coding style bikeshedding, wonderful. :) On Wed, 25 Jan 2012 17:21:26 +0200, Tomi Ollila <tomi.ollila@iki.fi> wrote: > Is (generally) using *INDENT-(OFF|ON)* ok ? Obviously I wish we could do without. You should cook up a wrapper for uncrustify that takes a patch, applies it, and checks if it introduces new coding style issues, but ignores the existing ones. ;) > Would it be ok to have > #define STRINGIFY(s) STRINGIFY_ (s) Why not, it's the notmuch style? > (now such expansion disabled by INDENT-OFF) > When used, it is still thought as function call, > and whitespace added. > > What about enum { } \n format_sel change below ? See comment inline below. > After applying this patch and running: > > $ uncrustify --replace -c devel/uncrustify.cfg *.[ch] > > one can discuss (at least): > > * should there be space after '!' That's like having space in '- foo' or '~ foo', isn't it? I'd prefer no space after unary operators. > * should there be space after (cast) Yes, please. > > --- > devel/uncrustify.cfg | 3 ++- > notmuch-client.h | 5 ++++- > notmuch-reply.c | 2 ++ > notmuch-search.c | 13 +++++++++---- > notmuch-show.c | 8 ++++++++ > notmuch-time.c | 3 +++ > 6 files changed, 28 insertions(+), 6 deletions(-) > > diff --git a/devel/uncrustify.cfg b/devel/uncrustify.cfg > index d8075ba..a752fae 100644 > --- a/devel/uncrustify.cfg > +++ b/devel/uncrustify.cfg > @@ -58,7 +58,8 @@ nl_after_struct = 0 > # Extra types used in notmuch source. > # (add more on demand) > > -type GMimeObject mime_node_t > +type GMimeObject GMimeCryptoContext GMimeCipherContext > +type mime_node_t notmuch_message_t > > # > # inter-character spacing options > diff --git a/notmuch-client.h b/notmuch-client.h > index e0eb594..131e453 100644 > --- a/notmuch-client.h > +++ b/notmuch-client.h > @@ -59,8 +59,10 @@ > > #define unused(x) x __attribute__ ((unused)) > > +/* *INDENT-OFF* */ > #define STRINGIFY(s) STRINGIFY_(s) > #define STRINGIFY_(s) #s > +/* *INDENT-ON* */ > > struct mime_node; > struct notmuch_show_params; > @@ -377,7 +379,8 @@ mime_node_t * > mime_node_child (mime_node_t *parent, int child); > > /* Return the nth child of node in a depth-first traversal. If n is > - * 0, returns node itself. Returns NULL if there is no such part. */ > + * 0, returns node itself. Returns NULL if there is no such part. > + */ > mime_node_t * > mime_node_seek_dfs (mime_node_t *node, int n); > > diff --git a/notmuch-reply.c b/notmuch-reply.c > index f55b1d2..57742c4 100644 > --- a/notmuch-reply.c > +++ b/notmuch-reply.c > @@ -31,6 +31,7 @@ static void > reply_part_content (GMimeObject *part); > > static const notmuch_show_format_t format_reply = { > +/* *INDENT-OFF* */ What does it do here without the comment? > "", NULL, > "", NULL, > "", NULL, reply_headers_message_part, ">\n", > @@ -44,6 +45,7 @@ static const notmuch_show_format_t format_reply = { > "", > "", "", > "" > +/* *INDENT-ON* */ > }; > > static void > diff --git a/notmuch-search.c b/notmuch-search.c > index d504051..57ec603 100644 > --- a/notmuch-search.c > +++ b/notmuch-search.c > @@ -65,6 +65,7 @@ format_thread_text (const void *ctx, > const char *authors, > const char *subject); > static const search_format_t format_text = { > +/* *INDENT-OFF* */ > "", > "", > format_item_id_text, > @@ -75,6 +76,7 @@ static const search_format_t format_text = { > "", > "\n", > "", > +/* *INDENT-ON* */ > }; > > static void > @@ -91,6 +93,7 @@ format_thread_json (const void *ctx, > const char *authors, > const char *subject); > static const search_format_t format_json = { > +/* *INDENT-OFF* */ > "[", > "{", > format_item_id_json, > @@ -101,6 +104,7 @@ static const search_format_t format_json = { > "}", > "]\n", > "]\n", > +/* *INDENT-ON* */ > }; > > static void > @@ -160,7 +164,7 @@ format_item_id_json (const void *ctx, > printf ("%s", json_quote_str (ctx_quote, item_id)); > > talloc_free (ctx_quote); > - > + > } > > static void > @@ -333,7 +337,7 @@ do_search_messages (const search_format_t *format, > > first_message = 0; > } > - > + > notmuch_filenames_destroy( filenames ); > > } else { /* output == OUTPUT_MESSAGES */ > @@ -427,8 +431,9 @@ notmuch_search_command (void *ctx, int argc, char *argv[]) > size_t search_exclude_tags_length; > unsigned int i; > > - enum { NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT } > - format_sel = NOTMUCH_FORMAT_TEXT; > + enum { /* note: also emacs indents this wrongly if not like this. */ > + NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT > + } format_sel = NOTMUCH_FORMAT_TEXT; I prefer this style anyway. Compare with: struct { int foo; int bar; } baz; which I think would be frowned upon. > > notmuch_opt_desc_t options[] = { > { NOTMUCH_OPT_KEYWORD, &sort, "sort", 's', > diff --git a/notmuch-show.c b/notmuch-show.c > index dec799c..dfe37bc 100644 > --- a/notmuch-show.c > +++ b/notmuch-show.c > @@ -42,6 +42,7 @@ static void > format_part_end_text (GMimeObject *part); > > static const notmuch_show_format_t format_text = { > + /* *INDENT-OFF* */ > "", NULL, > "\fmessage{ ", format_message_text, > "\fheader{\n", format_headers_text, format_headers_message_part_text, "\fheader}\n", > @@ -55,6 +56,7 @@ static const notmuch_show_format_t format_text = { > "\fbody}\n", > "\fmessage}\n", "", > "" > + /* *INDENT-ON* */ > }; > > static void > @@ -89,6 +91,7 @@ static void > format_part_end_json (GMimeObject *part); > > static const notmuch_show_format_t format_json = { > + /* *INDENT-OFF* */ > "[", NULL, > "{", format_message_json, > "\"headers\": {", format_headers_json, format_headers_message_part_json, "}", > @@ -102,6 +105,7 @@ static const notmuch_show_format_t format_json = { > "]", > "}", ", ", > "]" > + /* *INDENT-ON* */ > }; > > static void > @@ -110,6 +114,7 @@ format_message_mbox (const void *ctx, > unused (int indent)); > > static const notmuch_show_format_t format_mbox = { > + /* *INDENT-OFF* */ > "", NULL, > "", format_message_mbox, > "", NULL, NULL, "", > @@ -123,12 +128,14 @@ static const notmuch_show_format_t format_mbox = { > "", > "", "", > "" > + /* *INDENT-ON* */ > }; > > static void > format_part_content_raw (GMimeObject *part); > > static const notmuch_show_format_t format_raw = { > + /* *INDENT-OFF* */ > "", NULL, > "", NULL, > "", NULL, format_headers_message_part_text, "\n", > @@ -142,6 +149,7 @@ static const notmuch_show_format_t format_raw = { > "", > "", "", > "" > + /* *INDENT-ON* */ > }; > > static const char * > diff --git a/notmuch-time.c b/notmuch-time.c > index e250c3d..a223a99 100644 > --- a/notmuch-time.c > +++ b/notmuch-time.c > @@ -38,9 +38,12 @@ > * (if any) will be reclaimed. > * > */ > + > #define MINUTE (60) > +/* *INDENT-OFF* -- smells like a bug in uncrustify (up to 0.59...) */ > #define HOUR (60 * MINUTE) > #define DAY (24 * HOUR) > +/* *INDENT-ON* */ > #define RELATIVE_DATE_MAX 20 > const char * > notmuch_time_relative_date (const void *ctx, time_t then) > -- > 1.7.8.2 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC PATCH] bikeshed uncrustify options 2012-01-25 15:21 [RFC PATCH] bikeshed uncrustify options Tomi Ollila 2012-01-25 15:48 ` Jani Nikula @ 2012-01-25 16:41 ` Jameson Graef Rollins 2012-01-25 18:24 ` Tomi Ollila 1 sibling, 1 reply; 6+ messages in thread From: Jameson Graef Rollins @ 2012-01-25 16:41 UTC (permalink / raw) To: Tomi Ollila, notmuch [-- Attachment #1: Type: text/plain, Size: 355 bytes --] On Wed, 25 Jan 2012 17:21:26 +0200, Tomi Ollila <tomi.ollila@iki.fi> wrote: > -type GMimeObject mime_node_t > +type GMimeObject GMimeCryptoContext GMimeCipherContext > +type mime_node_t notmuch_message_t This must be a mistake. Presumably this hasn't been properly rebased against the latest master, which includes Austin's part 2 show rewrite. jamie. [-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC PATCH] bikeshed uncrustify options 2012-01-25 16:41 ` Jameson Graef Rollins @ 2012-01-25 18:24 ` Tomi Ollila 2012-01-25 18:29 ` Jameson Graef Rollins 0 siblings, 1 reply; 6+ messages in thread From: Tomi Ollila @ 2012-01-25 18:24 UTC (permalink / raw) To: Jameson Graef Rollins, notmuch On Wed, 25 Jan 2012 08:41:52 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote: > On Wed, 25 Jan 2012 17:21:26 +0200, Tomi Ollila <tomi.ollila@iki.fi> wrote: > > -type GMimeObject mime_node_t > > +type GMimeObject GMimeCryptoContext GMimeCipherContext > > +type mime_node_t notmuch_message_t > > This must be a mistake. Presumably this hasn't been properly rebased > against the latest master, which includes Austin's part 2 show rewrite. $ git reset --hard origin/master $ git describe debian/0.11-1-116-ge6e10b8 $ git am foo.am Applying: bikeshed uncrustify options $ > jamie. Tomi ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC PATCH] bikeshed uncrustify options 2012-01-25 18:24 ` Tomi Ollila @ 2012-01-25 18:29 ` Jameson Graef Rollins 2012-01-25 18:31 ` Jameson Graef Rollins 0 siblings, 1 reply; 6+ messages in thread From: Jameson Graef Rollins @ 2012-01-25 18:29 UTC (permalink / raw) To: Tomi Ollila, notmuch [-- Attachment #1: Type: text/plain, Size: 785 bytes --] On Wed, 25 Jan 2012 20:24:19 +0200, Tomi Ollila <tomi.ollila@iki.fi> wrote: > On Wed, 25 Jan 2012 08:41:52 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote: > > On Wed, 25 Jan 2012 17:21:26 +0200, Tomi Ollila <tomi.ollila@iki.fi> wrote: > > > -type GMimeObject mime_node_t > > > +type GMimeObject GMimeCryptoContext GMimeCipherContext > > > +type mime_node_t notmuch_message_t > > > > This must be a mistake. Presumably this hasn't been properly rebased > > against the latest master, which includes Austin's part 2 show rewrite. > > $ git reset --hard origin/master > $ git describe > debian/0.11-1-116-ge6e10b8 > $ git am foo.am > Applying: bikeshed uncrustify options > $ Ok, but obviously this patch should not be making this change. jamie. [-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC PATCH] bikeshed uncrustify options 2012-01-25 18:29 ` Jameson Graef Rollins @ 2012-01-25 18:31 ` Jameson Graef Rollins 0 siblings, 0 replies; 6+ messages in thread From: Jameson Graef Rollins @ 2012-01-25 18:31 UTC (permalink / raw) To: Tomi Ollila, notmuch [-- Attachment #1: Type: text/plain, Size: 1058 bytes --] On Wed, 25 Jan 2012 10:29:30 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote: > On Wed, 25 Jan 2012 20:24:19 +0200, Tomi Ollila <tomi.ollila@iki.fi> wrote: > > On Wed, 25 Jan 2012 08:41:52 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote: > > > On Wed, 25 Jan 2012 17:21:26 +0200, Tomi Ollila <tomi.ollila@iki.fi> wrote: > > > > -type GMimeObject mime_node_t > > > > +type GMimeObject GMimeCryptoContext GMimeCipherContext > > > > +type mime_node_t notmuch_message_t > > > > > > This must be a mistake. Presumably this hasn't been properly rebased > > > against the latest master, which includes Austin's part 2 show rewrite. > > > > $ git reset --hard origin/master > > $ git describe > > debian/0.11-1-116-ge6e10b8 > > $ git am foo.am > > Applying: bikeshed uncrustify options > > $ > > Ok, but obviously this patch should not be making this change. hrm, actually I just noticing the file that this diff applies to. Maybe that's what you want? I don't understand this uncrustify stuff. jamie. [-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-01-25 18:31 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-01-25 15:21 [RFC PATCH] bikeshed uncrustify options Tomi Ollila 2012-01-25 15:48 ` Jani Nikula 2012-01-25 16:41 ` Jameson Graef Rollins 2012-01-25 18:24 ` Tomi Ollila 2012-01-25 18:29 ` Jameson Graef Rollins 2012-01-25 18:31 ` Jameson Graef Rollins
Code repositories for project(s) associated with this public inbox https://yhetil.org/notmuch.git/ This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).