[Top][All Lists]

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

Re: A unified project root interface

From: Eric M. Ludlam
Subject: Re: A unified project root interface
Date: Tue, 12 Mar 2013 19:28:28 -0400
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.3a1pre) Gecko/20091222 Shredder/3.1a1pre

On 03/11/2013 02:57 PM, Lluís wrote:
Stefan Monnier writes:

So this is my somewhat verbose request to say "yes, let's do this" and
pick a library to provide the functionality.

Agreed.  There are already different such things distributed with Emacs:
.dir-locals.el is one of them.  CEDET has its own notion.
As mentioned .dir-local.el often acts as a project root, but it can also
appear in sub-directories of a project, so it's not sufficient.
It should at least be augmented so that some .dir-locals.el can be
flagged as "non-root".

If the only need is to figure out the "root directory of the project",
then maybe a simple solution is:

    (defvar project-root-predicate
        (lambda () (file-exists-p ".dir-locals.el")))
    (defun project-root ()
      (locate-dominating-file default-directory project-root-predicate))

where packages can (add-function :until-before (default-value
project-root-predicate)<mypredicate>) to recognize other "tell tale
sign" of a project root (e.g. a Tupfile).

CEDET provides this in two ways (as part of the EDE subsystem):

* If a Project.ede file exists, that's the root (similar to .dir-locals.el in
   this context)

* If signs of a "project-like" structure exist (e.g., (auto)makefiles, scons,
   java, etc), uses system-specific knowledge to automatically detect the 

I'm commenting this because, first, managing projects is the purpose of EDE
(although it tries to do more than just identifying their root) and it's
integrated in Emacs; and second, because the auto-detection could help in making
the process simpler and, in the best case, auto-magical.

I, of course, agree with Lluis. EDE is already setup to automatically find projects as was requested. Adding new projects through the 'generic' system is a pretty simple prospect.

I know some people think of EDE as being this big thing for creating your Makefiles, but its most common use really is to just tag the root of a project, and hang some configuration features for semantic auto completion. Adding new detectable projects to EDE would be a win all around.


reply via email to

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