From: Sean Middleditch Date: 2002-03-18T02:22:37+09:00 Subject: Re: Mini Rant: Indenting I think people's editors may be at fault here. I know if I edit a file designed for 2 spaces of indent while I use 4, my editor (vim) starts fricking with everything. On Sun, 2002-03-17 at 12:14, Thomas Hurst wrote: > Why is it that I see *so* much code like: > > (uri/generic.rb) > if USERINFO !~ v > ��������raise InvalidComponentError, > �������� "bad component(expected userinfo component or > user component): #{v}" > end > > (note the highlighted tabs, and how my ts of 8 interferes with the > original programmer's ts of 4, and indent level of 2) > > If you *must* use spaces to indent, can you please *stick* to using > spaces to indent and not turn your code into a disgusing mishmash of > tabs and spaces; this really is the worst of both worlds because you > end up with spaces that don't adapt to your prefered tabstop and tabs > that do but shouldn't. > > I jokingly call this the GNU indent method, because pretty much all the > GNU source I've seen is like this. > > Go ahead; look at most source on your system and change your tabstop; > most of it will completely screw up :( > > Solutions: > > 1. Use spaces ONLY; if at all possible, completely turn them off in > your editor. If you believe all the stuff about how it makes your > code easier to read, you DON'T want a tab in there, because that > will be utterly counter to your reasons for using spaces in the > first place. > > This will render your maintainer's tabstop completely castrated, > which aside from pissing him off, at least won't cause your code to > look like it's been ran through a meat grinder. > > 2. Use tabs ONLY; use them for indenting at the left of the expression, > and at the right ONLY where they're needed to line things up because > of different indent levels. > > This will give the control of indent level back to the editor; you > can decide to switch from a ts of 4 to 8 and your code will follow > suit automatically and without anyone else noticing. > > Pick one or the other; and do it properly. Really, it's not hard and > makes code so much neater for other users to look at. > > Turning on whitespace highlighting is a good move for doing either of > these right; in vim, something like: > > set listchars=tab:��,trail:� > highlight NonText ctermfg=blue > set list > > Should do. It shows tabs as ����� and trailing whitespace as �, > highlighted blue. > > -- > Thomas 'Freaky' Hurst - freaky@aagh.net - http://www.aagh.net/ > - > Hi Jimbo. Dennis. Really appreciate the help on the income tax. > You wanna help on the audit now?