[Top][All Lists]

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

Re: Unified project interface

From: Stephen Leake
Subject: Re: Unified project interface
Date: Thu, 04 Jun 2015 09:40:08 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (windows-nt)

Dmitry Gutov <address@hidden> writes:

> A while ago, there was floated a "unified project root" proposal. I'd
> like to resume that discussion.
> Unfortunately, the code proposed back them doesn't serve the immediate
> need I have in mind: basically, I need that function to return a
> *list* of directories, because both etags and elisp xref backends
> operate on multiple directories, via tags-table-list and load-path
> respectively.
> If we have it, we'll be able to untie `xref-find-regexp' from xref
> backends, because really there's nothing language-specific to this
> command.

The list of directories that xref-find-regexp needs to search is not
the project root; it is the list of directories included by the project
source code.

For that you need a function like "project-source-directories", which
could be customized for each project backend.

I handle this for ada-mode by defining a project file syntax. A project
file defines a list of source directories, among other things. The list
of source directories then gets stored in compilation-search-path.

For ada-mode, project-source-directories would just return

The ada-mode project file can be anywhere; in my projects, it is usually
_not_ at the "project root directory", but down one or two layers in
build/ or build/release/.

I could add "prj_root" to the project file syntax; then ada-mode could
provide a "unified project root" backend that knows what the current
project file is, and returns the value from prj_root. But that would not
be useful in ada-mode; that's why it's not there yet.

The notion of "project root directory" is more useful for configuration
management; typically a config management "project" consists of the tree
of files under one root. But ada-mode knowns nothing about config
management; that's vc's job.

Hmm - vc could query for the current project root, and ada-mode would
provide the answer. That might be useful, and a good reason to have a
unified project interface.

> Now, before adding this feature to the core, are there other related
> general questions we want to be able to answer? Depending on that, a
> "project" might be better implemented as a cl-struct, providing
> specialized implementations for those several generic methods.

There are lots of project meta-data that the ada-mode project file syntax
provides; compiler options, object directory, case exceptions, etc. Some
of those might be common with other projects.

Getting a basic infrastructure in place first is a good idea; we can
always promote things that turn out to be common among many backends.

In any case, I believe a cl-struct is the way to go.

I don't think we should try to unify the xref and project backends, but
every major mode will probably want to provide both.

-- Stephe

reply via email to

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