[Emacs-ada-mode] Thanks and my first enquiry
Stephen Leake
stephen_leake at stephe-leake.org
Sat Aug 19 13:25:57 PDT 2006
"The masked-coder known as Randux" <randux at Safe-mail.net> writes:
> First of all, thank you indeed to Stephen for taking on the task of
> maintaining Ada-mode and for running this mailing list.
You're welcome. It turns out the list pretty much runs itself :).
> I've a very annoying problem with ada-mode. I'm using Emacs 21.4.2,
> running under Linux, using the ada-mode supplied with Emacs from the
> gnu distribution (I think.) (I haven't done anything to add another
> ada-mode, I'm using whatever was supplied in the Slackware
> distribution which tends not to add or change anything from what the
> original devs provided.) Alright then, here's my problem.
>
> 01. C-x f edit program A
> 02. C-c C-c to build program A
> 03. gnatmake is executed, program A is built
> 04. C-x f edit program B
> 05. C-c C-c to build program B
> 06. gnatmake is executed for program A!
>
> Someone (I think it was Markus) suggested creating .adp files for each
> .adb. I tried this and the situation improved in that I was able to
> edit new programs and build them one by one. But as soon as I killed
> the buffer for the last program and tried to modify and rebuild the
> next-to-last program, the error appeared again- gnatmake is issued for
> the wrong module.
>
> Is this a problem with the way I'm using Emacs and ada-mode or is it a
> bug, or both?
Both, I think.
I never compile files this way; more on that later.
ada-compile-application is caching the first compile command, and
issuing it again, even when invoked from the second file. I suspect
this is intentional; the assumption is that there is one main program
per "project", and that is what the command compiles.
The documentation could certainly be improved to say more about how
this is intended to be used.
For stand-alone main programs, such as student homework, there aught
to be an easy to compile just that file, and C-c C-c seems like the
obvious key to invoke it.
So in that sense, I think the current behavior is a bug.
Hmm; in c-mode, C-c C-c is comment-region, and there is no command to
compile just one file. In LaTeX mode, C-c C-f runs TeX on the file. In
texinfo mode, C-c RET C-b runs makeinfo. So there's no consistent
precedent.
Only VHDL mode has a key to run 'make', and no key to run the compiler
on a single file; they got it right :).
The way I compile files (whether Ada, C, LaTeX, texinfo, or VHDL :) is
to use a makefile, and an appropriate project file. In all real
projects, there will be several directories, so a project file is
needed. In addition, the makefile can run unit tests, and build
several different main programs.
I have F5 bound to a lisp function that switches to the current
*compilation* buffer (to be in the right directory), and re-runs the
last 'make' command. That's normally what I want to have happen after
I finish fixing compilation errors. To change compile commands, I
switch to the compilation buffer or a Makefile; from there, F5 prompts
for a compile command. This works for any language I'm compiling; I
don't have to remember different keys for different language modes.
The only times I compile single files is for bug reports, or for
responding to posts on comp.lang.ada. Even then, I use a Makefile,
because it is easier to edit the compiler options to see what effect
they have. The makefile I use for this has a list of common sets of
compiler options.
So in this sense, it's a problem with the way you are using Emacs and
ada-mode.
Can you tell us more about why you are compiling single files? Are
they separate main programs?
What are you used to from other IDEs?
What would you ideally like Emacs to do here?
Comments from anyone else?
--
-- Stephe
PS. the mailing list program says there are 9 people on this list :)
More information about the Emacs-ada-mode
mailing list