Emacs ada-mode homepage
- My latest version.
- Ada examples from the current Ada mode manual.
- The current Ada mode manual. The distribution contains this and an Emacs info version.
- My current patches to Ada mode; open for discussion about including in Emacs distribution.
- My bindings, settings, and hooks for using Ada mode; provided as an example.
- Utilities for automatically fixing errors reported by the gnat compiler; proposed addition to Ada mode.
Ada mode 5.0 is ready for pre-release testing. I'm using it in my
daily work. The Wisi indentation engine handles all Ada syntax. It is
very easy to maintain (especially compared to SMIE), although it is
noticeably slow at times.
The SMIE parser is still available, but no longer maintained. It
will not be in the release of Ada mode.
To handle invalid syntax, the Wisi indentation engine falls back to
a trivial algorithm; indent each line the same as the previous. After
enough code has been typed to be legal again, the user can hit `tab'
once to re-indent the current statement. This takes some getting used
to, but I hope the rest of the wisi features are worth it.
Things to do
Significant things left to implement, in priority order.
notes.text in the source code has more detailed info on these.
- automatically fix compiler errors - infrastructure there, slowly adding error messages (on-going)
- Support for a skeleton/template engine
- mouse support
- context menus
- project files on Ada menu
- update user manual
- comp_cmd, make_cmd in project files
- gnatprep symbols (already handles #if, needs $foo)
- improve ada-make-subrogram-body location algorithm
- ada-align-paramlist handle comments?
- ada-align-paramlist handle line wrap?
These are just zipped source files posted here when I feel like
I've reached a significant milestone. The
ada-france monotone repository has up-to-date code.
- tested on Windows and Debian with Emacs 24.3, GNAT 7.1.2.
- Fixed a couple more bugs in OpenToken related to handling
empty productions; seems to be the last of them. All
OpenToken tests pass with GNAT 7.1.2.
- Switched to a different mtn branch for ada-mode wisi
development; org.emacs.ada-mode.stephe-1. The smie parser is
still available, but no longer maintained.
- All Ada mode tests pass with wisi parser; many now failing with smie parser.
- Ada mode with the wisi parser is useful, but noticeably slow
at times. I'm now using it in my daily work.
- Ada mode now supports navigation to the next keyword in a
'function/is/begin/end', 'if/then/else/end' etc.
- Fixed several bugs in OpenToken related to handling empty
productions. All OpenToken test pass with GNAT 7.1.1, GNAT GPL 2012.
- Fixed a major bug in the wisi generalized parser; the pending
actions list was built in reverse order, and had the wrong structure for apply.
- Add more Ada grammar; more Ada indentation tests passing.
- Added workarounds in OpenToken for GNAT GPL 2012, fixed build
process for Debian testing. many OpenToken tests fail with GNAT
GPL 2012, but wisi-generate works, which is enough for Emacs Ada
- The structure stored in wisi cache text properties is
changed; it now stores both the token and the nonterminal
symbol (if any). This simplifies some of the indentation
- ada-wisi is now using the wisi parser, and passes more tests.
OpenToken is used as the grammar compiler; it can now read a Bison
style input file, and generate Elisp source code. Other stuff:
- ada-adjust-case-identifier enforces lowercase
- fixed align of 'at' in record representation clauses.
- more error messages handled in ada-gnat-fix-error
- ada-gnat-fix-error prompts user for alternate fixes to "is not visible" and "possible misspelling".
- ada-gnat-compilation-filter handles two secondary refs on one line.
- misc other bugs
- gpr-mode is finished, using the wisent parser. ada-wisi started,
handles ada_mode-generic_package.ads, some other test code. Got far
enough to know it will definitely be easier to maintain than
ada-smie. Other stuff:
- ada-fix-error is now an alist of hooks, so the user can
add local fixing functions.
- Added ada-show-references, to find all references to a
- test/Makefile moved to build/smie/Makefile, added build/wisi/Makefile
- better add-log integration for ada-mode
- fixed a bug in the wisent grammar compiler (the curse of
free software; you can fix it, and you have to fix it!)
- Started working on gpr-mode, using the wisent parser. There's
nothing in org.emacs.ada-mode yet, just stuff in
org.opentoken.stephe. I'm using Ada mode 5.0 to write the Ada code
to read a Bison input file and output OpenToken source code that
then outputs elisp for the parser tables. In the process, found and
fixed many Ada mode 5.0 bugs/missing features:
- Fixed bugs in ada-align, ada-find-other-file, ada-case-adjust, nested aggregates.
- Add ada-fix-error infrastructure, and several messages
(all that were handled in 4.01 need minor fixing for 5.0).
- Handle secondary file references in GNAT compiler messages (ada-show-secondary-error)
- improve ada-format-paramlist; handles in | out | in out | [not null] access [constant | protected]
- handle Ada quantified expressions. The only remaining 2012 syntax is aspects.
- Add ada-make-subprogram-body, ada-make-package-body
- Add ada-next/prev-statement-keyword; moves from 'if' to
'then' to 'else', or 'procedure' to 'is' to 'begin' etc.
- Ported back to Emacs 23.4; I'm using 24.3 pretests for development.
- Implemented project files, ada-goto-declaration, automatic
casing, format parameter list. New option ada-indent-comment-col-0.
Handle uppercase keywords. Fixed several bugs.
I've started using this for editing real Ada code. It's useable,
but there is a lot missing. Top on list is automatically fixing
compiler errors; it's amazing how much I miss that :).
- Tested against my GDS code, fixed all bugs found by that. See
test/test-indent-5.0.sh to run an indentation test on your code. For example, I run this as:
./test-indent-5.0.sh $GDS_ROOT/main_lynx_5/common/spacewire /tmp/gds_indent
And then review the results with the Emacs command
I found that a lot of my code did not follow Ada mode 4.01
indentation. In addition, I found several more bugs in Ada mode
4.01, that are fixed in Ada mode 5.0. So Ada mode 5.0 is not
strictly backward-compatible with Ada mode 4.01 for indentation, but
it is mostly compatible.
- Another significant clean up. Block and loop labels respect
ada-indent-label, comments meet ada-mode 4.01, cache bugs fixed.
- Significant clean up. Block statements, if statements now working.
- I've made a lot of progress in learning how SMIE works, and how
best to use it for Ada code. I've got a design that I believe is
stable; lately I've been tweaking and adding new syntax, rather
than redesigning every time I add something. Several of the
indentation test files pass!
So if other people are willing to help, now would be a good time
to start reading the code, and adding the missing features.
- I've played with Emacs SMIE (Simple Minded Indentation Engine,
((info "(elisp)SMIE Grammar"),
SMIE chapter in elisp manual)) for a few days, and it looks
I've stripped out most of the extended features of ada-mode,
and implemented a small subset of the final parser. I'm working
my way thru the indentation tests I have for ada-mode 4.01; so
far the first subtest almost passes (a protected type
declaration, in test/ada-mode.adb) :).
Install GNAT GPL 2012 on Debian
- Download GNAT GPL 2012
- cd ~
- tar zxf gnat-gpl-2012-i686-gnu-linux-libc2.3-bin.tar.gz
- cd gnat-2012-i686-gnu-linux-libc2.3-bin
I recommend installing to /opt/gnat/gpl-2012/.
- In ~/.bash_profile or similar, add:
There are several branches:
- Ada mode 5.0, with smie and wisi indentation engines for Ada, and a wisi
indentation engine for gpr.
- OpenToken extended to produce Elisp source for generalized LALR(1) parser, used by wisi
- Emacs DVC, a front end to several distributed control systems,
including monotone. See my introduction to
monotone with DVC
You can access ada-france read-only, or read-write. These commands
work with mtn 0.48 .. 1.0; you can use the equivalent URL in 1.0:
- anonymous (read only) access
mtn --db ~/monotone-dbs/ada-france.db db init
mtn --db ~/monotone-dbs/ada-france.db --key '' pull www.ada-france.org "org.emacs.*"
- read/write access requires a public key
- send output of 'mtn pubkey' to Ludovic Brenta ludovic at
ludovic dash brenta dot org
- He will add it to the appropriate structures (but he's busy,
and this is low priority, so please be patient).
- mtn --db ~/monotone-dbs/ada-france.db sync www.ada-france.org "org.emacs.*"
- If you are using DVC:
- mtn --db ~/monotone-dbs/ada-france.db automate sync --ticker=count "mtn://www.ada-france.org?org.emacs.*" >> ~/.dvc/sync.basic_io
mailing list, bugs
Subscribe to the Emacs
ada-mode mailing list
Please report bugs both here and to the Emacs bug list.
Put Package: emacs, ada-mode as the first line of the bug message.
my home page
Author : Stephen Leake
Last modified: Sun Feb 17 07:02:04 EST 2013