Penguin
Note: You are viewing an old revision of this page. View the current version.

Ok, I'm (PerryLorier) going to start a ReligiousWar.

Tabs should be 8 charactors and no correspondance shall be entered into.

Why? Because while 8 charactors is 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.

But vim/emacs support mode lines so you can see which tab width you use!

Except that

  1. they don't agree on the syntax, so you need two sets of modelines, one for each application
  2. grep/patch/diff/sed/lpr/less don't read modelines.

You can run things through a preprocessor to convert tabs to the correct number of spaces!

if I "convert" a diff, then it's not going to apply as a proper patch anymore. If I expandtabs on a Makefile then suddenly it's got a "missing delimiter". If I expandtabs on sendmail.cf my mail is no longer delivered.

You can tell vim/emacs/etc to always expand tabs to spaces

Then backspace for unindent doesn't work, it removes one space, not one tab.

But they push my code too far to the right

Then your logic is too complicated, go break it into another function to simplify it.

The correct answer is to use 8 charactor 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.