Next: , Previous: Customization, Up: Customization

3.1 Non-standard file names

By default, Ada mode is configured to use the GNAT file naming convention, where file names are a simple modification of the Ada names, and the extension for specs and bodies are ‘.ads’ and ‘.adb’, respectively.

Ada mode uses the file extensions to allow moving from a package body to the corresponding spec and back.

Ada mode supports a list of alternative file extensions for specs and bodies.

For instance, if your spec and bodies files are called unit_s.ada and unit_b.ada, respectively, you can add the following to your .emacs file:

     (ada-add-extensions "_s.ada" "_b.ada")

You can define additional extensions:

     (ada-add-extensions ".ads" "_b.ada")
     (ada-add-extensions ".ads" ".body")

This means that whenever Ada mode looks for the body for a file whose extension is .ads, it will take the first available file that ends with either .adb, _b.ada or .body.

Similarly, if Ada mode is looking for a spec, it will look for .ads or _s.ada.

If the filename is not derived from the Ada name following the GNAT convention, things are a little more complicated. You then need to rewrite the function ada-make-filename-from-adaname. Doing that is beyond the scope of this manual; see the current definitions in ada-mode.el and ada-xref.el for examples.