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

Andrzej Śliwa andrzej.sliwa@REDACTED
Thu Feb 6 13:22:11 CET 2014


Here is my script for re-indent: https://github.com/andrzejsliwa/vimfiles/blob/master/emacs_indent.sh
I used it before switch to Emacs.

it also using emacs in batch mode, and trying guess correct path to emacs-mode (for linux and macosx)
this script was base for reformat in intellij-erlang for emacs way formatting.

Best Regards,
Andrzej
On 6 Feb 2014 at 12:35:28, Vlad Dumitrescu (vladdu55@REDACTED) wrote:


On 6 Feb 2014 12:27, "Bengt Kleberg" <bengt.kleberg@REDACTED> wrote:
>
> Greetings,
>
> These are my opinions, not facts.
>
> Does your "erl-indent" program format according to the current OTP style
> guide? It would be very good if that was the case.

It uses erlang - mode to indent. I certainly assume that it uses the style recommended by otp.

Not all otp source files are idempotent under the indentation, so it might mean that not all are following the otp style.

/vlad

>
> bengt
>
> On Thu, 2014-02-06 at 10:43 +0100, Vlad Dumitrescu wrote:
> > 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
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@REDACTED
> > http://erlang.org/mailman/listinfo/erlang-questions
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
_______________________________________________  
erlang-questions mailing list  
erlang-questions@REDACTED  
http://erlang.org/mailman/listinfo/erlang-questions  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140206/b4fe5a23/attachment.htm>


More information about the erlang-questions mailing list