ada-mode-users
[Top][All Lists]
Advanced

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

Re: Selecting a project from the command line


From: Stephen Leake
Subject: Re: Selecting a project from the command line
Date: Sun, 05 Sep 2021 09:04:11 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (windows-nt)

Manuel Gómez <mgrojo@gmail.com> writes:

> Am 1/9/21 um 22:59 schrieb Stephen Leake:
> I'm a bit lost, probably because I didn't express my intention right.
> That snippet runs without errors but I still don't get the full setup:
> C-c C-c asks for the make command.  What I would like to get is the
> same setup as when I choose "Ada | Project Files | Find and select
> Project ...".

Ok. That menu entry runs ada-build-prompt-select-prj-file, in file
ada-build.el.

If that function took a file name argument, you could just call it; I'll
add that for the next release.

Since it doesn't, we have to duplicate it. Which will give you more
control over project-find-functions.

ada-build-prompt-select-prj-file first prompts for the file name, then
does:

(unless (wisi-prj-find-function-set-p)
  (add-hook 'project-find-functions #'wisi-prj-find-dominating-cached)
  (add-hook 'xref-backend-functions #'wisi-prj-xref-backend))

(let ((default-prj
       (ada-prj-default (file-name-nondirectory (file-name-sans-extension 
filename)))))
  (wisi-prj-dtrt-parse-file filename default-prj filename (file-name-directory 
filename)))

The first part automates setting project-find-functions and
xref-backend-functions. Note that it uses
wisi-prj-find-dominating-cached; that (or
wisi-prj-find-dominating-parse) is the key to eliminating the prompt for
the make command.

Using -dominating-cached gives you the Wisi Prj Select menu. Using
-dominating-parse means you can edit the gpr file without having to
invoke wisi-prj-refresh-cache.

So this works:

  (package-initialize)
  (add-hook 'project-find-functions #'wisi-prj-find-dominating-cached)
  (add-hook 'xref-backend-functions #'wisi-prj-xref-backend)
  (wisi-prj-dtrt-parse-file 
"c:/Projects/org.emacs.ada-mode/test/Example_2/hello.gpr"
                            (ada-prj-default "hello")
                            "c:/Projects/org.emacs.ada-mode/test/Example_2/")

The argument to ada-prj-default is the project name that shows in the
Wisi Prj Select menu.

The third arg to wisi-prj-dtrt-parse-file is the "dominating file", in
this case a directory.

>> To set the project file, use the menu command Ada | Project Files |
>> Find and select Project ..., or one of the elisp functions described
>> in (wisi)Selecting Projects.
>
> There are more of these dead references in other parts of the manual
> (both in the built-in info file and in the web):
>
> http://www.nongnu.org/ada-mode/ada-mode.html#Project-files
> http://www.nongnu.org/ada-mode/ada-mode.html#Project-file-overview

That file is for 7.0.1, so it's out of date. And there's no wisi.html,
which is why the wisi links are broken. (sigh; I asked for that file to
be removed because it was for version 4.01; apparently it was updated
with yet another out-dated version!).

The info files installed by M-x list-packages are up-to-date, and the
links should work.

I don't know what you mean by "the built-in info file". There used to be
a file ada-mode.info for version 4.01 installed by emacs, but that
should not be here in recent emacs versions.

-- 
-- Stephe



reply via email to

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