Skip to content
jrockway edited this page Sep 13, 2010 · 3 revisions

A project type is how eproject determines what project a file belongs
to. When a file is first visited, eproject tests each project type
until it finds one that matches, and then treats that file as
belonging to that type of project. The eproject-root and
eproject-name are then determined. (Eproject doesn’t actually
maintain “projects” anywhere, it is usually assumed that buffers with
the same eproject-root are in the same project.)

To define a project type, you need to run some Lisp code. Generally you will do this in your .emacs, although at some point, project definitions will be included with eproject, and you can just load those.

Example definition:


(define-project-type haskell (generic) (look-for “Setup.lhs”))

Here, we define a haskell project type. We determine the project root
by looking for a file called Setup.lhs. If we find one, we know we
have a haskell project, and we know that the project root is the
directory that contains Setup.lhs.

The (look-for ...) above is a magic function that starts with the
visited file’s directory, and visits each parent until it finds the
named file. The place where (look-for ...) is can be any Lisp form,
though, so you can write a complex function to determine project
membership, if you like.

The (generic) part is a list of “supertypes” to inherit attributes
from. You can supply attributes as a property list (:key value
pairs) after the supertypes. Eproject understands a few attributes
internally (see InternalEprojectAttributes, but extensions that
use eproject can use any key they want. The attributes can be values
that are shared between all projects of the same type, or they can be
functions that are evaluated in a project file buffer.

Clone this wiki locally