git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Tabs and spaces (Re: [RFC 0/5] Date Mode: Add --time-zone; deprecate --date=local)

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Apr 21, 2011, 00:07 UTC
Message-ID
<20110421000701.GA10987@elie>
In-Reply-To
<d74e95d4-ef16-42fb-ae8f-b1d7a8b9d91e-mfwitten@gmail.com>
Hi Michael,
Michael Witten wrote:
Show 5 quoted lines
> 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

Previous: Michael WittenNext: Michael Witten
Message 31 of 37 in “[RFC 0/5] Date Mode: Add --time-zone; deprecate --date=local”
  1. Michael WittenApr 20, 2011
  2. 1/5 Light refactoring of date infrastructureMichael Witten, Apr 20, 2011
  3. 2/5 Pretty Print: show tz when using DATE_LOCALMichael Witten, Apr 20, 2011
  4. Junio C HamanoApr 21, 2011
  5. Dates in Commits and other issues of style (Re: [RFC 2/5] Pretty Print: show tz when using DATE_LOCAL)Michael Witten, Apr 22, 2011
  6. Miles BaderApr 25, 2011
  7. Junio C HamanoApr 25, 2011
  8. Jakub NarebskiApr 25, 2011
  9. Junio C HamanoApr 25, 2011
  10. Michael WittenApr 22, 2011
  11. Junio C HamanoApr 22, 2011
  12. 3/5 Date Mode: ImplementationMichael Witten, Apr 20, 2011
  13. Junio C HamanoApr 21, 2011
  14. 4/5 Date Mode: DocumentationMichael Witten, Apr 20, 2011
  15. 5/5 Date Mode: TestsMichael Witten, Apr 20, 2011
  16. Junio C HamanoApr 21, 2011
  17. Michael WittenApr 23, 2011
  18. Michael WittenApr 23, 2011
  19. Time zone option name (Re: [RFC 5/5] Date Mode: Tests)Michael Witten, Apr 23, 2011
  20. Junio C HamanoApr 23, 2011
  21. Michael WittenApr 23, 2011
  22. Jeff KingApr 20, 2011
  23. Michael WittenApr 20, 2011
  24. Junio C HamanoApr 21, 2011
  25. Michael WittenApr 21, 2011
  26. Junio C HamanoApr 21, 2011
  27. Michael WittenApr 21, 2011
  28. Michael WittenApr 20, 2011
  29. Michael WittenApr 20, 2011
  30. Michael WittenApr 20, 2011
  31. Tabs and spaces (Re: [RFC 0/5] Date Mode: Add --time-zone; deprecate --date=local)Jonathan Nieder, Apr 21, 2011
  32. Michael WittenApr 21, 2011
  33. Jonathan NiederApr 21, 2011
  34. Michael WittenApr 21, 2011
  35. Thiago FarinaApr 21, 2011
  36. Alex RiesenApr 21, 2011
  37. Michael WittenApr 21, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.