Simon Wright <[email protected]> writes:

> On 11 Jun 2014, at 20:01, Stephen Leake <[email protected]> 
> wrote:
>
>> If you use skeletons for new code, the skeleton inserts "end;" for you.
>> So this is only a problem when editing existing code.
>> 
>> One approach to editing existing code is to type the new syntax skeleton
>> first, then modify the bodies. I am getting used to that process.
>
> This is something I’ve always done, even when indentation had to be
> done by hand (most editors I’ve used support TAB => indent to previous
> line).
>
> I’ve noticed that, when doing this in ada-mode 5, a final TAB will
> sometimes indent the whole block, sometimes not. I haven’t seen the
> pattern yet, though.

Yes; that's deliberate. The trigger for that is whether the last parse
failed; if it did, and the current parse succeeds, the current
statement is indented, rather than the current line (see
ada-indent-statement, which calls wisi-indent-statement).

This does two things; it tells you you've got the syntax right, and it
cleans up the incorrect indentation generated while editing.

The "current statement" is defined by the cache at or before point. So
this works best if point is on a statement keyword ('begin', 'if', 'end'
etc) or ';'.

You can invoke ada-indent-statement at any time with \C-c\C-i.

If you don't get a statement indent when you think you've got the syntax
right, invoke ada-show-parse-error via \C-c\C-f.

-- 
-- Stephe

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

Reply via email to