From c8b3e3a977bd8b4071e190c7c7aaa72f934af60a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Szoboszlay?= Date: Fri, 13 May 2016 23:05:23 +0200 Subject: Fix line-initial commas' indentation in type specs Inside type specs, line-initial commas shall align with open curly braces. This also applies to record definitions with type specs for the fields. For example: -type foo() :: { a :: integer() , b :: integer() }. For type specs for functions, the commas shall align with the opening parenthese. So do a closing parenthese when put on a new line. For example: -spec foo( X :: integer() , Y :: integer() ) -> integer(). This does not affect coding styles that don't put commas at the beginning of lines. --- lib/tools/emacs/erlang.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/tools/emacs/erlang.el') diff --git a/lib/tools/emacs/erlang.el b/lib/tools/emacs/erlang.el index 0a3fc0ddff..4f656e3ae4 100644 --- a/lib/tools/emacs/erlang.el +++ b/lib/tools/emacs/erlang.el @@ -2970,8 +2970,9 @@ Return nil if inside string, t if in a comment." (current-column))) ;; Type and Spec indentation ((eq (car stack-top) '::) - (if (looking-at "}") - ;; Closing record definition with types + (if (looking-at "[},)]") + ;; Closing function spec, record definition with types, + ;; or a comma at the start of the line ;; pop stack and recurse (erlang-calculate-stack-indent indent-point (cons (erlang-pop stack) (cdr state))) -- cgit v1.2.3