Node:Moving Through Ada Code



Moving Through Ada Code

There are several easy to use commands to stroll 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:

M-C-e ada-next-procedure
Move to the next function/procedure/task, which ever comes next.
M-C-a ada-previous-procedure
Move to previous function/procedure/task.
ada-next-package
Move to next package.
ada-prev-package
Move to previous package.
C-c C-a ada-move-to-start
Move to matching start of end. 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), it jumps to the subprogram declaration otherwise.
C-c C-e ada-move-to-end
Move point to end of current block.
C-c o ff-find-other-file
Switch between corresponding spec and body file. If the cursor is on a subprogram, switch between declaration and body.
C-c c-d
Move from any reference to its declaration and switch between declaration and body (for procedures, tasks, private and incomplete types).
C-c C-r ada-find-references
runs the gnatfind command to search for all references to the entity pointed by the cursor. Use 'next-error' function, or C-x `, to visit each reference (as for compilation errors).

These functions use the information in the output of the Gnat Ada compiler. However, if your application was compiled with the -gnatx switch, these functions will not work, since no extra information is generated by GNAT. See GNAT documentation for further information.

Emacs will try to run Gnat for you whenever the cross-reference informations are older than your source file (provided the ada-xref-create-ali variable is non nil). Gnat then produces a file with the same name as the current Ada file but with the extension changed to .ali. This files are normally used by the binder, but they will also contain additional cross-referencing information.