Next: , Previous: Moving Through Ada Code, Up: Top

8 Identifier completion

Emacs and Ada mode provide two general ways for the completion of identifiers. This is an easy way to type faster: you just have to type the first few letters of an identifiers, and then loop through all the possible completions.

The first method is general for Emacs. It works by parsing all open files for possible completions.

For instance, if the words ‘my_identifier’, ‘my_subprogram’ are the only words starting with ‘my’ in any of the opened files, then you will have this scenario:

     You type:  myM-/
     Emacs inserts:  ‘my_identifier’
     If you press M-/ once again, Emacs replaces ‘my_identifier’ with
     ‘my_subprogram’.
     Pressing M-/ once more will bring you back to ‘my_identifier’.

This is a very fast way to do completion, and the casing of words will also be respected.

The second method (C-<TAB>) is specific to Ada mode and the GNAT compiler. Emacs will search the cross-information for possible completions.

The main advantage is that this completion is more accurate: only existing identifier will be suggested.

On the other hand, this completion is a little bit slower and requires that you have compiled your file at least once since you created that identifier.

C-<TAB>
Complete current identifier using cross-reference information.
M-/
Complete identifier using buffer information (not Ada-specific).