Last active
August 29, 2015 14:24
-
-
Save dszoboszlay/bf60b674dadc49c7d999 to your computer and use it in GitHub Desktop.
Erlang indentation issues with try blocks and comma-first coding style
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%% -*- 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 | |
]. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'd also add comma first lists of binaries. The element following a binary is indented 4 spaces in Emacs for me.