emacs-devel
[Top][All Lists]
Advanced

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

Re: A unified project root interface


From: Lluís
Subject: Re: A unified project root interface
Date: Mon, 11 Mar 2013 19:57:22 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

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 project
  root.


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.


Lluis

-- 
 "And it's much the same thing with knowledge, for whenever you learn
 something new, the whole world becomes that much richer."
 -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
 Tollbooth



reply via email to

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