Lacking Natural Simplicity

Random musings on books, code, and tabletop games.

Using the old version of Ada Mode for Emacs

There are a lot of things to like about the Ada programming language; it seems to have a solid core of users, enough to support multiple commercial implementations and a free/libre software implementation that is part of the GNU Compiler Collection. I occasionally use it myself.

However: I'm sure that the current version of Ada Mode for Emacs (available as an ELPA package, and thus not included in Emacs itself), which provides smart editing for the Ada programming language, and uses an external parser for the indentation, fontification1, and navigation engine, is wonderful if you can get it working, but I have never been able to get it to work. My most recent try was today on Fedora 36 using GNAT 12.1.1 20220507 (Red Hat 12.1.1-1).

Here's what happened when I tried to build the Ada code for the parser, which is supplied as part of the ada-mode:

$ ./
ada_mode_wisi_parse.gpr:44:26: warning: object directory "obj" not found
   [mkdir]        object directory for project Ada_Mode_Wisi_Parse
   [Ada]          gpr_query.adb
   [C]            wisitoken_grammar_re2c.c
   [C]            ada_re2c.c
   [C]            gpr_re2c.c
   [Ada]          ada_process_actions.adb
   [Ada]          ada_process_lr1_main.adb
   [Ada]          gen_run_wisi_lr_text_rep_parse.adb
   [Ada]          run_wisi_common_parse.adb
   [Ada]          wisi.adb
gnatcoll-sql.adb:742:07: error: ambiguous expression (cannot resolve "Append")
gnatcoll-sql.adb:742:07: error: possible interpretation at, instance at
gnatcoll-sql.adb:742:07: error: possible interpretation at, instance at

   compilation of gpr_query.adb failed

gprbuild: *** compilation phase failed

Sigh. Without the external parser the current Ada Mode is completely unworkable: it doesn't even do indentation correctly, much less do fontification.

However, when I did some Ada work a number of years ago, I was ok with the version that used to be in Emacs itself. So I dug it out of the Emacs git repository at Basically, I cloned the git repository and then figured out what commit it was deleted in by doing:

$ git rev-list HEAD -n 1 -- lisp/progmodes/ada-mode.el

Then I checked out the files involved:

$ git checkout a13c64204c8ead966789abf8efe176e4f2d4f599^ lisp/progmodes/ada-mode.el lisp/progmodes/ada-prj.el lisp/progmodes/ada-stmt.el lisp/progmodes/ada-xref.el doc/misc/ada-mode.texi

The ^ at the end of the commit hash says to get the previous commit.

You'll also need doc/docstyle.texi and doc/docstyle.texi if you want to build documentation from ada-mode.texi.

And I've put the files in a zip file for anybody who is in the same situation as I was, along with the generated documentation files .info, .html, and .pdf.

Just put them somewhere on your load-path and add (autoload 'ada-mode "ada-mode") to your emacs config file.

I'm sure the current Ada Mode has a lot more useful features, and I'd love to use it, but this at least lets me edit with automatic indentation, formatting, and fontification.


‘Fontification’ is the process of displaying source code with different font properties (such as color and typeface) for differing syntactic roles. Emacs and many other editors do this to make it easier to distinguish different parts of the source code, to help prevent errors.

Last edited: 2022-07-10 19:23:02 EDT

Print Friendly and PDF


Comments powered by Disqus