Spacing issues

Kevin Ballard eridius at macports.org
Mon Feb 12 21:57:23 PST 2007


A lot of the macports base files actually were written with 8-space  
tabs, and then edited later with 4-space soft tabs (at least, that's  
my assumption based on some tabbing assuming 8-space, and some soft  
tabs at the end of other tabs that are 4-width long).

In any case, using 4-space tabs will not have a detrimental effect on  
your editor, unless you're editing lines using soft tabs inside base/  
when you have your editor set to hard tabs. And I don't see much  
editing of base/ going on these days (aside from my recent changes),  
so I think it's safe to say that won't happen ;)

In any case, I'm pretty sure there are existing programs to convert  
tabs, but I can't recall any offhand. Even if there aren't, it should  
be trivial to write one. And as for the 8-space vs 4-space issue,  
anybody using an editor set to 4-width tabs already has a problem  
with these (and I would venture to guess that's most people), so I  
see no issue with simply converting them and letting people re-indent  
if they edit a file that has a problem.

On Feb 13, 2007, at 12:43 AM, Ryan Schmidt wrote:

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

-- 
Kevin Ballard
http://kevin.sb.org
eridius at macports.org
http://www.tildesoft.com


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-dev/attachments/20070213/8d2136d4/attachment.html


More information about the macports-dev mailing list