[Emacs-ada-mode] Default build command is stuck to the first "Compile file" command line
Alexy Khrabrov
deliverable at gmail.com
Sat Nov 17 12:08:17 PST 2007
I'm using gnatmake, etc., installed in /usr/local/ada/bin, and the
latter directory is not on my PATH -- so that GNAT's gcc is not
confused with the system-wide one.
I'd like ada-mode to find it properly. At first I thought I'll just
create a system-wide gnat.adp file, with one line:
cross_prefix=/usr/local/ada/bin/
and then, in my ~/.emacs, will set that as my default project. That
works in the same way as another approach:
(setq gnat-bin-dir "/usr/local/ada/bin")
(setenv "PATH" (concat gnat-bin-dir ":" (getenv "PATH")))
By the way, the following, which I tried before setenv "PATH", didn't
work:
(add-to-list 'exec-path gnat-bin-dir)
-- apparently the commands form ada-mode invoke my shell, zsh,
directly, and its PATH is searched, without any exec-path usage at
all. Thus an elisp question: how do we ensure, instead of just
prepending, that we prepend gnat-bin-dir to PATH only once, when it's
not there already? Is there a standard way to do it with elisp,
similar to the add-to-list function for adding an element to a list
(such as exec-path) just once?
In both cases, I get the same undesirable behavior -- the build
command gets stuck on whatever form it got on the first try. If I
first try to build with C-c C-c, Emacs asks me, "enter command to
compile:" -- I C-g out of it and go to the Ada menu, choose "Compile
file", it compiles the current buffer with gnatmake -o
<current_buffer_filename's basename> ... command line, fails if it's
a package or otherwise not the main procedure, and then every attempt
to run C-c C-c invokes the same command line with that very file's -o
basename, which fails again.
How does Ada Mode knows which is the main procedure, and how are we
supposed to start the compile/build sequence to end up with the
correct C-c C-c?
I unpacked the latest ada-mode, 2007-11-14, and made it first on my
load-path. Do I need any of the other three .el files in addition to
that? They are
ada-mode-patches.el
ada-mode-keys.el
gnat-fix-error.el
I'm using GNU Emacs 22.0.90.1 (i386-apple-darwin8.8.1, Carbon Version
1.6.0)
of 2006-10-28 on petit.local.
BTW, a minor suggestion: when I don't specify the default Ada Mode
project and try editing it with C-c u, and then enter /usr/local/ada/
bin/ into cross_prefix field and hit [Save], I get an error: Wrong
type argument: stringp, nil. Also learned to specify the
cross_prefix with a trailing slash, as it's being concatenated to the
commands without an interceding slash, such as in ${cross_prefix}
gnatmake. Perhaps it's safer to code it up as ${cross_prefix}/
gnatmake in case folks forget to add the trailing slash when editing
the project files.
Cheers,
Alexy
More information about the Emacs-ada-mode
mailing list