Stephen Leake <[email protected]> writes:

> Markus Schöpflin <[email protected]> writes:
>
>> Using ada-indent = 3 and ada-indent-broken = 2 I get an (IMHO)
>> incorrect result when indenting the following piece of code:
>>
>>    FOO :=
>>      (FOO => FOO
>>        (FOO => FOO),
>>       BAR => BAR
>>         (BAR => BAR));
>> -------^
>> extra space here
>
> I can reproduce that.

Actually, I think it's the second (Foo that is misindented. I'll add
digits to make things easier to refer to. Consider:

   Foo_1 :=
     (
      Foo_2 => Foo_3
        (Foo_4 => Foo_5),
      Bar_1 => Bar_2
        (Bar_3 => Bar_4));

   Baz_1 := Baz_2
     (1, 2, 3);

   Suzy_1 := Suzy_2 +
     Suzy_3;

I think this is the desired indentation; Foo_3 and Bar_2 are do not
terminate a statement, so the next line is indented by
ada-indent-broken. This ignores the fact that they are function calls
and the next line starts with (.

That's consistent with the indentation of "(1, " and Suzy_3.

However, when we move Foo_2 up a line to just after the ( :

   Foo_1 :=
     (Foo_2 => Foo_3
       (Foo_4 => Foo_5),
      Bar_1 => Bar_2
        (Bar_3 => Bar_4));

(Foo_4 is now indented by ada-indent-broken relative to the opening
paren, which is not what we want. (Bar_3 is ok.

So whenever we indent relative to (current-indentation), we need to
add 1 if the line starts with an open_paren.

Comments?

-- 
-- Stephe

_______________________________________________
Emacs-ada-mode mailing list
[email protected]
http://host114.hostmonster.com/mailman/listinfo/emacs-ada-mode_stephe-leake.org

Reply via email to