On 12/2/10 1:11 PM, Roy Stogner wrote:
>
> On Thu, 2 Dec 2010, Boyce Griffith wrote:
>
>> OK --- attached is a patch. Most of it is just re-indenting. (I wasn't
>> always careful about using tabs instead of spaces --- is there a
>> convention that you all prefer to use?)
>
> The ideal thing to do is tabs for indentation, spaces for alignment.
> So if you're two nested loops in, you might have
>
> <TAB><TAB>function_call(arg1,
> <TAB><TAB><14 SPACES>arg2);
>
> and arg1 and arg2 will line up regardless of people's tab settings,
> and all will be right with the world.
>
> It's never done this way in libMesh. Personally I'm too lazy even to
> figure out the proper vim settings to do it automatically, much less
> to do it by hand.
>
> Next best is all-spaces. Annoyingly hard-coded, but at least it
> shouldn't break when someone has a tabstop set to 4 instead of 8.
> It's what I try to do.
>
> Last best is automatically replacing every 8 spaces with a tab. This
> is worthless. It's also probably the most or second-most common style
> in libMesh.
>
> One of these days we need to figure out how to nicely configure one of
> those automatic reformatting tools, then just require everyone to run
> a pass of that before committing, to at least avoid those situations
> where svn diffs end up bloated by unnoticed whitespace changes.

It looks like Artistic Style's GNU setting more-or-less conforms to the 
libMesh style --- you can invoke it via:

    astyle --style=gnu -r $PWD/*.C $PWD/*.h

or possibly:

    astyle --style=gnu --max-instatement-indent=79 \
           --min-conditional-indent=0 -r $PWD/*.C $PWD/*.h

This will generate (a ton of) backup files with the suffix ".orig"; 
these can be disabled by adding the "-n" flag.

astyle will also strip out all trailing whitespaces.  You can also 
configure it to use tabs or spaces for indentation:

    http://astyle.sourceforge.net/astyle.html#_Tab_and_Bracket_Options

It would be easy enough to add a makefile target ("reindent" or 
"precommit" or ... ) to invoke this.

-- Boyce

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Libmesh-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-devel

Reply via email to