From ad5f78aeaa4b33b6c3e8f50f0af2085d800765f6 Mon Sep 17 00:00:00 2001 From: Tomas Abrahamsson Date: Sat, 11 Feb 2012 21:55:18 +0100 Subject: Fix indentation of record fields in Emacs In some situations, the indentation of record fields in Emacs was strange. This example below shows how Emacs previously would indent two similar pieces of code very differently: some_function_with_a_very_long_name() -> #'a-long-record-name-like-it-sometimes-is-with-asn.1-records'{ field1=a, field2=b}. x() -> #some_record_name{ field1=a, field2=b}. This changes the indentation to be like below for both cases: some_function() -> #some_record{ field1=a, field2=b}. --- lib/tools/emacs/test.erl.indented | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'lib/tools/emacs/test.erl.indented') diff --git a/lib/tools/emacs/test.erl.indented b/lib/tools/emacs/test.erl.indented index 2948ccf1b5..e0593c6522 100644 --- a/lib/tools/emacs/test.erl.indented +++ b/lib/tools/emacs/test.erl.indented @@ -657,3 +657,41 @@ indent_comprehensions() -> foo() -> [#foo{ foo = foo}]. + +%% Record indentation +some_function_with_a_very_long_name() -> + #'a-long-record-name-like-it-sometimes-is-with-asn.1-records'{ + field1=a, + field2=b}, + case dummy_function_with_a_very_very_long_name(x) of + #'a-long-record-name-like-it-sometimes-is-with-asn.1-records'{ + field1=a, + field2=b} -> + ok; + Var = #'a-long-record-name-like-it-sometimes-is-with-asn.1-records'{ + field1=a, + field2=b} -> + Var#'a-long-record-name-like-it-sometimes-is-with-asn.1-records'{ + field1=a, + field2=b}; + #xyz{ + a=1, + b=2} -> + ok + end. + +another_function_with_a_very_very_long_name() -> + #rec{ + field1=1, + field2=1}. + +some_function_name_xyz(xyzzy, #some_record{ + field1=Field1, + field2=Field2}) -> + SomeVariable = f(#'Some-long-record-name'{ + field_a = 1, + 'inter-xyz-parameters' = + #'Some-other-very-long-record-name'{ + field2 = Field1, + field2 = Field2}}), + {ok, SomeVariable}. -- cgit v1.2.3