Stephen Leake <[email protected]> writes:
> Stephen Leake <[email protected]> writes:
>
>> To investigate further:
>>
>> <snip>
>
> Or we can do a GotoMeeting session, so I can watch you reproduce it.

That won't be necessary; I think the problem was in one of the bugs you
solved.  I reverted my change to gnat-core.el and verified that the
variable 'default-directory' indeed has the value "/tmp", designating
the directory where the project file lives; gnat find uses this project
file all right.

Later, I found out that generating a .gpr project file that extends the
top-level project file was the wrong approach.  As soon as a developer
checks a file out of a lower-level project, gnat find and gnat ls
complain that a source file cannot belong to two projects (one copy of
the file is in the developer's view and belongs to the generated,
extending project, and another copy is in the read-only baseline and
belongs to the baseline project which is not top-level), so navigation
is again broken.  So, I've reverted to generating an Ada mode project
path instead and it seems to work like a charm, so far.

For the record, here is the final lisp I wrote to install the hooks:

(load "highlight-beyond-fill-column")
(add-hook 'ada-mode-hook
          (lambda ()
            (setq fill-column 131)
            (setq highlight-fill-column fill-column)
            (highlight-beyond-fill-column)
            (set (make-local-variable 'compile-command)
                 (format "Pmake %s" (buffer-file-name)))
            (when (not ada-prj-current-file) ; no project file defined yet; 
create one.
              (let ((current-directory (getenv "PWD"))
                    (project-file (make-temp-file "default_" nil ".adp")))
                (save-current-buffer
                  (let ((project-buffer (find-file-noselect project-file)))
                    (set-buffer project-buffer)
                    (insert (concat "src_dir=" current-directory "\n"))
                    (dolist (p (parse-colon-path (getenv "ADA_INCLUDE_PATH")))
                      (if (> (length p) 0) (insert (concat "src_dir=" p "\n"))))
                    (insert (concat "obj_dir=" current-directory "\n"))
                    (dolist (p (parse-colon-path (getenv "ADA_OBJECTS_PATH")))
                      (if (> (length p) 0) (insert (concat "obj_dir=" p "\n"))))
                    (insert (concat "build_dir=" current-directory "\n"))
                    (save-buffer 0)
                    (setq buffer-read-only t)
                    (ada-parse-prj-file project-file)
                    (ada-select-prj-file project-file)
                    (bury-buffer project-buffer)
                    ; Now add a hook to delete the generated project file when 
emacs exits.
                    (add-hook 'kill-emacs-hook
                              (lambda () (delete-file 
ada-prj-current-file)))))))))

I'll wait for ada-mode 5.1.2 before I upgrade :) (right now I'm running
5.0.1, I think).

Thanks for your help!

-- 
Ludovic Brenta.

_______________________________________________
Emacs-ada-mode mailing list
[email protected]
http://host114.hostmonster.com/mailman/listinfo/emacs-ada-mode_stephe-leake.org

Reply via email to