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

From: Jim Meyering <[email-masked]>
Date: Fri, 04 Jun 2010 07:29:24 +0200

Paul Eggert wrote:

> 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?

Maybe it does, already.
I honestly don't know.  For each case like this
it's a bit of a treasure hunt: will we find the option
we want, already in working order?

>>> 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.

And maybe there's already an option for that.
Care to look and/or to add it?

>> 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.

That'd be best, but from my brief foray into uncrustify's code,
there is no option for that.  Do you feel like investigating
and adding one, if needed?

>> 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.

Yes, of course.
I'm keeping the initial churn separate from any code base.
I will add it to coreutils' repository before we start using it in earnest.