[erlang-questions] Controversial subject of the day: tabs and spaces for indentation

Vlad Dumitrescu vladdu55@REDACTED
Thu Feb 6 10:43:27 CET 2014


On Thu, Feb 6, 2014 at 10:31 AM, Lukas Larsson <lukas@REDACTED> wrote:
> On Thu, Feb 6, 2014 at 9:38 AM, Loïc Hoguin <essen@REDACTED> wrote:
>>
>> Plus this doesn't help your code get merged at all. If you submit code
>> with broken whitespace, then tools will also display this whitespace change.
>> You can of course hide whitespace changes, but the problem is that
>> whitespace does matter in some places, so you're basically hiding
>> potentially important information by doing that.
>>
> This is in my opinion the reason why it would be a very bad thing to do a
> huge commit that changes the current whitespace format of a project to
> another. It is already very hard to figure out what change could have caused
> a bug without having to deal with whitespace changes in the middle of a
> diff.

Yes, if such a thing would be done, the best time is as a separate
commit right before a release, this will minimize the number of
merges/rebases with mixed styles of indentation. Of course, as Lukas
points out, if diffing with older code, then you have a problem.

Anyway, I have a suggestion for a workaround at
https://gist.github.com/vladdu/8841089. Put those files in your ~/bin
(which should be on $PATH), edit them to match your system and style
and you can reindent files simply by running "erl-indent
/path/to/myfile.erl". It still requires to have emacs installed, but I
can live with that.

The downside is that if you want to use only spaces, then the whole
file will be changed to use them. The really big downside is that with
this tool there will be even less incitament to change the indentation
style...

regards,
Vlad



More information about the erlang-questions mailing list