[Emacs-ada-mode] [Ada-mode] ada-xref.el -- command/function 'ada-find-file'

Stephen Leake stephen_leake at stephe-leake.org
Sat Aug 11 01:29:45 PDT 2007


ESCOUFLAIRE Pierre-Louis <pierre-louis.escouflaire at eurocontrol.int> writes:

> Stephen Leake wrote:
>> ESCOUFLAIRE Pierre-Louis <...> writes:
>>>While using the ada-find-file function released with emacs-22.1, 
>> 
>> There is a mailing list for ada-mode
>> (http://stephe-leake.org/mailman/listinfo/emacs-ada-mode_stephe-leake.org)
>> ; others might be having a similar problem, so it is best to post this
>> sort of thing there.
>> 
>
> Hello,
> I was not aware of it, please accept my apologies.

No problem.

>>>I think that a simple workaround to this is to change the function
>>>'ada-xref-get-src-dir-field' to not concatenate 'nil' strings to the
>>>list by simply adding a test case like shows the following elisp
>>>code:
>> 
>> Are you using Emacs ada-mode project files? With or without GNAT
>> project files?
>> 
>> How are you setting up your list of Ada directories? 
>
> There is no project files (no .adp, no .gpr) and the list of Ada 
> directories is set up through ADA_INCLUDE_PATH and ADA_OBJECTS_PATH 
> environment variables.

Ah. That's a reasonable way to use ada-mode, but I often forget to
test that way :).

> As far as I can see, the call to 'ada-xref-get-project-field' function 
> retrieves the variable 'src_dir' value which is 'nil' according to the 
> algorithm.

Yes. But it should not be `nil' when ada-xref-get-project-field is
called.

There is a mechanism to define default project file values. The
function `ada-require-project-file' looks for a project file; if none
is found, it provides appropriate default values (mostly nil, some
empty strings, etc). It's supposed to be called before any use of
ada-xref-get-project-field.

In this case, the proper patch is to call `ada-require-project-file'
from `ada-do-file-completion'. Then `ada-xref-get-src-dir' will not
return a `nil' in the list.

Here's a patch:

------------------

--- ada-xref.el.~1.34.~	2006-12-14 19:23:15.694852800 -0500
+++ ada-xref.el	2007-08-11 04:04:58.296875000 -0400
@@ -535,6 +535,11 @@
 Completion is attempted in all the directories in the source path, as
 defined in the project file."
   ;; FIXME: doc arguments
+
+  ;; This function is not itself interactive, but it is called as part
+  ;; of the prompt of interactive functions, so we require a project
+  ;; file.
+  (ada-require-project-file)
   (let (list
 	(dirs (ada-xref-get-src-dir-field)))

-------------------


Thanks for your bug report. 

-- 
-- Stephe




More information about the Emacs-ada-mode mailing list