[erlang-bugs] Emacs indentation problems

Dániel Szoboszlay dszoboszlay@REDACTED
Mon Jul 13 11:30:46 CEST 2015


Hi,

I found a few issues with erlang.el's indentation. I'm not good enough with
Emacs Lisp to write a fix, but it would be great if someone could do so. :)

The following code was auto-indented with Emacs:

%%% -*- mode: erlang; erlang-indent-level: 2 -*-
-module(foo).
-compile([export_all]).

-record(comma_first, { x
                     , y :: integer() % good indentation
                            , z       % bad indentation (caused by type
spec)
                     }).

try_blocks() ->
  try ok,
       ok % bad indentation
  after
    ok
  end,

  try ok of
      X -> X % bad indentation: erlang-indent-level is 2!
  after
    ok
  end,

  try ok of
      Y -> % bad indentation
      Y    % looks terrible
  after
    ok
  end.

list_comprehensions() ->
  [ok
   || X <- [ 1
           , 2
           , 3] % comma-first indentation works here
        , X > 2 % but not here
  ].

In case email would screw the indentation, here's the same in a gist:
https://gist.github.com/dszoboszlay/bf60b674dadc49c7d999

Cheers,
Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20150713/253767c6/attachment.htm>


More information about the erlang-bugs mailing list