From 55e80d74897ec16b80632fd7acdabdca764aea57 Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Thu, 17 Dec 2009 16:56:25 +0100 Subject: More -spec indentation fixes. --- lib/tools/emacs/erlang.el | 29 ++++++++++++++++------------- lib/tools/emacs/test.erl.indented | 16 ++++++++++++++-- lib/tools/emacs/test.erl.orig | 16 ++++++++++++++-- 3 files changed, 44 insertions(+), 17 deletions(-) (limited to 'lib') diff --git a/lib/tools/emacs/erlang.el b/lib/tools/emacs/erlang.el index b352ae7cce..4b8911b758 100644 --- a/lib/tools/emacs/erlang.el +++ b/lib/tools/emacs/erlang.el @@ -4105,19 +4105,22 @@ Return nil if inside string, t if in a comment." (+ 2 (nth 2 stack-top))) ((looking-at "::[^_a-zA-Z0-9]") (nth 2 stack-top)) - (t - (goto-char (nth 1 stack-top)) - (cond ((looking-at "::\\s *\\($\\|%\\)") - ;; Line ends with :: - (+ (erlang-indent-find-preceding-expr 2) - erlang-argument-indent)) - ;; (* 2 erlang-indent-level)) - (t - ;; Indent to the same column as the first - ;; argument. - (goto-char (+ 2 (nth 1 stack-top))) - (skip-chars-forward " \t") - (current-column)))))) + (t + (let ((start-alternativ (if (looking-at "|") 2 0))) + (goto-char (nth 1 stack-top)) + (- (cond ((looking-at "::\\s *\\($\\|%\\)") + ;; Line ends with :: + (if (eq (car (car (last stack))) 'spec) + (+ (erlang-indent-find-preceding-expr 1) + erlang-argument-indent) + (+ (erlang-indent-find-preceding-expr 2) + erlang-argument-indent))) + (t + ;; Indent to the same column as the first + ;; argument. + (goto-char (+ 2 (nth 1 stack-top))) + (skip-chars-forward " \t") + (current-column))) start-alternativ))))) ))) diff --git a/lib/tools/emacs/test.erl.indented b/lib/tools/emacs/test.erl.indented index 1d91b2f155..1a6292d90b 100644 --- a/lib/tools/emacs/test.erl.indented +++ b/lib/tools/emacs/test.erl.indented @@ -51,8 +51,10 @@ -type ann() :: Var :: integer(). -type ann2() :: Var :: - 'return' | 'return_white_spaces' | 'return_comments' - | 'text' | ann(). + 'return' + | 'return_white_spaces' + | 'return_comments' + | 'text' | ann(). -type paren() :: (ann2()). -type t1() :: atom(). @@ -116,6 +118,16 @@ (T :: tuple()) -> R3 :: bar:typen(). -spec mod:t2() -> any(). + +-spec handle_cast(Cast :: {'exchange', node(), [[name(),...]]} + | {'del_member', name(), pid()}, + #state{}) -> {'noreply', #state{}}. + +-spec handle_cast(Cast :: + {'exchange', node(), [[name(),...]]} + | {'del_member', name(), pid()}, + #state{}) -> {'noreply', #state{}}. + -opaque attributes_data() :: [{'column', column()} | {'line', info_line()} | {'text', string()}] | {line(),column()}. diff --git a/lib/tools/emacs/test.erl.orig b/lib/tools/emacs/test.erl.orig index 049fc21286..499961cbb1 100644 --- a/lib/tools/emacs/test.erl.orig +++ b/lib/tools/emacs/test.erl.orig @@ -51,8 +51,10 @@ -type ann() :: Var :: integer(). -type ann2() :: Var :: - 'return' | 'return_white_spaces' | 'return_comments' - | 'text' | ann(). + 'return' + | 'return_white_spaces' + | 'return_comments' + | 'text' | ann(). -type paren() :: (ann2()). -type t1() :: atom(). @@ -116,6 +118,16 @@ t15(),t20(),t21(), t22(),t25()}. (T :: tuple()) -> R3 :: bar:typen(). -spec mod:t2() -> any(). + +-spec handle_cast(Cast :: {'exchange', node(), [[name(),...]]} + | {'del_member', name(), pid()}, + #state{}) -> {'noreply', #state{}}. + +-spec handle_cast(Cast :: + {'exchange', node(), [[name(),...]]} + | {'del_member', name(), pid()}, + #state{}) -> {'noreply', #state{}}. + -opaque attributes_data() :: [{'column', column()} | {'line', info_line()} | {'text', string()}] | {line(),column()}. -- cgit v1.2.3