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

Re: [PATCH] whitespace: fix initial-indent checking

From
JFJ. Bruce Fields <bfields@fieldses.org>
Date
Dec 16, 2007, 21:19 UTC
Message-ID
<20071216211944.GA25178@fieldses.org>
In-Reply-To
<7vodcqjrtw.fsf@gitster.siamese.dyndns.org>
On Sun, Dec 16, 2007 at 12:40:59PM -0800, Junio C Hamano wrote:
Show 10 quoted lines
> "J. Bruce Fields" <bfields@fieldses.org> writes:
> 
> > One slightly weird thing about this: I'd expect indent-with-non-tab to
> > catch any sequence of 8 or more contiguous spaces, not just such
> > sequences at the end of the indent.  This doesn't quite do that.
> 
> +-------+-------+-------+-------+-------+-------+-------+-------+-------+
> Personally, I would hate that.  That would muck with two spaces I
> deliberately typed after the full stop before this sentence).  Please
> don't.

Right, I was only thinking of literal sequences of 8 contiguous spaces, and only in the initial indent. So it's the failure to flag

	"^\t         \t"

that I find a little unexpected. Whatever--I don't think it's particularly important. Like I say, I think there's really only two cases anyone really cares about:

	1. The kernel or git style, where all initial whitespace is
	tabbed as much as possible.
	2. Various other styles which may be harder to check completely,
	but which are likely to share the "no spaces before tabs in
	initial indent" rule as a least common denominator.
Show 19 quoted lines
> Emacs "M-x tabify" tends to do this and I found it unsuitable especially
> for code (I am not complaining, it probably was invented for other
> purposes and not reformatting code):
> 
> If you have original (the run of '>>..>>' is a single tab, '.' is a SP)
> 
>         dcba....123
>         fedcba..123
>         gfedcba.123
> 
> and "tabify" the region, you would get:
> 
>         dcba>>>>123
>         fedcba>>123
>         gfedcba.123
> 
> That is fine if you are shooting for minimum number of bytes, but often
> it is not what you want in your code, especially when the part that
> conains the whitespace "..cba 123.." is inside a string constant.
Yeah, that sounds pretty irritating.
--b.
Previous: Junio C HamanoNext: Jakub Narebski
Message 18 of 43 in “builtin-apply: rename "whitespace" variables and fix styles”
  1. 1/2 builtin-apply: rename "whitespace" variables and fix stylesJunio C Hamano, Nov 24, 2007
  2. 2/2 builtin-apply: teach whitespace_rulesJunio C Hamano, Nov 24, 2007
  3. 3/2 core.whitespace: documentation updates.Junio C Hamano, Nov 24, 2007
  4. J. Bruce FieldsNov 24, 2007
  5. Junio C HamanoNov 24, 2007
  6. J. Bruce FieldsNov 25, 2007
  7. Junio C HamanoDec 6, 2007
  8. J. Bruce FieldsDec 6, 2007
  9. J. Bruce FieldsDec 16, 2007
  10. whitespace: fix off-by-one error in non-space-in-indent checkingJ. Bruce Fields, Dec 16, 2007
  11. whitespace: reorganize initial-indent checkJ. Bruce Fields, Dec 16, 2007
  12. whitespace: minor cleanupJ. Bruce Fields, Dec 16, 2007
  13. whitespace: fix initial-indent checkingJ. Bruce Fields, Dec 16, 2007
  14. whitespace: more accurate initial-indent highlightingJ. Bruce Fields, Dec 16, 2007
  15. whitespace: fix config.txt description of indent-with-non-tabJ. Bruce Fields, Dec 16, 2007
  16. J. Bruce FieldsDec 16, 2007
  17. Junio C HamanoDec 16, 2007
  18. J. Bruce FieldsDec 16, 2007
  19. Jakub NarebskiDec 16, 2007
  20. Wincent ColaiutaDec 16, 2007
  21. J. Bruce FieldsDec 16, 2007
  22. Jakub NarebskiDec 16, 2007
  23. Jakub NarebskiDec 16, 2007
  24. J. Bruce FieldsDec 16, 2007
  25. Jakub NarebskiDec 16, 2007
  26. Junio C HamanoDec 16, 2007
  27. Junio C HamanoDec 16, 2007
  28. Wincent ColaiutaDec 16, 2007
  29. J. Bruce FieldsDec 16, 2007
  30. 1/6 whitespace: fix off-by-one error in non-space-in-indent checkingJ. Bruce Fields, Dec 16, 2007
  31. 2/6 whitespace: reorganize initial-indent checkJ. Bruce Fields, Dec 16, 2007
  32. 3/6 whitespace: minor cleanupJ. Bruce Fields, Dec 16, 2007
  33. 4/6 whitespace: fix initial-indent checkingJ. Bruce Fields, Dec 16, 2007
  34. 5/6 whitespace: more accurate initial-indent highlightingJ. Bruce Fields, Dec 16, 2007
  35. 6/6 whitespace: fix config.txt description of indent-with-non-tabJ. Bruce Fields, Dec 16, 2007
  36. builtin-apply whitespaceJ. Bruce Fields, Dec 16, 2007
  37. 1/2 builtin-apply: minor cleanup of whitespace detectionJ. Bruce Fields, Dec 16, 2007
  38. 2/2 builtin-apply: stronger indent-with-on-tab fixingJ. Bruce Fields, Dec 16, 2007
  39. Wincent ColaiutaDec 17, 2007
  40. Junio C HamanoDec 17, 2007
  41. Jakub NarebskiDec 18, 2007
  42. Junio C HamanoDec 18, 2007
  43. Junio C HamanoDec 16, 2007

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.