I realise there is already many an effort to implement 'projects' in
emacs but I've decided to have a stab at it myself. What I've ended up
with is a really simple module that is configurable purely via elisp
(meaning no files needed in the root of your project). So, buried in
my startup, I have this:
(with-library 'project-root
(setq project-roots
'(("Generic Perl Project"
:root-contains-files ("t" "lib")
:on-hit (lambda (p)
(project-root-setup-ack p)))))
(add-hook 'cperl-mode-hook 'project-root-fetch)
(add-hook 'dired-mode-hook 'project-root-fetch)
(define-key dired-mode-map (kbd "r") 'project-root-goto-root))
with-library looks like this by the way:
(defmacro with-library (symbol &rest body)
`(when (require ,symbol nil t)
,@body))
At the moment I only use this for anything resembling Perl projects,
this being determined by the :root-contains-files property. You can
also use :path-matches to pull out a path where the first match group
is the root:
"\\(/home/someone/work/projects/blah\\)"
The function given to :on-hit will execute when a match for the root
is found, so in my case I setup ack to cd to the root of the project
first.
I'd love to get some feedback on how use(ful|less) this is to people,
even in its early state.