diff options
Diffstat (limited to 'lib/tools/emacs')
-rw-r--r-- | lib/tools/emacs/Makefile | 3 | ||||
-rw-r--r-- | lib/tools/emacs/erlang.el | 12 | ||||
-rw-r--r-- | lib/tools/emacs/test.erl.indented | 20 | ||||
-rw-r--r-- | lib/tools/emacs/test.erl.orig | 20 |
4 files changed, 40 insertions, 15 deletions
diff --git a/lib/tools/emacs/Makefile b/lib/tools/emacs/Makefile index 7249263992..0028df247c 100644 --- a/lib/tools/emacs/Makefile +++ b/lib/tools/emacs/Makefile @@ -37,6 +37,9 @@ MAN_FILES= \ tags.3 EMACS_FILES= \ + erlang-skels \ + erlang-skels-old \ + erlang_appwiz \ erlang-start \ erlang-eunit \ erlang diff --git a/lib/tools/emacs/erlang.el b/lib/tools/emacs/erlang.el index da586ee09a..a84f40244d 100644 --- a/lib/tools/emacs/erlang.el +++ b/lib/tools/emacs/erlang.el @@ -2653,7 +2653,8 @@ Value is list (stack token-start token-type in-what)." (cond ((eq (car (car stack)) '\() (erlang-pop stack) (if (and (eq (car (car stack)) 'fun) - (eq (car (car (cdr stack))) '::)) + (or (eq (car (car (last stack))) 'spec) + (eq (car (car (cdr stack))) '::))) ;; -type() ;; Inside fun type def ') closes fun definition (erlang-pop stack))) ((eq (car (car stack)) 'icr) @@ -2874,8 +2875,8 @@ Return nil if inside string, t if in a comment." (+ base erlang-indent-level)) (t (goto-char indent-point) - (cond ((memq (following-char) '(?\( ?{)) - ;; Function application or record. + (cond ((memq (following-char) '(?\( )) + ;; Function application. (+ (erlang-indent-find-preceding-expr) erlang-argument-indent)) ;; Empty line, or end; treat it as the end of @@ -3472,8 +3473,8 @@ Normally used in conjunction with `erlang-beginning-of-clause', e.g.: (erlang-get-function-arrow)))" (and (save-excursion - (re-search-forward "[^-:]*-\\|:" (point-max) t) - (erlang-buffer-substring (- (point) 1) (+ (point) 1))))) + (re-search-forward "->" (point-max) t) + (erlang-buffer-substring (- (point) 2) (+ (point) 1))))) (defun erlang-get-function-arity () "Return the number of arguments of function at point, or nil." @@ -3677,6 +3678,7 @@ non-whitespace characters following the point on the current line." (setq erlang-electric-newline-inhibit nil) (setq erlang-electric-newline-inhibit t) (undo-boundary) + (erlang-indent-line) (end-of-line) (newline) (if (condition-case nil diff --git a/lib/tools/emacs/test.erl.indented b/lib/tools/emacs/test.erl.indented index 1ccced9177..d0ea4c29cf 100644 --- a/lib/tools/emacs/test.erl.indented +++ b/lib/tools/emacs/test.erl.indented @@ -1,20 +1,20 @@ %% -*- erlang -*- %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2009-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %%%------------------------------------------------------------------- @@ -146,6 +146,8 @@ | {'del_member', name(), pid()}, #state{}) -> {'noreply', #state{}}. +-spec all(fun((T) -> boolean()), List :: [T]) -> + boolean() when is_subtype(T, term()). % (*) -spec get_closest_pid(term()) -> Return :: pid() @@ -349,6 +351,14 @@ indent_basics(X, Y, Z) % AD added clause foo. + +indent_nested() -> + [ + {foo, 2, "string"}, + {bar, 3, "another string"} + ]. + + indent_icr(Z) -> % icr = if case receive %% If if Z >= 0 -> diff --git a/lib/tools/emacs/test.erl.orig b/lib/tools/emacs/test.erl.orig index 9b4203120b..70e97a2e91 100644 --- a/lib/tools/emacs/test.erl.orig +++ b/lib/tools/emacs/test.erl.orig @@ -1,20 +1,20 @@ %% -*- erlang -*- %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2009-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %%%------------------------------------------------------------------- @@ -146,6 +146,8 @@ t15(),t20(),t21(), t22(),t25()}. | {'del_member', name(), pid()}, #state{}) -> {'noreply', #state{}}. +-spec all(fun((T) -> boolean()), List :: [T]) -> + boolean() when is_subtype(T, term()). % (*) -spec get_closest_pid(term()) -> Return :: pid() @@ -349,6 +351,14 @@ indent_basics(X, Y, Z) % AD added clause foo. + +indent_nested() -> + [ + {foo, 2, "string"}, + {bar, 3, "another string"} + ]. + + indent_icr(Z) -> % icr = if case receive %% If if Z >= 0 -> |