[Emacs-ada-mode] procedure Test is null;

Stephen Leake stephen_leake at stephe-leake.org
Mon May 4 14:24:03 PDT 2009


"georg at w3x.org" <georg at w3x.org> writes:

> As you know, it is possible to write something like
>
>     procedure Test is null;
>
> which works without problems.

By "works", I gather you mean the Emacs Ada mode indentation code
handles it.

> However, it is then possible to write the following:
>
> procedure Test is
>    procedure Test2 is null;   
> begin
>    -- something else
> end Test;
>
> However, when pressing Enter right after "end Test;" I get the 
> message "Matching defun has different name: Test2" and cannot type anything 
> more...

I can reproduce this; you can type characters, but not Enter.

Even if you put in an entire new procedure:
procedure Test is
   procedure Test2 is null;
begin
   -- something else
end Test;
procedure Test1 is begin end Test1;

it still gets confused.

Hmm. Is this really a useful use case? I guess if you are
instantiating a generic, or have a local tagged type, this could
happen.

As a workaround you can change it to:

procedure Test is
   procedure Test2 is 
   begin
      null;   
   end Test2;
begin
   -- something else
end Test;

(Just pretend it's still Ada 95 :)

I'm not up to working on a real fix just now; that code can be pretty
hairy. I'll have to teach it that "is null" can be the end of a
procedure. or maybe that "procedure Test2 is null;" is _not_ the
start of a procedure. I might have time later this week.

> Thank you very much for maintaining/further developing ada-mode!

You're welcome; it's nice to be appreciated.

-- 
-- Stephe



More information about the Emacs-ada-mode mailing list