[Emacs-ada-mode] Thanks and my first enquiry

Stephen Leake stephen_leake at stephe-leake.org
Tue Aug 22 03:04:31 PDT 2006


"The masked-coder known as Randux" <randux at Safe-mail.net> writes:

> Consider two hello_world programs, A and B, which are just a few
> lines:
>
> with ada.text_io; use ada.text_io
>
> procedure helloa is
>      begin
>           put_line("Hello world, I'm program A!");
> end helloa;
>
> and do likewise for b with procedure and file names modified
> accordingly.
>
> Right, here's the scenario:
>
> 1. Create two hello_world programs, A and B.
> 2. emacs helloa.adb
> 3. C-x C-f hellob.adb
> 4. make some modification to hellob.adb and save C-x C-s
> 5. C-c C-c will now build hellob.adb (as desired)
> 6. C-x k kills buffer hellob.adb and now helloa.adb is current
> 7. make some modification to helloa.adb and save C-x C-s
> 8. C-c C-c will now issue gnatmake on hellob.adb erroneously, instead
> of helloa.adb

I agree this is unexpected behavior, and should be improved.

The issue is "how does Emacs Ada mode know what the 'current main
program' is".

The proper way to invoke gnatmake is to specify the main program,
which may not be the current buffer when C-c C-c is invoked. Thus
Emacs Ada mode has an internal variable that specifies the main
program.

The current behavior is that if that variable is not defined, the
first invocation of C-c C-c sets the variable to the current file.
After that, there doesn't seem to be a way to change it, short of
loading a project file that sets it.

In the scenario above, there aught to be an Emacs Ada mode command on
the Ada menu that says "change the main program to the current file",
which would be step 7.1. That should be fairly easy to implement; I'll
work on it.


Just FYI, when I say "I'll work on it", that means it goes on my list
of things to do, which I get to in my spare time. Which is one or two
hours a week for Emacs Ada mode.

If someone else feels up to providing a patch that does this, that
would be welcome.

-- 
-- Stephe



More information about the Emacs-ada-mode mailing list