lisp service

(format T "Hello World") 
« Back to blog

Code Project Management in Emacs, Part 2

In the last post, I talked a bit about setting up file finding in projects with Anything.  Since then, I've done a couple more things to make my life inside an Emacs project a bit better.  First, I set up regular expression matching for anything objects using the anything-match plugin.  This worked very easily - I just installed the package, and Anything immediately began accepting my regular expressions (and highlighting results).

Next, I decided to set up proel.  After installing the package, I needed to set the projects directory in proel.el.  To do this, I set the "proel-dir-with-projects" variable as follows:

In proel.el, line 37:

(defvar proel-dirs-with-projects (list (expand-file-name "~/Development/Source/clbuild/source"))
  "The list of directories one stores projects in.")

Note that I wasn't able to simply setq this variable in my .emacs file since if this directory is not set to something that exists on your computer at emacs startup time, requiring proel in your .emacs file fails. Next, I added "proel-anything-projects" to my list of anything sources, making my sources in my .emacs file look like the following:

;; anything setup
(require 'anything-config)
(require 'anything-match-plugin)
(global-set-key "\C-u" 'anything)
(setq anything-sources '(anything-c-source-buffers+
			 anything-weblocks-saikat-c-source-file-search
			 anything-contentrees-c-source-file-search
			 anything-c-source-locate
			 anything-c-source-recentf
			 proel-anything-projects
			 anything-c-source-org-headline
 			 anything-c-source-buffer-not-found))

Finally, the tricky part. The main reason I wanted proel was for the grepping in project ability. But the first time I tried it, it kept failing for me, giving me the error "Wrong type argument: stringp, nil". After some digging, it turned out that some defaults had to be set for grep before I could use this command by calling (grep-compute-defaults). So, in my .emacs file, I did the following to setup proel:

;; proel setup
(require 'proel)
(grep-compute-defaults)
(global-set-key "\C-c\C-g" 'proel-grep-in-project)

This is working great.  The one change I am thinking of making is editing the proel project searching function to use ack instead of grep, as suggested by Mikhail in a comment to my last post.

Loading mentions Retweet

Comments (1)

Leave a comment...

 
Got an account with one of these? Login here, or just enter your comment below.
Posterous-login    Connect    twitter