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

Michael Truog <>
Wed Feb 5 22:46:33 CET 2014


On 02/05/2014 10:40 AM, Ulf Wiger wrote:
> One thing for emacs users (or those who need to deal with them) to do is to insert the following at the top of each erlang module:
>
> %% -*- erlang-indent-level: 4; indent-tabs-mode: nil -*-
>
> (Perhaps others have suggestions for the ultimate settings here)
The ULTIMATE modeline settings should be:
%-*-Mode:erlang;coding:utf-8;tab-width:4;c-basic-offset:4;indent-tabs-mode:()-*-
% ex: set ft=erlang fenc=utf-8 sts=4 ts=4 sw=4 et:

latin1 would need to be used for the older Erlang source code that requires it (probably all of OTP) which unfortunately makes the emacs modeline more than 80 characters.  Having both an emacs and a vi modeline can keep both sets of users happy.

It is typical to avoid tabs and prefer spaces, so it would be nice to have that be standard, since the OTP code is becoming unreadable due to characters that don't matter (due to not making a decision, you are still deciding to allow both tabs and spaces).  Tab stops were never standard and only really relate to typewriters historically (who uses those for Erlang?).

>                   
>
> BR,
> Ulf W
>
> On 5 Feb 2014, at 19:14, Vlad Dumitrescu <> wrote:
>
>> Hi all,
>>
>> It's been almost a full day since the last controversial issue was
>> discussed here and I feel it's time for a new one (well, it's actually
>> old).
>>
>> The default indentation used by the erlang-mode uses a mix of tabs and
>> spaces. Whatever side one is in the "tabs vs spaces" war, mixing them
>> is the common enemy!
>>
>> Not everybody uses emacs, nor should they be forced to. This means
>> that creating a patch might take less time than adjusting the
>> whitespace afterwards, which feels a horrible waste of time and
>> energy.
>>
>> Of course, we the non-emacs-using hackers of the OTP code might be in
>> a crushing minority, and then the issue will get closed quickly. I
>> feel however that I need to try to change this. I have abstained
>> before from submitting small fixes just because of this (instead I
>> sold the idea to someone else, but that doesn't always work).
>>
>> So my question is: are enough people bothered by this issue? If yes,
>> can we try to agree on a solution? Such changes are best done in
>> connection with a release.
>>
>> best regards,
>> Vlad
>> _______________________________________________
>> erlang-questions mailing list
>> 
>> http://erlang.org/mailman/listinfo/erlang-questions
> Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc.
> http://feuerlabs.com
>
>
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
> .
>



More information about the erlang-questions mailing list