[erlang-questions] Indentation of multiline strings

Vlad Dumitrescu <>
Fri Feb 7 17:19:49 CET 2014

On Fri, Feb 7, 2014 at 4:27 PM, Steve Vinoski <> wrote:
> First, let's assume there's general agreement in the community that emacs
> erlang-mode is the de facto standard for erlang code formatting, and is thus
> the starting point for developing a formatting specification. I believe
> you're basing your work on this assumption, Vlad, and if so I agree with
> that approach, but if not please correct me.

That's correct.

> Some might object to using
> erlang-mode as the starting point on the basis that other editors sometimes
> have a hard time formatting code the same way erlang-mode does, but I
> believe most of the OTP team and most of the Erlang community uses emacs and
> erlang-mode, so I view it as the most practical starting point.

Other editors will still have to implement a formatter/indenter. I
think the issues they have today are mostly related to mixing tabs and
spaces, but since Anthony said that his patches only have spaces and
there were no issues, that would simplify it.

> To create a formatting specification, I recommend that if you haven't done
> so already, start collecting cases like the multiline string and binary
> cases where erlang-mode fails, and report them as bugs against erlang-mode.
> Obviously this applies to anyone who wishes to help.

I think that I will start by specifying how erlang-mode indents today.
That would be mostly a case of looking at the test file in the sources
and extract the data by inspection. The vision is to not only specify
an indenter, but even a pretty printer. Here I must credit Tuncer for
starting a discussion with me for a couple of weeks ago.

> To resolve those bugs, we may need to form a small group that can decide how
> erlang-mode should format the problematic cases. A good choice for
> volunteers here are the primary erlang-mode maintainer and some willing
> subset of those who have recently contributed code and patches to
> erlang-mode. As one of those people, I'm willing to help with that, and also
> willing to help resolve the bugs in erlang-mode so it conforms to the
> specification you're putting together.

Great, thanks!

> I assume that during this effort someone -- probably you Vlad, but I know of
> other parties also interested -- would be writing a new tool that also
> conforms to the formatting specification. Having such a tool would give us
> at least two independent implementations of the spec.

Yes, it would be useful to have an Erlang-based tool too. I can use it
from erlide, so I don't need to write anything in Java.

More information about the erlang-questions mailing list