Thursday, June 30, 2011

[Emacs] compile-command

compile-command is a variable which holds the target for compile command in Emacs. By default, it holds "make -k" , but we can change it if we need a slightly different target. For example, while I am editing my latex files I can set it to "pdflatex myfile.tex".

An easy way to accomplish this is using a file local variable. For my latex file, I added the following comments at the end of the file to set some file local variables.

% Local Variables:
% compile-command: "make -k ch2"
% fill-column: 80
% comment-fill-column: 80
% End:

Local value of compile-command can also be used in source files where someone need to build the whole project instead of only compiling the source targets in the current directory from Emacs.

% Local Variables:
% compile-command: "cd .. && make -k"
% End:

3 comments:

versionzero said...

Who even uses Emacs anymore?!

Mahmudul Hasan said...

meh

versionzero said...

I'm only kidding :). It's Ben, btw.