Am 26.09.2013 um 16:25 schrieb Stephen Leake:

> One solution to this is a good template/skeleton package; it would
> insert complete legal syntax, then you modify it.

I have looked at skeleton, with the new parser in mind that could
drive it, on request.

Some of the definitions in ada-stmt.el could be reused, if with a
few modifications. The modifications do not mean at all that the old way
of inserting template text need to go; the changes illustrate one 
possibility of having the parser do the work of knowing names, if possible.

There would be two kinds of skeletons.

1. The first sort of templates could work the old way and insert complete
text that is syntactically correct. The skeletons "ada-package-spec"
and "ada-header-tmpl" are of this sort, in my little draft, that is.
They ask for some names, interactively.

2. The small selection of other templates that I have used for trying
the idea would have the flavor of completion. I have simplified them
WRT use of skeleton language. Thus, when a user has written

  procedure X is

and if the user then requests a template for the subprogram body,
this request should evolve into the call

 (ada-stmt-place-skeleton 'ada-subprogram-body nil '("X"))

where "X" is the name that the parser has seen. Has it, at all?
The NIL indicates a minimal template. Other values will trigger
more expansive additions like an exception handler. (The usual
C-u modifier could be used for the distinction.) If more names
are needed in this case and the parser cannot supply them,
then ada-stmt-place-skeleton will construct dummy names.


Some observations:

There are local variables in each skeleton, but I'm not sure yet
if and when they can be read or written.
Retrieving buffer positions from skeleton.el has been a partial success,
that of the end of inserted seems to fail. These would be good for
triggering indentation of the text inserted, as using `>' from the
template language is not working during insertion, the text
being incomplete.

Recursive use of skeletons loops when placing subskeletons. I guess
that's because I have made interactors (). A workaround is to
quote the subskeletons, as in

  "foo" '(ada-...)

Attachment: ada-stmt.el
Description: Binary data


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

Reply via email to