Tabs should be 8 characters and no correspondance shall be entered into. While that's stupidly wide, at least it's a standard. There is absolutely nothing worse than opening a file and having it look like it was formatted by a two year old chimpanzee on crack.
Except that
A converted diff does not apply as a proper patch anymore. A converted MakeFile bombs out due to a "missing delimiter". A converted sendmail.cf means no mail is delivered.
Some people may tell you to do something like
:set tabstop=8 :set shiftwidth=4
in Vim (and analogous in Emacs). Backspace for unindent doesn't work anymore then. You remove one space, not one tab. Please see Converting tabs to spaces which is a little more optimistic!
Then your logic is too complicated. Break it into another function to simplify it.
The correct answer is to use 8 character tabs. Sure they are wider than they need to be, but they work. Anyone who tries to tell you that tabs should be whatever else they feel like (2? 4? 5? 6?) needs to be shot. Especially if they ever think that their code is going to be viewed by anyone else, so unless you are writing a proprietary program and never planning on giving the code away or ever showing it to anyone, don't change the tab size.
Of course, if everyone just used python then it wouldn't matter.
You can use 4 character tabs and feel fine all along. More importantly, so will the people who open your files.
The key to this state of mind is simple: don't use tabs ANYWHERE but the beginning of the line!!
Well, people can throw a monkey wrench in this scheme if they use overly smrt(sic) editor( setting)s so tabs are used for 8 character gaps and spaces create smaller indentations. Unfortunately, way too many people think this is a good idea and way too many tools support and even suggest this style. This is utterly stupid.
ONLY use tabs to indent.
ONLY use tabs at the beginning of a line.
ONLY use spaces to line up things in the middle of a block.
Then you can choose your tab width whichever way you like and noone will ever be the wiser from looking at your files.
Have a nice day.
While this sounds fine, I've never seen it work in practise :( -- PerryLorier
One page links to TabStops:
lib/main.php:944: Notice: PageInfo: Cannot find action page