[prev in list] [next in list] [prev in thread] [next in thread] 

List:       graphviz-devel
Subject:    Re: [graphviz-devel] Perl WebDot: indentation and whitespace
From:       John Ellson <ellson () research ! att ! com>
Date:       2009-02-17 15:22:27
Message-ID: 499AD633.5070902 () research ! att ! com
[Download RAW message or body]

Ryan Schmidt wrote:
> Would you accept a patch to make global whitespace changes to Perl 
> WebDot, to make the indentation consistent?

Sure.
>
> Currently the file is a mix of indentation styles. Most of the code 
> uses four spaces for the first level of indentation, one tab for the 
> second level, one tab and then four spaces for the third level, and so 
> on; for this to look right the editor must be set to render one tab as 
> eight spaces. Some of the code uses a tab character for each level of 
> indentation, so it does not fit in.
For C code, we settled on this header to record the cvs version and set 
up the editor.
My preference would be to use the same indentation in perl.   Presumably 
we could add a similar control for emacs, if you know what it should be?

/* $Id: dot.c,v 1.39 2009/02/12 17:47:23 ellson Exp $ $Revision: 1.39 $ */
/* vim:set shiftwidth=4 ts=8: */


>
> Your guidance is sought for the correct indentation style to which the 
> file should be converted. I propose that the style originally used in 
> the script is not a good one because it forces the user to configure 
> his editor for eight-space tabs and it is also rather difficult to 
> maintain if the user's editor does not have built-in support for this 
> indentation style. The editor I use (TextWrangler, the free cousin to 
> BBEdit) does not appear to.
>
> Personally I prefer to use one tab for each level of indentation, so 
> that I can configure my editor to render tabs as however many spaces I 
> like and it looks fine. I use this style in my own projects.
>
> Another option: In the MacPorts project we have standardized on using 
> four spaces for each level of indentation and not using tab characters 
> at all. I don't mind this too much because four spaces per indentation 
> is my preference anyway, though it is annoying to be forbidden from 
> using the tab key or the "increase/decrease indentation" functions in 
> my editor, since these insert tab characters.
This is I believe what we do too.   I think we formatted with no tabs at 
one time, but tabs will creep in.
The only language I know of that cares if the white space is tabs or 
spaces is Python.  We don't have much of that yet.
>
> Whatever the chosen style (even the original style, if we must), we 
> can add a modeline at the top of the file to help editors like vi and 
> emacs know what the file's indentation style is supposed to be, though 
> this is also moot for TextWrangler which doesn't seem to read modelines.

Yes, as mentioned above, we use modelines elsewhere in the sources.  
When you make this change please
add the modeline and the CVS revision comment line.   (These can follow 
the #! line.)

John


>
>
> P.S: I'm seeing some feature requests I need to send to Bare Bones 
> Software...
>
> _______________________________________________
> graphviz-devel mailing list
> graphviz-devel@research.att.com
> https://mailman.research.att.com/mailman/listinfo/graphviz-devel

_______________________________________________
graphviz-devel mailing list
graphviz-devel@research.att.com
https://mailman.research.att.com/mailman/listinfo/graphviz-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic