News for hackers. Stuff that matters.
Re:Better Clojure formatting by thomastjeffery on Thursday December 06, 2018 @10:39PM (#18624956)
> > Avoid trailing whitespace.

> This is one of the stupidest things to automate. Unlike indenting, removing trailing whitespace simply produces diffs where it doesn’t matter. And does nothing more.

I suppose formatting is a weak point for version control systems, but I think that is all the more reason to get rid of trailing whitespace. The more your code is clean of ambiguous formatting, the less it will change between commits.

Re:Better Clojure formatting by Guthur on Friday December 07, 2018 @04:20AM (#18626193)
If you got rid of it from the beginning there is no diff. The argument makes no sense.
Re:Better Clojure formatting by dm3 on Friday December 07, 2018 @03:54AM (#18626081)
Exactly! Just separate the commits which fix formatting from the ones that change code.
Re:Better Clojure formatting by kjeetgill on Friday December 07, 2018 @04:32PM (#18631878)
In vim it's as simple as :%s/\s* $// (okay, not that simple if you don't spend time in regex or in the shell) and git can hide whitespace only changes in diffs. Just don't check in trailing whitespace.

If you need to clean up a whole codebase you can throw in something like find -name * .java | xargs sed -i 's/\s* $//' and just commit that once.

Sidebar: How do I print an asterisk and a char without adding in whitespace.

Re:Better Clojure formatting by kbp on Friday December 07, 2018 @06:13PM (#18632555)
Trailing whitespace also makes jumping to the end of a line or moving back over a newline not take you where you expect, which is annoying when it breaks your flow.

It's only ever a mild nuisance (in that scenario or for diffs), but the fact that it's trivial to automate seems to make it a no-brainer to me.