The quest for “project”
As many people have pointed out before, emacs does not come with any packages for managing software projects. It comes with almost all of the parts you would need – debugger support, compilation modes, etc. – but it doesn’t come bundled with any way to tie a bunch of files together in to a project. Certainly this isn’t required to do software development, and, just as certainly, there are a myriad of ways to approach the concept of “projects”. This latter issue is likely why the basic emacs installation side-steps the issue.
In any case, I recently decided to look into the available project management options for emacs. I’ve used enough other big IDEs and tools to know that projects can be really useful, so I was curious what I could get for emacs. I wanted one that didn’t disrupt my normal emacs flow, one that had a clear and explicit model of what the project comprises, and ideally one that was highly hackable.
I looked at a number of tools, include CEDET (probably good but too bulky-feeling), proel (nice, but I didn’t fit it’s model of the world), and mk-project (not really sure…just didn’t work for me.) Honestly, I didn’t spend a whole lot of time vetting these. My sense was that if the package didn’t click with me quickly, then it wasn’t what I was looking for.
The winner: eproject
Ultimately, I settled on eproject. eproject essentially comprises three concepts:
- a top-level directory for a project
- a collection of files in the project
- a collection of commands that can be run relative to the project directory
A project is simply stored in a file in the project directory, and there is a central collection of projects stored in a file in your .emacs directory. It’s a very simple model, and everything is easily accessible.
I won’t go into any details on how to use eproject; the project page and emacswiki do a fine job of that, and I don’t really have anything to add. I do suggest, however, that you run eproject through its paces a bit on some smaller project just to get a feel for it. All in all, though, I found it intuitive, well documented, and easy to work with.
NOTE: There is another emacs project package also named eproject. The name conflict is unfortunate and confusing, so be aware. I did try this second eproject in my search, and while it’s a fine piece of software it didn’t really fit my needs.
Using eproject with anything
Many emacs users are fans of the excellent anything, and for good reason: it’s awesome! Fortunately, Daniel Hackney (good programmer name) wrote anything-eproject which marries the two projects. anything-eproject allows you to access your projects and project contents via the anything interface by providing two new “sources”.
Making it work
Putting this all together in your emacs configuration is pretty simple. Just download the eproject, anything, and anything-eproject packages to your .emacs directory and add something like this to your configuration:
; load eproject (load-file "~/.emacs.d/eproject/eproject.el") ; Disable automatic addition/removal of files from projects. Optional. (setq prj-autotracking nil) ; anything + eproject integration (require 'anything-eproject) ; let project files be sources in anything (add-to-list 'anything-sources 'anything-c-source-eproject-files t) ; let projects be sources in anything (add-to-list 'anything-sources 'anything-c-source-eproject-projects t)
While eproject works well, there are some things I would like to add. First, it can be a bit cumbersome to add a lot of files to a project, especially if the files in your project are spread across many directories. I’ve developed a small extension to eproject that tries to address this, and I’m working with the author to get this change in.
Second, I’d like support for “cloning” projects. I often work with multiple versions of very similar (often identical) projects, and it would be nice if eproject would let me bootstrap a new project definition based on an old one. This should be relatively simple, I think.