Jorgen Schaefer writes:
> On Sat, 16 Mar 2013 23:59:39 +0100
> David Engster wrote:
>> I think our C/C++ project wrapper is a
>> good example for this, where you define a project like this:
>> (ede-cpp-root-project "NAME"
>> :file "~/myproject/Makefile"
>> :include-path '( "/include" "../include" "/c/include" )
>> :system-include-path '( "/usr/include/c++/3.2.2/" )
>> :spp-table '( ("OS_GNU_LINUX" . "1") ))
>> I'd argue this is already similar to how projects are defined in
> I have no idea what project-root.el is or why anyone brought it up. The
> two project libraries I linked in the first post of this thread and
> described therein do not require such cumbersome extra effort.
This is just a matter of providing default project types, which are
activated at startup. You do not have to explicitly specify projects
like this. EDE already ships with such default projects, for example for
detecting the Emacs source, or the Linux kernel. It is very easy to do
something similar for version controlled files (see below), similar to
what your project.el does.
project-root.el is just a slightly more generic version than your
project.el. Most importantly, it allows to define different types of
projects, so that a package author can for example add some
functionality only for Perl projects, excluding all the others.
> In the normal case, I do not want to define a project at all.
Fair enough, but while this may be the "normal" case, the ability to
define own project types is not an exotic demand, IMO. I like how
project-root handles this.
> As an extension author, I just want to call (project-root) in my
> extension and have it magically return a directory that's the root
> directory of the project.
In EDE, you have a buffer-local variable `ede-object-root-project',
which holds the root project. I can be queried through methods, for
will get you the root directory.
> The problem I raised in this thread is that too many packages write
> their own solution because using any of the possible standard solutions
> is too cumbersome. Saying "there is a cumbersome standard solution"
> does not solve the problem.
I do not say that.
To hopefully prove my point, I've hacked together a small EDE project
for detecting files under git/hg/bzr version control, very similar to
how you do it in your project.el (I've dropped the CVS/.svn detection
for the moment).
Just load Emacs with
emacs -Q -f global-ede-mode -l vcs-root.el
and load some file under a git/hg/bzr versioned directory. There is an
example function `my-get-project-root' to print the project's root.
While you might not like the CLOS-like syntax, I hope it can be seen
that this is not difficult and fairly short (most of it is just
boilerplate), and you directly profit from stuff like caching that EDE
does (as Eric has already mentioned in this thread).
Just to be clear: I do *not* expect that users write this stuff;
instead, Emacs should provide projects like this as defaults.