Hacker News new | ask | show | jobs
by nybble41 1722 days ago
Which is easy to say, but hard to make everyone do correctly. First you need to ensure that everyone uses an editor with a "visible whitespace" option, and turns it on, so they can see whether they have the right whitespace. Then you get to spend precious programming time turning one kind of whitespace into another since most editors will get it wrong when they auto-indent.

Either use spaces everywhere so you have total control over the layout or forego alignment (other than block indentation). Mixing tabs and spaces is a path to madness.

1 comments

This is part of the reason why editors for programmers and editors for general text editing are not the right thing.

I have F11 in emacs bound to whitespace-cleanup, which takes care of it all for me. And supertabs mode in general works just the way it should with tabs-indent/spaces-align.

Then there's also clang-fmt, possibley used as a post-receive hook in git (and some other VCS) which makes irrelevant what the programmer's editor did, mostly.

Can whitespace-cleanup really differentiate between places where you want a tab for indentation, and places where you want spaces for alignment, where the number of spaces may be greater than the tab width? After all, the only way to differentiate is to guess what you might be trying to align to by looking at surrounding lines… but from a quick search, whitespace.el looks less complex than that.
You're entirely correct. Sorry, i forget, whitespace-cleanup is there so that I can remove dangling whitespace from the end of lines.

supertab mode is the tab-to-indent/space-to-align magic.