[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ada-mode 7.0.1 and .gpr files

From: Stephen Leake
Subject: Re: ada-mode 7.0.1 and .gpr files
Date: Wed, 12 Feb 2020 13:45:24 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (windows-nt)

Ludovic Brenta <address@hidden> writes:

> Hello,
> I have finally gotten around to compiling the new ada-mode
> Ada parser.  Now I'm struggling to integrate the new version
> in our workflow.  Up until ada-mode 6.2, we added an ada-mode
> hook that would determine which .gpr file to use and then call
>  (ada-parse-prj-file prj-file)
>  (ada-select-prj-file prj-file)
> both functions declared in ada-mode.el.  Now, in version 7,
> these functions are no longer there.  

Not quite; they are defined and marked obsolete. They both call
ada-select-prj-file-1 (which only needs to be called once, but is fast
the second time).

Did you get an "obsolete" message, or some other error?

To avoid the "obsolete" messages, study ada-select-prj-file-1, and
adapt the code for your use (possibly just call ada-select-prj-file-1).

On the other hand, you are supposed to use project-find-functions to
determine which project file to use. You will need that set correctly to 
use ada-find-file (C-c C-t or menu Ada | Navigate | Find file in
project), most gpr-query features, and some other things.

(Oops; the menu binding for "find file in project" assumes emacs 27;
change it to ada-find-file for emacs < 27.)

You can use both methods; use your ada-mode-hook function to call
ada-select-prj-file-1 and globally (ie in ~/.emacs) do:

(add-hook 'project-find-functions #'wisi-prj-current-cached 90)

An alternative is to set project-find-functions buffer locally, in the
ada-mode-hook function; that avoids any possible interference with other
modes. On the other hand, it is often useful to have the project set in
non-ada files; project-find-file is then useful from any file in a
project directory (latex, makefile, notes, etc).

You might be able to avoid the ada-mode-hook function by setting
project-find-functions to wisi-prj-cache-dominating, but that has
problems if you use dependent projects (see the ada-mode tutorials, and, for more on this).

You can certainly avoid the ada-mode-hook function if you arrange for
wisi-prj-select-file to be called in some other way; I use Local
Variables in the relevant Makefile.

> Also I am reluctant to re-introduce ada-mode project files;
> I would prefer using only .gpr files, as we do now.  Is this
> possible?


-- Stephe

reply via email to

[Prev in Thread] Current Thread [Next in Thread]