Simon Wright <[email protected]> writes:
> The final ‘& “ seconds ago”;’ in the else part gets extra indentation.
> It seems to be the parentheses that cause the problem.
Yes, but it's subtle. All lines are indented by ada-indent-broken
relative to the container of the previous cache. For "Name", that
container is 'raise'. But for " seconds ago", the container is "with".
> The lines before this (‘& Name’, etc) are aligned with the ‘with’,
> should they have ada-indent-broken instead?
They could, but I decided to avoid deep indentations in situations like
this.
I think the simplest solution is to not put a cache on "with", and
change the indentation rule. That fixes this, and doesn't break any
other tests. Patch below.
> raise Constraint_Error
> with "mark '"
> & Name
> & " passed"
> & Duration'Image (Now - End_Of_Wait)
> & " seconds ago";
--
-- Stephe
--- ada-grammar.wy 4115b2ce1598091c40692cf4971dffa1a569c774
+++ ada-grammar.wy 8b6165a01320b5b949e5d5923dd12540fdcbeb89
@@ -1828,9 +1828,10 @@ raise_statement
: RAISE SEMICOLON
(wisi-statement-action 1 'statement-start 2 'statement-end)
| RAISE name WITH expression SEMICOLON
+ ;; no need to tag WITH; that just confuses the indentation logic
(progn
- (wisi-statement-action 1 'statement-start 3 'statement-other 5
'statement-end)
- (wisi-containing-action 3 4))
+ (wisi-statement-action 1 'statement-start 5 'statement-end)
+ (wisi-containing-action 1 4))
| RAISE name SEMICOLON
(wisi-statement-action 1 'statement-start 3 'statement-end)
;
--- ada-wisi.el 39882278079d01299bd748f4505b6ddfb3ecb723
+++ ada-wisi.el eb876d5c5548d3b02af34aa4e7baf28bef5169eb
@@ -1002,12 +1002,6 @@ cached token, return new indentation for
;; 1 =>
(+ (current-column) 1))
- (OF
- ;; ada_mode-nominal.ads
- ;; Anon_Array_2 : array (1 .. 10) of
- ;; Integer;
- (ada-wisi-indent-containing ada-indent-broken cache))
-
(NEW
;; ada_mode-nominal.ads
;; type Limited_Derived_Type_2 is abstract limited new
Private_Type_1 with
@@ -1019,6 +1013,18 @@ cached token, return new indentation for
;; indenting 'Instance'; containing is 'new'
(ada-wisi-indent-containing ada-indent-broken cache))
+ (OF
+ ;; ada_mode-nominal.ads
+ ;; Anon_Array_2 : array (1 .. 10) of
+ ;; Integer;
+ (ada-wisi-indent-containing ada-indent-broken cache))
+
+ (RAISE
+ ;; raise_statement: test/ada_mode-nominal.adb
+ ;; raise Constraint_Error with
+ ;; "help!";
+ (ada-wisi-indent-containing ada-indent-broken cache nil))
+
(WHEN
;; test/ada_mode-parens.adb
;; exit when A.all
@@ -1041,12 +1047,6 @@ cached token, return new indentation for
;; Constant_Indexing => Constant_Reference,
;; indenting 'Constant_Indexing'; point is on 'with'
(+ (current-indentation) ada-indent-broken))
-
- (raise_statement
- ;; raise_statement: test/ada_mode-nominal.adb
- ;; raise Constraint_Error with
- ;; "help!";
- (ada-wisi-indent-containing ada-indent-broken cache nil))
))
;; otherwise just hanging
_______________________________________________
Emacs-ada-mode mailing list
[email protected]
http://host114.hostmonster.com/mailman/listinfo/emacs-ada-mode_stephe-leake.org