Spacing issues

Ryan Schmidt ryandesign at macports.org
Mon Feb 12 21:43:43 PST 2007


On Feb 11, 2007, at 22:56, Kevin Ballard wrote:

> Are there any more thoughts on this matter?
>
> For now, every line I modify is going to have its hard tabs  
> converted to 4-width soft tabs (and reindented if necessary).

Why will this occur? Is it because this is how your editor is  
configured, and you do not want to change your editor configuration?  
If so, then this is not a good reason; if we change the spacing rules  
as you propose, then you will fix this problem for yourself, but also  
cause the same problem for me and others with editor settings like mine.

> I'd really like to do a single pass and convert the entire source  
> base over to 4-width soft tabs, but it seems we have at least one  
> dissenter.
>
> Can we come to an agreement on an overall policy for this?

If nobody else has any objections to converting to all spaces, I'll  
learn to live with it too. But a question occurs to me: How will you  
convert the entire source base over to 4-space-width soft tabs? Is  
there already a program to do that? You can't of course just replace  
all occurrences of ASCII 0x09 with 4 instances of ASCII 0x20; you'd  
need anywhere from 1 to 4 spaces depending on preceding characters on  
the line.

If we agree to convert to all spaces, then I'd like there to be a  
script that does the above available as part of the MacPorts  
distribution, or as an installable port, so that I can use that  
script over any files that I modify, since as I've said, my editor  
does and will use tabs, and I'll need an easy automated way to  
replace those with the right number of spaces before committing.

Also, I think the whole reason for this exercise is that not all  
people have had 4-space-width tabs before, making things look weird  
when the local editor setting doesn't match the port author's editor  
setting. What about those portfiles that were written with 8-space- 
width tabs? How will you identify such files to properly replace the  
tab characters with between 1 and 8 spaces? Or will you not attempt  
to identify these files, and just assume all tabs in all files are 4- 
space-width tabs? Won't that make things even uglier for those files,  
until all portfiles are manually examined and corrected, which would  
likely be a random discovery process that would take a long  
indeterminate amount of time if not done in a coordinated manner?  
During which time indentation of random portfiles would still be  
ugly, which is the very problem you're trying to fix by changing the  
spacing?

Is it useful to consider the use of a tcl prettyprinter, rather than  
just converting tabs to spaces? Is there such a tool? Would there  
need to be a specialized MacPorts portfile prettyprinter, rather than  
a generic tcl one?





More information about the macports-dev mailing list