[Emacs-ada-mode] Teaching ada-mode to ignore embedded SQL statements?

Stephen Leake stephen_leake at stephe-leake.org
Wed Feb 4 16:48:48 PST 2009


Markus Schöpflin <markus.schoepflin at comsoft.de> writes:

> we are using embedded SQL to access a database in Ada. Example pseudo code:
>
> procedure foo
> is
>    exec sql begin declare section;
>       DB_NAME : STRING := "foo";
>    exec sql end declare section;
> begin
>    exec sql connect :DB_NAME session 1;
> end foo;
>
> The problem is that the indentation of ada-mode gets confused by the
> begin/end/declare following the 'exec sql' string, resulting in the
> following indentation:
>
> procedure foo
> is
>    exec sql begin declare section;
>    DB_NAME : STRING := "foo";
>    exec sql end declare section;
>    begin
>       exec sql connect :DB_NAME session 1;
>    end foo;
>
> Is there a way to make ada-mode ignore statements starting with 'exec
> sql' up to the next ';' when indenting?

You might be able to convince Emacs that "exec sql begin" is a
multi-line comment start, and "exec sql end" is the corresponding end;
that's almost what you want.

In general, this is a "multiple languages in one buffer" problem;
there are a couple other solutions floating around, for web stuff.

-- 
-- Stephe



More information about the Emacs-ada-mode mailing list