[gdal-dev] emacs configuration for correct code indentation?

Frank Warmerdam warmerdam at pobox.com
Fri Sep 2 14:45:40 EDT 2011


On Fri, Sep 2, 2011 at 11:29 AM, Even Rouault
<even.rouault at mines-paris.org> wrote:
>> (setq-default c-basic-offset 4
>>           tab-width 4
>>           indent-tabs-mode nil)
>> (c-set-offset 'case-label '+)
>
> Not sure if it is RFC material, but you can definitely share it in
> http://trac.osgeo.org/gdal/wiki/HowToContribute
>
> You have summed up perfectly the most important coding conventions.

Etienne,

Agreed, 4 character indent using spaces not
tabs is the key thing to avoid messiness for others.

> You have also probably noticed the nice visual ascii art that is generally
> prepended before each function/method :
>
> /************************************************************************/
> /*                               foo()                                  */
> /************************************************************************/

I actually have emacs macros for editing these header blocks.
I could share them if you are interested, but they are not that
critical.

I deliberately have avoided trying to be really strict about code
formatting in GDAL/OGR.  I think over-strictness can be offputting
to new contributors and lead to disputes over details.  But do
make an effort to fit into the modules you work on and feel
free to take more liberties on drivers that you are writing from
scratch.

> And if you really want to confuse FrankW and make him believe he has written
> the code himself, you'd write if( foo ) rather than if (foo) ;-)

This is one of the details that seems fairly idiosyncratic
to me, but it is contrary to Google code style so perhaps
I will adapt to "if (foo)" now.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Software Developer


More information about the gdal-dev mailing list