diff options
author | Dan Gudmundsson <dgud@erlang.org> | 2020-02-17 15:00:10 +0100 |
---|---|---|
committer | Dan Gudmundsson <dgud@erlang.org> | 2020-02-17 15:00:10 +0100 |
commit | 07576a4d30acb408f1a8970a53cadb330475df61 (patch) | |
tree | 03f367be5c6958148f09363a22a968786c605027 /lib/tools | |
parent | bd76831ca7cc821012894fa0cd7a0939eb83907b (diff) | |
parent | 146ac36a11345f7f23832920110b250139cff1ab (diff) | |
download | erlang-07576a4d30acb408f1a8970a53cadb330475df61.tar.gz |
Merge branch 'maint'
* maint:
emacs: Fix try indentation
emacs: Improve indentation
Fix uninstall_fallback timing issue
Diffstat (limited to 'lib/tools')
-rw-r--r-- | lib/tools/emacs/erlang.el | 16 | ||||
-rw-r--r-- | lib/tools/test/emacs_SUITE.erl | 3 | ||||
-rw-r--r-- | lib/tools/test/emacs_SUITE_data/type_specs | 24 |
3 files changed, 35 insertions, 8 deletions
diff --git a/lib/tools/emacs/erlang.el b/lib/tools/emacs/erlang.el index 6320bee245..ece6cc30ce 100644 --- a/lib/tools/emacs/erlang.el +++ b/lib/tools/emacs/erlang.el @@ -4,7 +4,7 @@ ;; Author: Anders Lindgren ;; Keywords: erlang, languages, processes ;; Date: 2011-12-11 -;; Version: 2.8.3 +;; Version: 2.8.4 ;; Package-Requires: ((emacs "24.3")) ;; %CopyrightBegin% @@ -87,7 +87,7 @@ "The Erlang programming language." :group 'languages) -(defconst erlang-version "2.8.3" +(defconst erlang-version "2.8.4" "The version number of Erlang mode.") (defcustom erlang-root-dir nil @@ -2889,7 +2889,7 @@ Value is list (stack token-start token-type in-what)." ((looking-at "-type\\s \\|-opaque\\s ") (if stack (forward-char 1) - (erlang-push (list 'icr token (current-column)) stack) + (erlang-push (list 'type token (current-column)) stack) (forward-char 6))) ((looking-at "-spec\\s ") (if stack @@ -2932,7 +2932,7 @@ Value is list (stack token-start token-type in-what)." (erlang-pop stack) (if (and (eq (car (car stack)) 'fun) (or (eq (car (car (last stack))) 'spec) - (eq (car (car (cdr stack))) '::))) ;; -type() + (eq (car (car (last stack))) 'type))) ;; -type() ;; Inside fun type def ') closes fun definition (erlang-pop stack))) ((eq (car (car stack)) 'icr) @@ -2994,7 +2994,9 @@ Return nil if inside string, t if in a comment." (- (+ previous erlang-argument-indent) 1)))) (t (nth 2 stack-top)))) - ((= (following-char) ?,) + ((looking-at "||") + (erlang-indent-element stack-top indent-point token)) + ((memq (following-char) '(?, ?|)) ;; a comma at the start of the line: line up with opening parenthesis. (min (nth 2 stack-top) (erlang-indent-element stack-top indent-point token))) @@ -3032,9 +3034,9 @@ Return nil if inside string, t if in a comment." (save-excursion (goto-char (nth 1 stack-top)) (if (and erlang-icr-indent - (looking-at "\\(if\\|case\\|receive\\)[^_a-zA-Z0-9]")) + (looking-at "\\(if\\|case\\|receive\\|try\\)[^_a-zA-Z0-9]")) (+ (nth 2 stack-top) erlang-icr-indent) - (if (looking-at "\\(case\\|receive\\)[^_a-zA-Z0-9]") + (if (looking-at "\\(case\\|receive\\|try\\)[^_a-zA-Z0-9]") (+ (nth 2 stack-top) erlang-indent-level) (skip-chars-forward "a-z") (skip-chars-forward " \t") diff --git a/lib/tools/test/emacs_SUITE.erl b/lib/tools/test/emacs_SUITE.erl index 42a1f395ec..9a0caa0867 100644 --- a/lib/tools/test/emacs_SUITE.erl +++ b/lib/tools/test/emacs_SUITE.erl @@ -214,11 +214,12 @@ emacs(EmacsCmds) when is_list(EmacsCmds) -> "--directory ", dquote(emacs_dir()), " ", "--eval \"(require 'erlang-start)\" " | EmacsCmds], + io:format("Cmd: ~ts~n", [Cmd]), Res0 = os:cmd(Cmd ++ " ; echo $?"), Rows = string:lexemes(Res0, ["\r\n", $\n]), Res = lists:last(Rows), Output = string:join(lists:droplast(Rows), "\n"), - io:format("Cmd ~ts:~n => ~s ~ts~n", [Cmd, Res, Output]), + io:format(" => ~s ~ts~n", [Res, Output]), "0" = Res, Output. diff --git a/lib/tools/test/emacs_SUITE_data/type_specs b/lib/tools/test/emacs_SUITE_data/type_specs index f9b15d7914..a72e90cf57 100644 --- a/lib/tools/test/emacs_SUITE_data/type_specs +++ b/lib/tools/test/emacs_SUITE_data/type_specs @@ -66,6 +66,30 @@ , b :: any() }. + +-type combined() :: { atom(), + atom() + , integer() + } + | [ atom() | + atom() + | integer() + ]. + +-type a_list1() :: [ atom() | + t() + | tuple() + ]. + + +-type a_list_with_fun() :: + %% ERL-1140 + [ atom() | + fun() + | tuple() + ]. + + %% Spec -spec t1(FooBar :: t99()) -> t99(); |