Simon Wright <[email protected]> writes:

> This was triggered by the way that C-c C-d on, say,
> Ada.Real_Time.Clock would land you a few lines away from the
> definition in your native RTS rather than the proper definition in
> your target RTS.
>
> It turns out that you can't say
>
>    gnat list -v -P project.gpr
>
> but you need to say e.g.
>
>    arm-eabi-gnat list -v -P project.gpr --RTS=ravenscar-sfp-stm32f4

Makes sense, although it would be nice if RTS was in project.gpr.

> While working on this, I kept on finding that exec-path had lost the
> setting I gave it in ~/.emacs; so I've used
>
>          (target-gnat-exec (locate-file
>                             target-gnat
>                             (split-string (getenv "PATH")
>                             path-separator)))

That works for me; I alwas set PATH and exec-path together. But others
might not. You'll have to keep this as a separate patch until you find
the cause of your problem with exec-path. This should not be the only
place it causes problems.

> Eventually, this can be put into gpr_query, I think, but I got lost in
> there 

gpr_query should be updated for GNAT GPL 2015 before anything else; GPL
2015 gnatcoll.projects supports aggregrate projects.

> so used .prj file settings: e.g.
>
> gpr_file=io_expander.gpr
> target=arm-eabi-
> runtime=ravenscar-sfp-stm32f4
>
> Patch attached. Let us know how you get on!

Why this change:

--- a/ada-gnat-xref.el
+++ b/ada-gnat-xref.el
@@ -154,7 +158,7 @@
            ;; need to set compilation-error-regexp-alist
            )
        (when (ada-prj-get 'gpr_file)
-         (setq cmd (concat cmd " -P" (file-name-nondirectory (ada-prj-get 
'gpr_file)))))
+         (setq cmd (concat cmd " -P" (ada-prj-get 'gpr_file))))
 
        (compilation-start cmd
                           'compilation-mode

gpr_file contains the path of the .gpr file, relative to the .prj file;
it does not need to be in the same directory as the .prj file. But
default-directory at this point is the directory containing the .gpr
file (or at least, it's supposed to be).

Same issue in gnat-core.el gnat-run-gnat.

Otherwise looks good.


> PS - is there a mode for editing .prj/.adp files?

No. I suppose it could highlight things before/after '=', and comments.

> +                      (if (ada-prj-get 'target)
> +                          (ada-prj-get 'target)
> +                        "")

This can be done more efficiently:

(or (ada-prj-get 'target) "")


-- 
-- Stephe

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

Reply via email to