Subject: Re: bug#6318: reindenting with uncrustify, maybe...

From: Paul Eggert <[email-masked]>
Date: Thu, 03 Jun 2010 16:42:55 -0700

On 06/02/2010 01:28 PM, Jim Meyering wrote:

> Maybe a bug.  Or maybe there's an option to force a newline after
> a case statement's ":", and we just need to find it and turn it on.

Hmm, I'm not sure I want uncrustify to be that aggressive about
reformatting.  In general, come to think of it, many of the things
I'm leery about in uncrustify come about when it inserts newlines.
Perhaps it should have an option to shut that off?

>> This is insisting on the style where preprocessor directives are
>> indented independently of the non-preprocessor directives.  But it's
>> sometimes (as here) nice to use consistent indenting, for both
>> directives and non-directives.
> 
> Would be nice, but how do we (not to mention the tool) know when it's desired?

How about if we assume that it's always desired?  That is a conservative
assumption, and should work reasonably well in practice.

> I hope we can arrange something.
> uncrustify's code seems readable and maintainable enough that
> if something needs to be changed and we're motivated enough,
> we can do it ourselves.

Yes, that's a big advantage.  It would be nice if this would
end up working out.

> I wouldn't want to use two spaces all the time,
> perhaps only when there are "," expressions in first and/or third term.

Could we have it use two spaces if there are already two spaces,
and use one space if there aren't?  Again, take the conservative
approach.

> I've just added this to my ~/.uncrustify.cfg, and it appears to do
> part of what you want by leaving one space between the adjacent semicolons.
> 
> sp_before_semi_for_empty = add

Thanks.  How should developers synchronize on their .uncrustify.cfg?
Surely this should be per-package, not per-developer.