aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorFredrik Gustafsson <[email protected]>2013-08-19 09:21:32 +0200
committerFredrik Gustafsson <[email protected]>2013-08-19 09:21:32 +0200
commit8bfff9e0f80868ad7edc08dfda6c51a2b00966e6 (patch)
tree188d553e7b1d7c0e39a316efce400cb7541f4a80 /lib
parent410bd502e75b22cfa355ffc11eb160360c20bd6f (diff)
parent104c60227d3efea4c858a32c486ee15127d6edbc (diff)
downloadotp-8bfff9e0f80868ad7edc08dfda6c51a2b00966e6.tar.gz
otp-8bfff9e0f80868ad7edc08dfda6c51a2b00966e6.tar.bz2
otp-8bfff9e0f80868ad7edc08dfda6c51a2b00966e6.zip
Merge branch 'mh/line-initial-commas/OTP-11242' into maint
* mh/line-initial-commas/OTP-11242: Inside parentheses, line-initial commas align with the open parenthesis
Diffstat (limited to 'lib')
-rw-r--r--lib/tools/emacs/erlang.el3
-rw-r--r--lib/tools/emacs/test.erl.indented31
-rw-r--r--lib/tools/emacs/test.erl.orig31
3 files changed, 65 insertions, 0 deletions
diff --git a/lib/tools/emacs/erlang.el b/lib/tools/emacs/erlang.el
index f3bc95e3e5..3ecda1d285 100644
--- a/lib/tools/emacs/erlang.el
+++ b/lib/tools/emacs/erlang.el
@@ -2813,6 +2813,9 @@ Return nil if inside string, t if in a comment."
(- (+ previous erlang-argument-indent) 1))))
(t
(nth 2 stack-top))))
+ ((= (following-char) ?,)
+ ;; a comma at the start of the line: line up with opening parenthesis.
+ (nth 2 stack-top))
(t
(goto-char (nth 1 stack-top))
(let ((base (cond ((looking-at "[({]\\s *\\($\\|%\\)")
diff --git a/lib/tools/emacs/test.erl.indented b/lib/tools/emacs/test.erl.indented
index 6c9343f6cb..7e61bcc45b 100644
--- a/lib/tools/emacs/test.erl.indented
+++ b/lib/tools/emacs/test.erl.indented
@@ -700,3 +700,34 @@ some_function_name_xyz(xyzzy, #some_record{
field2 = Field1,
field2 = Field2}}),
{ok, SomeVariable}.
+
+commas_first() ->
+ {abc, [ {some_var, 1}
+ , {some_other_var, 2}
+ , {erlang_ftw, 9}
+ , {erlang_cookie, 'cookie'}
+ , {cmds,
+ [ {one, "sudo ls"}
+ , {one, "sudo ls"}
+ , {two, "sudo ls"}
+ , {three, "sudo ls"}
+ , {four, "sudo ls"}
+ , {three, "sudo ls"}
+ ] }
+ , {ssh_username, "yow"}
+ , {cluster,
+ [ {aaaa, [ {"10.198.55.12" , "" }
+ , {"10.198.55.13" , "" }
+ ] }
+ , {bbbb, [ {"10.198.55.151", "" }
+ , {"10.198.55.123", "" }
+ , {"10.198.55.34" , "" }
+ , {"10.198.55.85" , "" }
+ , {"10.198.55.67" , "" }
+ ] }
+ , {cccc, [ {"10.198.55.68" , "" }
+ , {"10.198.55.69" , "" }
+ ] }
+ ] }
+ ]
+ }.
diff --git a/lib/tools/emacs/test.erl.orig b/lib/tools/emacs/test.erl.orig
index 0f8c4a9175..932758997d 100644
--- a/lib/tools/emacs/test.erl.orig
+++ b/lib/tools/emacs/test.erl.orig
@@ -700,3 +700,34 @@ some_function_name_xyz(xyzzy, #some_record{
field2 = Field1,
field2 = Field2}}),
{ok, SomeVariable}.
+
+commas_first() ->
+ {abc, [ {some_var, 1}
+ , {some_other_var, 2}
+ , {erlang_ftw, 9}
+ , {erlang_cookie, 'cookie'}
+ , {cmds,
+ [ {one, "sudo ls"}
+ , {one, "sudo ls"}
+ , {two, "sudo ls"}
+ , {three, "sudo ls"}
+ , {four, "sudo ls"}
+ , {three, "sudo ls"}
+ ] }
+ , {ssh_username, "yow"}
+ , {cluster,
+ [ {aaaa, [ {"10.198.55.12" , "" }
+ , {"10.198.55.13" , "" }
+ ] }
+ , {bbbb, [ {"10.198.55.151", "" }
+ , {"10.198.55.123", "" }
+ , {"10.198.55.34" , "" }
+ , {"10.198.55.85" , "" }
+ , {"10.198.55.67" , "" }
+ ] }
+ , {cccc, [ {"10.198.55.68" , "" }
+ , {"10.198.55.69" , "" }
+ ] }
+ ] }
+]
+}.