diff options
author | Dan Gudmundsson <[email protected]> | 2018-01-10 16:23:05 +0100 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2018-03-01 14:39:50 +0100 |
commit | 13f1dec0220d44e5178feb52cf076dbdebaa23a0 (patch) | |
tree | 7275f63736cacb3d167404d500026a7b4c18bff4 | |
parent | f0a74dfbaf87f65f6fe7f63fa63965a35fa30faa (diff) | |
download | otp-13f1dec0220d44e5178feb52cf076dbdebaa23a0.tar.gz otp-13f1dec0220d44e5178feb52cf076dbdebaa23a0.tar.bz2 otp-13f1dec0220d44e5178feb52cf076dbdebaa23a0.zip |
emacs: delimiter first in icr works
-rw-r--r-- | lib/tools/emacs/erlang.el | 13 | ||||
-rw-r--r-- | lib/tools/test/emacs_SUITE_data/funcs | 2 | ||||
-rw-r--r-- | lib/tools/test/emacs_SUITE_data/icr | 22 |
3 files changed, 19 insertions, 18 deletions
diff --git a/lib/tools/emacs/erlang.el b/lib/tools/emacs/erlang.el index 08ef83f848..df04e7baff 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.0 +;; Version: 2.8.1 ;; Package-Requires: ((emacs "24.1")) ;; %CopyrightBegin% @@ -84,7 +84,7 @@ "The Erlang programming language." :group 'languages) -(defconst erlang-version "2.8.0" +(defconst erlang-version "2.8.1" "The version number of Erlang mode.") (defcustom erlang-root-dir nil @@ -2827,12 +2827,13 @@ Return nil if inside string, t if in a comment." (let ((base (erlang-indent-find-base stack indent-point off skip))) ;; Special cases (goto-char indent-point) - (cond ((looking-at "\\(end\\|after\\)\\($\\|[^_a-zA-Z0-9]\\)") + (cond ((looking-at "\\(;\\|end\\|after\\)\\($\\|[^_a-zA-Z0-9]\\)") (if (eq (car stack-top) '->) (erlang-pop stack)) - (if stack - (erlang-caddr (car stack)) - 0)) + (cond ((and stack (looking-at ";")) + (+ (erlang-caddr (car stack)) (- erlang-indent-level 2))) + (stack (erlang-caddr (car stack))) + (t off))) ((looking-at "catch\\b\\($\\|[^_a-zA-Z0-9]\\)") ;; Are we in a try (let ((start (if (eq (car stack-top) '->) diff --git a/lib/tools/test/emacs_SUITE_data/funcs b/lib/tools/test/emacs_SUITE_data/funcs index f2c9f44524..877f982005 100644 --- a/lib/tools/test/emacs_SUITE_data/funcs +++ b/lib/tools/test/emacs_SUITE_data/funcs @@ -142,7 +142,7 @@ funs(1) end; (Foo) when is_atom(Foo), is_integer(X) -> - X = 6* 45, + X = 6 * 45, Y = true andalso kalle end), diff --git a/lib/tools/test/emacs_SUITE_data/icr b/lib/tools/test/emacs_SUITE_data/icr index 4be6baba97..8445c1a74d 100644 --- a/lib/tools/test/emacs_SUITE_data/icr +++ b/lib/tools/test/emacs_SUITE_data/icr @@ -30,21 +30,21 @@ indent_if(1, Z) -> if_works end; indent_if(2, Z) -> - %% If (this is broken) + %% If if Z >= 0 -> X = 43 div Z, X - ; Z =< 10 -> + ; Z =< 10 -> 43 div Z - ; Z == 5 orelse + ; Z == 5 orelse Z == 7 -> X = 43 div Z, X - ; is_number(Z), + ; is_number(Z), Z < 32 -> Z - ; true -> + ; true -> if_works end. @@ -74,20 +74,20 @@ indent_case(1, Z) -> foo(X) end; indent_case(2, Z) -> - %% Case (also broken) + %% Case case {Z, foo, bar} of {Z,_,_} -> X = 43 div 4, foo(X) - ; {Z,_,_} when + ; {Z,_,_} when Z =:= 42 -> % line should be indented as a when X = 43 div 4, foo(X) - ; {Z,_,_} + ; {Z,_,_} when Z < 10 -> % when should be indented X = 43 div 4, foo(X) - ; {Z,_,_} + ; {Z,_,_} when % when should be indented Z < 10 % and the guards should follow when andalso % unsure about how though @@ -119,8 +119,8 @@ indent_receive(1) -> receive {Z,_,_} -> X = 43 div 4, - foo(X); - Z -> + foo(X) + ; Z -> X = 43 div 4, foo(X) end, |