Ludovic Brenta <ludo...@ludovic-brenta.org> writes:

> Reconstructing from memory as I'm no longer at work, it goes something like:
>
> <snip code>

> The function create-and-select-project-file runs only once, after the
> first Ada file is visited; this file is typically part of the baseline,
> somewhere under /cm/ot/....  The working view might or might not exist
> yet; we do not require a view to browse the baseline.  The function
> creates a GNAT project file under /tmp, parses and selects it as the
> current project file.  (We don't switch projects in an emacs session;
> when working in multiple views, we use multiple emacsen).

I put this code in my .emacs (after fixing a couple bugs). I cannot
reproduce your symptoms; the gnat run buffer always has the proper
default-directory (in the Windows equivalent of /tmp/*). Subsequent
calls to `ada-goto-declaration' run gnat-find, and it finds the project
file.

I'm on Windows, but I don't see why that would affect this.

Making the .adb file that is first opened read-only did not affect
anything.

See gnat-core.el gnat-run-buffer; it sets `default-directory' in the
"gnat run buffer", which is used to run all gnat-find commands. 

To investigate further:

- show me the contents of the gnat run buffer after a 'goto
declaration' fails. The buffer name is " *gnat-run-<project-file-name>*"
(note the leading space).

- set an emacs lisp breakpoint in gnat-core.el gnat-run-buffer (let me
know if you need help with that; I'm assuming you don't). Then open an
Ada mode file, with no project file yet selected. Then report
`default-directory' just before "(get-buffer-create name)", and then
after the "(setq default-directory ...)"

(It seems you could use a "clear project file" entry on the Ada mode
menu?) 

Hmm. Are you on emacs 24.2? I'm testing on 24.3.

--
-- Stephe

_______________________________________________
Emacs-ada-mode mailing list
emacs-ada-m...@host114.hostmonster.com
http://host114.hostmonster.com/mailman/listinfo/emacs-ada-mode_stephe-leake.org

Reply via email to