[Emacs-ada-mode] [patch] Surround project file name with double-quotes

Ludovic Brenta ludovic at ludovic-brenta.org
Thu Nov 15 01:47:35 PST 2007


Stephen Leake <stephen_leake at stephe-leake.org> writes:

> Ludovic Brenta <ludovic at ludovic-brenta.org> writes:
>
>> On windows, my project files are in C:\Documents and Settings\... and
>> the default compile and gnat find commands (C-u C-c C-c and C-r C-r
>> respectively) fail because the command launched cannot find the project
>> file.  The fix is to surround the project file name with double-quote
>> characters, e.g. gnatmake -P"C:\Documents and Settings\...\f.gpr".
>> The patch below does this unconditionally because the double-quote
>> characters are harmless even if they are not necessary.
>
> Right. There are a couple other uses of the project file as well.
>
>> another fix in this patch is the use of the variable ada-gnat-cmd
>> instead of hardcoded "gnat" in "gnat find".  This is handy when you
>> don't have a native GNAT installed but only a cross gnat, e.g.
>> powerpc-wrs-vxworks-gnat.
>
> That makes sense in general, but it violates the intended use of this
> variable, which is to allow "gnatpath" to replace "gnat" when parsing
> project files. Obviously, the name of the variable could be improved
> :(. I don't want to change it, though, since that would break current
> setups. 

I believe Emacs Lisp allows you to override the value of the variable
locally in the defun where you call gnatpath.  Or else, you might as
well hardcode "gnatpath" in that defun, right?

> I gather you are not using gnatpath; have you tried it? I find it to
> be _much_ faster than 'gnat list'. Hmm. I just tried to reproduce
> that, and the difference seems smaller on this machine, but still
> noticeable. It is very noticeable on the Lynx boxes I use at work. One
> of these days, I'll get around to asking AdaCore to implement an
> option for 'gnat list' that does exactly what we need.

No, I never used gnatpath.  I open one project and, yes, the parsing
using "gnat list" is a bit slow, but I don't care because I then leave
emacs running for days on end with that one project open.

> Back to your issue of specifying the gnat executable name; you should
> set the 'cross-prefix' Emacs project file variable, and then I should
> fix ada-xref.el to use it more consistently (just done in my version).

Ah, thanks.  But a fix is still needed in ada-find-any-references to
take advantage of the cross-prefix.  However I do not use Emacs
project files at all, only .gpr files.  How can I set cross-prefix?  I
do not see it defined as a variable, only as a property in the project
and AFAICT the only way to set it, currently, is by means of an Emacs
project file.

> A couple weeks ago, I fixed 'ada-make-body-gnatstub' to use project
> files; I'll post a new version with all these changes.

Thanks!

-- 
Ludovic Brenta.




More information about the Emacs-ada-mode mailing list