Controversial subject of the day: tabs and spaces for indentation

classic Classic list List threaded Threaded
105 messages Options
1234 ... 6
Reply | Threaded
Open this post in threaded view
|

Controversial subject of the day: tabs and spaces for indentation

Vlad Dumitrescu-5
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

Reply | Threaded
Open this post in threaded view
|

Controversial subject of the day: tabs and spaces for indentation

Andrew Thompson-3
On Wed, Feb 05, 2014 at 07:14:30PM +0100, 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!

As a vim user, I find the emacs indent mode for erlang incredibly
annoying to 'fake' by hand. I'd love to see the tabs die as mixing tabs
and spaces makes erlang files a horrible mess when your tabstop is not
8.

Andrew

Reply | Threaded
Open this post in threaded view
|

Controversial subject of the day: tabs and spaces for indentation

Garrett Smith
On Wed, Feb 5, 2014 at 12:27 PM, Andrew Thompson <andrew> wrote:

> On Wed, Feb 05, 2014 at 07:14:30PM +0100, 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!
>
> As a vim user, I find the emacs indent mode for erlang incredibly
> annoying to 'fake' by hand. I'd love to see the tabs die as mixing tabs
> and spaces makes erlang files a horrible mess when your tabstop is not
> 8.

I'm curious what the argument *for* mixed tabs and spaces is. It is to
save precious disk space?

Garrett

P.S. I agree, going two to three days without religious material on
the Erlang list is, well, it's just hard to go back now.

Reply | Threaded
Open this post in threaded view
|

Controversial subject of the day: tabs and spaces for indentation

Loïc Hoguin-2
On 02/05/2014 07:35 PM, Garrett Smith wrote:

> On Wed, Feb 5, 2014 at 12:27 PM, Andrew Thompson <andrew> wrote:
>> On Wed, Feb 05, 2014 at 07:14:30PM +0100, 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!
>>
>> As a vim user, I find the emacs indent mode for erlang incredibly
>> annoying to 'fake' by hand. I'd love to see the tabs die as mixing tabs
>> and spaces makes erlang files a horrible mess when your tabstop is not
>> 8.
>
> I'm curious what the argument *for* mixed tabs and spaces is. It is to
> save precious disk space?

The argument isn't very interesting, intent is much more so. It all
comes from one guy who figured a way to troll everyone alive at the time
plus all future generations forever, and succeeded.

--
Lo?c Hoguin
http://ninenines.eu

Reply | Threaded
Open this post in threaded view
|

Controversial subject of the day: tabs and spaces for indentation

Ulf Wiger-5
In reply to this post by Vlad Dumitrescu-5

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)                    

BR,
Ulf W

On 5 Feb 2014, at 19:14, Vlad Dumitrescu <vladdu55> 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
> erlang-questions
> http://erlang.org/mailman/listinfo/erlang-questions

Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc.
http://feuerlabs.com




Reply | Threaded
Open this post in threaded view
|

Controversial subject of the day: tabs and spaces for indentation

Garrett Smith
In reply to this post by Loïc Hoguin-2
On Wed, Feb 5, 2014 at 12:39 PM, Lo?c Hoguin <essen> wrote:

> On 02/05/2014 07:35 PM, Garrett Smith wrote:
>>
>> On Wed, Feb 5, 2014 at 12:27 PM, Andrew Thompson <andrew>
>> wrote:
>>>
>>> On Wed, Feb 05, 2014 at 07:14:30PM +0100, 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!
>>>
>>>
>>> As a vim user, I find the emacs indent mode for erlang incredibly
>>> annoying to 'fake' by hand. I'd love to see the tabs die as mixing tabs
>>> and spaces makes erlang files a horrible mess when your tabstop is not
>>> 8.
>>
>>
>> I'm curious what the argument *for* mixed tabs and spaces is. It is to
>> save precious disk space?
>
>
> The argument isn't very interesting, intent is much more so. It all comes
> from one guy who figured a way to troll everyone alive at the time plus all
> future generations forever, and succeeded.

So this is actually an opportunity, over the course of 6 - 12 hours
per day, to check one's arrogance and hubris - to be a more humble and
modest person? I can see an advantage here.

Reply | Threaded
Open this post in threaded view
|

Controversial subject of the day: tabs and spaces for indentation

Vlad Dumitrescu-5
In reply to this post by Ulf Wiger-5
On Wed, Feb 5, 2014 at 7:40 PM, Ulf Wiger <ulf> 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)

That (or whatever we agree on) would help a lot. The heavy question is
- is it reasonable to change accordingly all OTP source files? Maybe
just before setting the final 17.0.0 tag (or some other convenient
moment)?

By the way, there is another golden rule that the OTP sources are
challenging: trailing spaces on lines... Here I think that the problem
are the emacs templates, as almost all cases I've seen are in
comments.

regards,
Vlad

Reply | Threaded
Open this post in threaded view
|

Controversial subject of the day: tabs and spaces for indentation

Björn-Egil Dahlberg-3
In reply to this post by Garrett Smith
This is a war worth winning but it feels like every battle has been a
loss so far ..

As a member of the OTP-team and the *only* vim user, I can say that the
rest of OTP has utter disinterest to change the current format. (or so
it seems anyway =)

I guess Emacs does not allow indentation to be anything other than horrible.

Every time I've brought it up there is whining about some precious
little elisp file that can't handle the change.

I've gotten harassed on the number of '%' comment characters I'm
supposed to use for different context .. otherwise Emacs just explodes
.. or something.

Ok, so perhaps I'm being a bit dramatic here =)

The truth is that a lot of code in otp is emacs:ified - that is the
convention. I think it's bad - but i've managed.

Tabs are problematic because code-rendering tools for reviewing code has
a lot of issues with it. *We should remove them*, but I'll guess hell
will freeze over well before that happens.

// Bj?rn-Egil

On 2014-02-05 19:35, Garrett Smith wrote:

> On Wed, Feb 5, 2014 at 12:27 PM, Andrew Thompson <andrew> wrote:
>> On Wed, Feb 05, 2014 at 07:14:30PM +0100, 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!
>> As a vim user, I find the emacs indent mode for erlang incredibly
>> annoying to 'fake' by hand. I'd love to see the tabs die as mixing tabs
>> and spaces makes erlang files a horrible mess when your tabstop is not
>> 8.
> I'm curious what the argument *for* mixed tabs and spaces is. It is to
> save precious disk space?
>
> Garrett
>
> P.S. I agree, going two to three days without religious material on
> the Erlang list is, well, it's just hard to go back now.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions
> http://erlang.org/mailman/listinfo/erlang-questions
>
>


Reply | Threaded
Open this post in threaded view
|

Controversial subject of the day: tabs and spaces for indentation

Raoul Duke-2
> I guess Emacs does not allow indentation to be anything other than horrible.
> Every time I've brought it up there is whining about some precious little
> elisp file that can't handle the change.
> I've gotten harassed on the number of '%' comment characters I'm supposed to
> use for different context .. otherwise Emacs just explodes .. or something.
> Ok, so perhaps I'm being a bit dramatic here =)

personally i found this funny and poignant and great. i am an emacs
user, but i am not am emacs bigot. i'm a usability bigot. so i love it
when things like this come up and people point out what is stupid
wrong about the emacs-emperor-with-no-clothes.

Reply | Threaded
Open this post in threaded view
|

Controversial subject of the day: tabs and spaces for indentation

Mike Oxford-2
Convert it all to tabs; there's no sane reason for mixing them.

For emacs users:  %% -*- erlang-indent-level: 4; indent-tabs-mode: nil -*-
For vi users:  modify $HOME/.vimrc to set the width you want

/thread

And toilet-paper is to be placed on the spool with the loose end out over
the top and near the user so it does not lay flat against the wall.



On Wed, Feb 5, 2014 at 11:04 AM, Raoul Duke <raould> wrote:

> > I guess Emacs does not allow indentation to be anything other than
> horrible.
> > Every time I've brought it up there is whining about some precious little
> > elisp file that can't handle the change.
> > I've gotten harassed on the number of '%' comment characters I'm
> supposed to
> > use for different context .. otherwise Emacs just explodes .. or
> something.
> > Ok, so perhaps I'm being a bit dramatic here =)
>
> personally i found this funny and poignant and great. i am an emacs
> user, but i am not am emacs bigot. i'm a usability bigot. so i love it
> when things like this come up and people point out what is stupid
> wrong about the emacs-emperor-with-no-clothes.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140205/089d5648/attachment.html>

Reply | Threaded
Open this post in threaded view
|

Controversial subject of the day: tabs and spaces for indentation

Magnus Henoch-3
In reply to this post by Ulf Wiger-5
Ulf Wiger <ulf> writes:

> 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)                    

As of Emacs 23, you can specify settings for an entire directory tree by
creating a .dir-locals.el file in the top directory.  It needs to be in
Lisp format, so pay attention to dots and parentheses:

((erlang-mode
  (erlang-indent-level . 4)
  (show-trailing-whitespace . t)
  ;; http://www.emacswiki.org/emacs/TabsSpacesBoth
  (indent-tabs-mode . nil)))

Regards,
Magnus

Reply | Threaded
Open this post in threaded view
|

Controversial subject of the day: tabs and spaces for indentation

Garrett Smith
In reply to this post by Björn-Egil Dahlberg-3
It seems to me that this problem is easily solved by inverting the interests:

- Fix erlang-mode to default to all spaces

- OTP team includes the appropriate Emacs code headers in the source
files (or the dot file in the source root directory as Magnus just
pointed out) and leave them horribly formatted, per their preference

Does this not trivially solve the world's Erlang indent problems?

Garrett

On Wed, Feb 5, 2014 at 1:00 PM, Bj?rn-Egil Dahlberg <egil> wrote:

> This is a war worth winning but it feels like every battle has been a loss
> so far ..
>
> As a member of the OTP-team and the *only* vim user, I can say that the rest
> of OTP has utter disinterest to change the current format. (or so it seems
> anyway =)
>
> I guess Emacs does not allow indentation to be anything other than horrible.
>
> Every time I've brought it up there is whining about some precious little
> elisp file that can't handle the change.
>
> I've gotten harassed on the number of '%' comment characters I'm supposed to
> use for different context .. otherwise Emacs just explodes .. or something.
>
> Ok, so perhaps I'm being a bit dramatic here =)
>
> The truth is that a lot of code in otp is emacs:ified - that is the
> convention. I think it's bad - but i've managed.
>
> Tabs are problematic because code-rendering tools for reviewing code has a
> lot of issues with it. *We should remove them*, but I'll guess hell will
> freeze over well before that happens.
>
> // Bj?rn-Egil
>
>
> On 2014-02-05 19:35, Garrett Smith wrote:
>>
>> On Wed, Feb 5, 2014 at 12:27 PM, Andrew Thompson <andrew>
>> wrote:
>>>
>>> On Wed, Feb 05, 2014 at 07:14:30PM +0100, 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!
>>>
>>> As a vim user, I find the emacs indent mode for erlang incredibly
>>> annoying to 'fake' by hand. I'd love to see the tabs die as mixing tabs
>>> and spaces makes erlang files a horrible mess when your tabstop is not
>>> 8.
>>
>> I'm curious what the argument *for* mixed tabs and spaces is. It is to
>> save precious disk space?
>>
>> Garrett
>>
>> P.S. I agree, going two to three days without religious material on
>> the Erlang list is, well, it's just hard to go back now.
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions
> http://erlang.org/mailman/listinfo/erlang-questions

Reply | Threaded
Open this post in threaded view
|

Controversial subject of the day: tabs and spaces for indentation

Raoul Duke-2
> - Fix erlang-mode to default to all spaces
>
> - OTP team includes the appropriate Emacs code headers in the source
> files (or the dot file in the source root directory as Magnus just
> pointed out) and leave them horribly formatted, per their preference
>
> Does this not trivially solve the world's Erlang indent problems?

<pipe-dream>

i think the general problem is that whatever will be enforced is
enforced by the writer, not by the consumer. formatting should ideally
always be subjective and subjectively controlled. so i can see things
*how i want* (dammit) and *so can you* (even if you swing a different
way when it comes to formatting).

the problem is that tools don't take this perspective, so simple
things like diff end up spitting out horrible answers under such
conditions.

so everybody assumes that we *must* have it be pushed / agreed upon.

all wrong wrong wrong personally i believe.

the tools have to change. the computers have to serve the people, not
the other way around. so any language should have a fundamental markup
version of itself, say some xml schema, and everything is done under
the covers in that format. then when presented to the user it is
converted to their subjective preferred rendering style.

</pipe-dream>

Reply | Threaded
Open this post in threaded view
|

Controversial subject of the day: tabs and spaces for indentation

Vlad Dumitrescu-5
In reply to this post by Garrett Smith
On Wed, Feb 5, 2014 at 8:18 PM, Garrett Smith <g> wrote:
> It seems to me that this problem is easily solved by inverting the interests:
>
> - Fix erlang-mode to default to all spaces
>
> - OTP team includes the appropriate Emacs code headers in the source
> files (or the dot file in the source root directory as Magnus just
> pointed out) and leave them horribly formatted, per their preference
>
> Does this not trivially solve the world's Erlang indent problems?

Unfortunately, no. If I make a patch without emacs, my editor will
still use something else than a mix of tabs and spaces, so it will
have to be OTP-ified by hand (copying indentation from other lines) or
by running it through emacs just for that.

Which, in a funny turn of events, brings me to a question related to
the previous "holy war": can emacs open, reindent and save files in
bach mode? That would indeed help! (even if one would still have to
install emacs).

/Vlad


>
> Garrett
>
> On Wed, Feb 5, 2014 at 1:00 PM, Bj?rn-Egil Dahlberg <egil> wrote:
>> This is a war worth winning but it feels like every battle has been a loss
>> so far ..
>>
>> As a member of the OTP-team and the *only* vim user, I can say that the rest
>> of OTP has utter disinterest to change the current format. (or so it seems
>> anyway =)
>>
>> I guess Emacs does not allow indentation to be anything other than horrible.
>>
>> Every time I've brought it up there is whining about some precious little
>> elisp file that can't handle the change.
>>
>> I've gotten harassed on the number of '%' comment characters I'm supposed to
>> use for different context .. otherwise Emacs just explodes .. or something.
>>
>> Ok, so perhaps I'm being a bit dramatic here =)
>>
>> The truth is that a lot of code in otp is emacs:ified - that is the
>> convention. I think it's bad - but i've managed.
>>
>> Tabs are problematic because code-rendering tools for reviewing code has a
>> lot of issues with it. *We should remove them*, but I'll guess hell will
>> freeze over well before that happens.
>>
>> // Bj?rn-Egil
>>
>>
>> On 2014-02-05 19:35, Garrett Smith wrote:
>>>
>>> On Wed, Feb 5, 2014 at 12:27 PM, Andrew Thompson <andrew>
>>> wrote:
>>>>
>>>> On Wed, Feb 05, 2014 at 07:14:30PM +0100, 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!
>>>>
>>>> As a vim user, I find the emacs indent mode for erlang incredibly
>>>> annoying to 'fake' by hand. I'd love to see the tabs die as mixing tabs
>>>> and spaces makes erlang files a horrible mess when your tabstop is not
>>>> 8.
>>>
>>> I'm curious what the argument *for* mixed tabs and spaces is. It is to
>>> save precious disk space?
>>>
>>> Garrett
>>>
>>> P.S. I agree, going two to three days without religious material on
>>> the Erlang list is, well, it's just hard to go back now.
>>> _______________________________________________
>>> erlang-questions mailing list
>>> erlang-questions
>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>
>>>
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions
>> http://erlang.org/mailman/listinfo/erlang-questions
> _______________________________________________
> erlang-questions mailing list
> erlang-questions
> http://erlang.org/mailman/listinfo/erlang-questions

Reply | Threaded
Open this post in threaded view
|

Controversial subject of the day: tabs and spaces for indentation

Garrett Smith
On Wed, Feb 5, 2014 at 1:24 PM, Vlad Dumitrescu <vladdu55> wrote:

> On Wed, Feb 5, 2014 at 8:18 PM, Garrett Smith <g> wrote:
>> It seems to me that this problem is easily solved by inverting the interests:
>>
>> - Fix erlang-mode to default to all spaces
>>
>> - OTP team includes the appropriate Emacs code headers in the source
>> files (or the dot file in the source root directory as Magnus just
>> pointed out) and leave them horribly formatted, per their preference
>>
>> Does this not trivially solve the world's Erlang indent problems?
>
> Unfortunately, no. If I make a patch without emacs, my editor will
> still use something else than a mix of tabs and spaces, so it will
> have to be OTP-ified by hand (copying indentation from other lines) or
> by running it through emacs just for that.
>
> Which, in a funny turn of events, brings me to a question related to
> the previous "holy war": can emacs open, reindent and save files in
> bach mode? That would indeed help! (even if one would still have to
> install emacs).

This seems like a problem that can be confined to the OTP team and
process, which is I think is a pretty small subset of all erlang-mode
users, no? And changing erlang-mode to default to spaces doesn't make
this worse does it?

Garrett

Reply | Threaded
Open this post in threaded view
|

Controversial subject of the day: tabs and spaces for indentation

Vlad Dumitrescu-5
On Wed, Feb 5, 2014 at 8:27 PM, Garrett Smith <g> wrote:

> On Wed, Feb 5, 2014 at 1:24 PM, Vlad Dumitrescu <vladdu55> wrote:
>> On Wed, Feb 5, 2014 at 8:18 PM, Garrett Smith <g> wrote:
>>> It seems to me that this problem is easily solved by inverting the interests:
>>> - Fix erlang-mode to default to all spaces
>>> - OTP team includes the appropriate Emacs code headers in the source
>>> files (or the dot file in the source root directory as Magnus just
>>> pointed out) and leave them horribly formatted, per their preference
>>>
>>> Does this not trivially solve the world's Erlang indent problems?
>>
>> Unfortunately, no. If I make a patch without emacs, my editor will
>> still use something else than a mix of tabs and spaces, so it will
>> have to be OTP-ified by hand (copying indentation from other lines) or
>> by running it through emacs just for that.
>>
>> Which, in a funny turn of events, brings me to a question related to
>> the previous "holy war": can emacs open, reindent and save files in
>> bach mode? That would indeed help! (even if one would still have to
>> install emacs).
>
> This seems like a problem that can be confined to the OTP team and
> process, which is I think is a pretty small subset of all erlang-mode
> users, no? And changing erlang-mode to default to spaces doesn't make
> this worse does it?

You are right, it's better like you suggested and definitely a step in
the right direction. But I think that most Erlang projects are more
lenient regarding whitespace mismatches in patches (being much
smaller) and thus the project where it hurts the most to be
non-compliant is not going to be affected. Yet.

/Vlad

Reply | Threaded
Open this post in threaded view
|

Controversial subject of the day: tabs and spaces for indentation

Fred Hebert
In reply to this post by Andrew Thompson-3
I tended to solve that problem by opening a file, automatically
substituting a tab by 8 spaces (:%s/\t/        /g) and doing the
opposite at the end of my editing session (:%s/        /\t/g).

Nobody on the OTP team has yelled at me so far, so I kept doing that
whenever I played around that code base.

-Fred.

On 02/05, Andrew Thompson wrote:

> On Wed, Feb 05, 2014 at 07:14:30PM +0100, 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!
>
> As a vim user, I find the emacs indent mode for erlang incredibly
> annoying to 'fake' by hand. I'd love to see the tabs die as mixing tabs
> and spaces makes erlang files a horrible mess when your tabstop is not
> 8.
>
> Andrew
> _______________________________________________
> erlang-questions mailing list
> erlang-questions
> http://erlang.org/mailman/listinfo/erlang-questions

Reply | Threaded
Open this post in threaded view
|

Controversial subject of the day: tabs and spaces for indentation

kraythe .
In reply to this post by Vlad Dumitrescu-5
Actually the solution to this age old debate was proposed to me by a friend
of mine and its genius on a number of levels but isn't implemented
anywhere.  The reality is that for most languages whitespace is irrelevant
so it shouldn't be the code holding the indentation but the user's
preference file. Imagine a source code repository where there is NO
irrelevant whitespace in the code base. For java, for example, there would
be literally only one single line of code. Now when you check out you have
a preference file that says you want tabs or spaces or mixed and also
defines the other formatting you prefer. When you check out the system
reformats the code according to your specs dynamically. When you commit, it
strips your code of whitespace before comparing.

Now that would rock. Not just for tabs but the other code holy wars like
drop braces and so onl

*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
<http://www.linkedin.com/pub/robert-simmons/40/852/a39>*


On Wed, Feb 5, 2014 at 2:21 PM, kraythe . <kraythe> wrote:

> Actually the solution to this age old debate was proposed to me by a
> friend of mine and its genius on a number of levels but isn't implemented
> anywhere.  The reality is that for most languages whitespace is irrelevant
> so it shouldn't be the code holding the indentation but the user's
> preference file. Imagine a source code repository where there is NO
> irrelevant whitespace in the code base. For java, for example, there would
> be literally only one single line of code. Now when you check out you have
> a preference file that says you want tabs or spaces or mixed and also
> defines the other formatting you prefer. When you check out the system
> reformats the code according to your specs dynamically. When you commit, it
> strips your code of whitespace before comparing.
>
> Now that would rock. Not just for tabs but the other code holy wars like
> drop braces and so onl
>
> *Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
> *Author of: Hardcore Java (2003) and Maintainable Java (2012)*
> *LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
> <http://www.linkedin.com/pub/robert-simmons/40/852/a39>*
>
>
> On Wed, Feb 5, 2014 at 1:33 PM, Vlad Dumitrescu <vladdu55>wrote:
>
>> On Wed, Feb 5, 2014 at 8:27 PM, Garrett Smith <g> wrote:
>> > On Wed, Feb 5, 2014 at 1:24 PM, Vlad Dumitrescu <vladdu55>
>> wrote:
>> >> On Wed, Feb 5, 2014 at 8:18 PM, Garrett Smith <g> wrote:
>> >>> It seems to me that this problem is easily solved by inverting the
>> interests:
>> >>> - Fix erlang-mode to default to all spaces
>> >>> - OTP team includes the appropriate Emacs code headers in the source
>> >>> files (or the dot file in the source root directory as Magnus just
>> >>> pointed out) and leave them horribly formatted, per their preference
>> >>>
>> >>> Does this not trivially solve the world's Erlang indent problems?
>> >>
>> >> Unfortunately, no. If I make a patch without emacs, my editor will
>> >> still use something else than a mix of tabs and spaces, so it will
>> >> have to be OTP-ified by hand (copying indentation from other lines) or
>> >> by running it through emacs just for that.
>> >>
>> >> Which, in a funny turn of events, brings me to a question related to
>> >> the previous "holy war": can emacs open, reindent and save files in
>> >> bach mode? That would indeed help! (even if one would still have to
>> >> install emacs).
>> >
>> > This seems like a problem that can be confined to the OTP team and
>> > process, which is I think is a pretty small subset of all erlang-mode
>> > users, no? And changing erlang-mode to default to spaces doesn't make
>> > this worse does it?
>>
>> You are right, it's better like you suggested and definitely a step in
>> the right direction. But I think that most Erlang projects are more
>> lenient regarding whitespace mismatches in patches (being much
>> smaller) and thus the project where it hurts the most to be
>> non-compliant is not going to be affected. Yet.
>>
>> /Vlad
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140205/3567ab4a/attachment.html>

Reply | Threaded
Open this post in threaded view
|

Controversial subject of the day: tabs and spaces for indentation

Vlad Dumitrescu-5
On Wed, Feb 5, 2014 at 9:21 PM, kraythe . <kraythe> wrote:

> Actually the solution to this age old debate was proposed to me by a friend
> of mine and its genius on a number of levels but isn't implemented anywhere.
> The reality is that for most languages whitespace is irrelevant so it
> shouldn't be the code holding the indentation but the user's preference
> file. Imagine a source code repository where there is NO irrelevant
> whitespace in the code base. For java, for example, there would be literally
> only one single line of code. Now when you check out you have a preference
> file that says you want tabs or spaces or mixed and also defines the other
> formatting you prefer. When you check out the system reformats the code
> according to your specs dynamically. When you commit, it strips your code of
> whitespace before comparing.

Absolutely, this would fix it. But we don't have tools that can handle
that yet and I fear that implementing those and convincing people to
use them would take longer than agreeing on a saner alternative for
whitespace.

regards,
Vlad


> Now that would rock. Not just for tabs but the other code holy wars like
> drop braces and so onl
>
> Robert Simmons Jr. MSc. - Lead Java Architect @ EA
> Author of: Hardcore Java (2003) and Maintainable Java (2012)
> LinkedIn: http://www.linkedin.com/pub/robert-simmons/40/852/a39
>
>
> On Wed, Feb 5, 2014 at 2:21 PM, kraythe . <kraythe> wrote:
>>
>> Actually the solution to this age old debate was proposed to me by a
>> friend of mine and its genius on a number of levels but isn't implemented
>> anywhere.  The reality is that for most languages whitespace is irrelevant
>> so it shouldn't be the code holding the indentation but the user's
>> preference file. Imagine a source code repository where there is NO
>> irrelevant whitespace in the code base. For java, for example, there would
>> be literally only one single line of code. Now when you check out you have a
>> preference file that says you want tabs or spaces or mixed and also defines
>> the other formatting you prefer. When you check out the system reformats the
>> code according to your specs dynamically. When you commit, it strips your
>> code of whitespace before comparing.
>>
>> Now that would rock. Not just for tabs but the other code holy wars like
>> drop braces and so onl
>>
>> Robert Simmons Jr. MSc. - Lead Java Architect @ EA
>> Author of: Hardcore Java (2003) and Maintainable Java (2012)
>> LinkedIn: http://www.linkedin.com/pub/robert-simmons/40/852/a39
>>
>>
>> On Wed, Feb 5, 2014 at 1:33 PM, Vlad Dumitrescu <vladdu55>
>> wrote:
>>>
>>> On Wed, Feb 5, 2014 at 8:27 PM, Garrett Smith <g> wrote:
>>> > On Wed, Feb 5, 2014 at 1:24 PM, Vlad Dumitrescu <vladdu55>
>>> > wrote:
>>> >> On Wed, Feb 5, 2014 at 8:18 PM, Garrett Smith <g> wrote:
>>> >>> It seems to me that this problem is easily solved by inverting the
>>> >>> interests:
>>> >>> - Fix erlang-mode to default to all spaces
>>> >>> - OTP team includes the appropriate Emacs code headers in the source
>>> >>> files (or the dot file in the source root directory as Magnus just
>>> >>> pointed out) and leave them horribly formatted, per their preference
>>> >>>
>>> >>> Does this not trivially solve the world's Erlang indent problems?
>>> >>
>>> >> Unfortunately, no. If I make a patch without emacs, my editor will
>>> >> still use something else than a mix of tabs and spaces, so it will
>>> >> have to be OTP-ified by hand (copying indentation from other lines) or
>>> >> by running it through emacs just for that.
>>> >>
>>> >> Which, in a funny turn of events, brings me to a question related to
>>> >> the previous "holy war": can emacs open, reindent and save files in
>>> >> bach mode? That would indeed help! (even if one would still have to
>>> >> install emacs).
>>> >
>>> > This seems like a problem that can be confined to the OTP team and
>>> > process, which is I think is a pretty small subset of all erlang-mode
>>> > users, no? And changing erlang-mode to default to spaces doesn't make
>>> > this worse does it?
>>>
>>> You are right, it's better like you suggested and definitely a step in
>>> the right direction. But I think that most Erlang projects are more
>>> lenient regarding whitespace mismatches in patches (being much
>>> smaller) and thus the project where it hurts the most to be
>>> non-compliant is not going to be affected. Yet.
>>>
>>> /Vlad
>>> _______________________________________________
>>> erlang-questions mailing list
>>> erlang-questions
>>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions
> http://erlang.org/mailman/listinfo/erlang-questions
>

Reply | Threaded
Open this post in threaded view
|

Controversial subject of the day: tabs and spaces for indentation

Garrett Smith
In reply to this post by kraythe .
On Wed, Feb 5, 2014 at 2:21 PM, kraythe . <kraythe> wrote:

> Actually the solution to this age old debate was proposed to me by a friend
> of mine and its genius on a number of levels but isn't implemented anywhere.
> The reality is that for most languages whitespace is irrelevant so it
> shouldn't be the code holding the indentation but the user's preference
> file. Imagine a source code repository where there is NO irrelevant
> whitespace in the code base. For java, for example, there would be literally
> only one single line of code. Now when you check out you have a preference
> file that says you want tabs or spaces or mixed and also defines the other
> formatting you prefer. When you check out the system reformats the code
> according to your specs dynamically. When you commit, it strips your code of
> whitespace before comparing.
>
> Now that would rock. Not just for tabs but the other code holy wars like
> drop braces and so onl

Heh, not bad. I wonder how something like this might evolve.

Garrett

1234 ... 6