Tabs and spaces (Re: [RFC 0/5] Date Mode: Add --time-zone; deprecate --date=local)
From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:51:04
Hi Michael, Michael Witten wrote:
and I'm also responsible for this massive git flamewar of yore on the same subject: http://article.gmane.org/gmane.comp.version-control.git/61095 Message-ID: 634393B0-734A-4884-93E3-42F7D3CB157F@mit.edu
Heh. :)
However - and this is the key point - if you are going to be mixing tabs and spaces ANYWAY, then you might as well do it in a way that maintains alignment within a tab level regardless of the current setting for the tabwidth:
In principle, I generally agree. But as mentioned in the thread you
reference, most text editors don't make that very easy.
I personally use a tabwidth of 6 when I really want to concentrate on
reading. When coding in a rush for other people, that leads to using
tabstop of 8 and only aligning text that is much shorter than one tab:
if (foo && bar && baz &&
qux && quux) {
...
} else if (quuux(quuuux, quuuuux,
long_expresion_comes_here(quuuuuux))) {
...
}
As you can see, this is following the "put continuation lines near the
right margin" convention advocated in linux-2.6's
Documentation/CodingStyle.
Two advantages:
- looks sensible with any tabstop
- no need to cascade changes on following lines when the width of a
function name changes
One major disadvantage:
- annoys people who like everything nicely lined up.
For what it's worth. (Not much, of course --- the best rule is as
always to make sure your code fits well with the code around it.)
Hope that helps,
Jonathan