Next: , Previous: Compiling Examples, Up: Top

7 Moving Through Ada Code

There are several easy to use commands to navigate through Ada code. All these functions are available through the Ada menu, and you can also use the following key bindings or the command names. Some of these menu entries are available only if the GNAT compiler is used, since the implementation relies on the GNAT cross-referencing information.

M-C-e
Move to the next function/procedure/task, which ever comes next (ada-next-procedure).
M-C-a
Move to previous function/procedure/task (ada-previous-procedure).
M-x ada-next-package
Move to next package.
M-x ada-previous-package
Move to previous package.
C-c C-a
Move to matching start of end (ada-move-to-start). If point is at the end of a subprogram, this command jumps to the corresponding begin if the user option ada-move-to-declaration is nil (default), otherwise it jumps to the subprogram declaration.
C-c C-e
Move point to end of current block (ada-move-to-end).
C-c o
Switch between corresponding spec and body file (ff-find-other-file). If point is in a subprogram, position point on the corresponding declaration or body in the other file.
C-c c-d
Move from any reference to its declaration, for from a declaration to its body (for procedures, tasks, private and incomplete types).
C-c C-r
Runs the gnatfind command to search for all references to the identifier surrounding point (ada-find-references). Use C-x ` (next-error) to visit each reference (as for compilation errors).

If the ada-xref-create-ali variable is non-nil, Emacs will try to run GNAT for you whenever cross-reference information is needed, and is older than the current source file.