Thoughts on Perl and Emacs, technology and writing

Multiple Build Commands For Emacs

I then open a number of separate emacs processes for each project I’m actively working on. I mainly do this as each project typically has it’s own make invocation.

I have a similar issue myself where my work projects require different commands but I prefer to avoid running multiple emacs instances if possible. It is not too difficult to fix. The idea is to detect the name of the file and run a different make command depending on which directory the file is in. This can be extended to as many different directories as necessary.

Share this:

Like this:

Related

10 Responses

This is a problem there are many solutions too. I set up a “current-project-root”
which I use as the basis for for decisions about invoking compile
commands. The setup here is actually quite simple and is usually
more complex when I have customised compile commands when working in
proprietary environments.

Many people have had similar
ideas. Maybe one day I’ll either properly rationalise my project code
or use another project package.

@Alex B – I had a quick look at your .emacs and the bit I can see that that sets the compile is:
(setq compile-command (format “cd %s && make -k” current-project-root)).
It looks like it is always calling make-k. Or have I missed something?

Thanks for the pointer to ProjectSettings. That looks very handy (although is it superceded by directory local variables?) .

@Alex O – I had a look at CEDET a couple of years ago and I found it very impressive although I decided it wasn’t for me. I don’t really want to change Emacs into a fully-fledged IDE. However, I do like pressing f7 and C-c ` to o to the different errors :)

By the way I went over to take a quick look so I could make an informed comment. Is this intended to replace an entire build system?

@Joakim and Ian – Yes, directory-local variables look like what I want. I’ll probably change over to use them instead. And Ian, nice fix to remove the helper functions.

@phil – I really like the look of project-root. I have a home-grown thing that I call aliases for finding various files but I think project-root is much more comprehensive. Cheers

It is simple at the moment because I’m not working with much stuff
that needs complex make invocations. Most FLOSS code is ready to build
with a straight “make -k”. However from time to time when I’m working
at a proprietary shop I usually code up slightly more
complex project-root stuff. One day if I ever have the need I may
generalise the code a bit more and make it deal nicely with buffer
local variables. However I don’t need to at the moment, necessity
being the main driver for such things :-)