Hello again,

In the same context as my follow-up post, ada-mode 5.0.1 does not
directly support our workflow.  Suppose a developer wants to browse the
sources in the baseline (i.e. multiple read-only directories containing
the sources and, separately, the .ali files) without creating a working
view.  They normally start by find-tag <some_file_or_identifier>; this
opens a read-only source file in a read-only directory.  Now they place
point on an identifier and do ada-goto-declaration: this does not work.

As I found, there are two reasons why it does not work:

1. gnat-run-gnat calls "gnat find -Pproject.gpr" without specifying
the absolute pathname of "project.gpr". In my situation, the generated project file is in /tmp, not in the same directory as the source file. Even in the absence of a generated project file, the top-level project
   file would most probably not be in the same directory as the visited
   file, either.

2. "gnat find" creates temporary files in $TMPDIR but, if TMPDIR is
   unset, it tries to create them in the current, read-only, directory
containing the visited source file. The error reporting and recovery
   from gnat-run-calls in this case is, unfortunately, not very useful
   but I don't see how it could be improved without becoming bloated.

The attached patch solves the first problem; setting TMPDIR is outside
the scope of ada-mode, I think.

(Note that the same problems exist when the user does create a working
view because the working view is initially empty.  Even after the user
checks some files out, they are only ever going to checkout at most 1%
of all source files.  We have a *lot* of source files :) )

--
Ludovic Brenta.
--- gnat-core.el
+++ gnat-core.el
@@ -243,7 +243,7 @@
 Assumes current buffer is (gnat-run-buffer)"
   (let* ((project-file-switch
          (when (ada-prj-get 'gpr_file)
-           (concat "-P" (file-name-nondirectory (ada-prj-get 'gpr_file)))))
+           (concat "-P" (ada-prj-get 'gpr_file))))
         (cmd (append (list command) (list project-file-switch) switches-args)))
 
     (gnat-run "gnat" cmd nil expected-status)
_______________________________________________
Emacs-ada-mode mailing list
[email protected]
http://host114.hostmonster.com/mailman/listinfo/emacs-ada-mode_stephe-leake.org

Reply via email to