What is the best way to compile programs inside emacs? I am currently opening a separate buffer with C-x 3 and running eshell inside it using M-x eshell then invoking either make or clang directly; most of the time I do have a Makefile set up.
Is there any advantage with running the compilation process using M-x compile vs running make inside eshell? Any other ways to do it and what are the advantages/disadvantages of those?
The easiest way to do this is to use the Emacs built-in
compilecommand.M-x compileshould do you fine. You can then edit the command that will be run (by defaultmake -k) and then hit return to run the compilation. Emacs will then parse the output and if it finds any errors they will link to the source files so you can open them in a buffer.Positives about it are:
M-nandM-pscroll by error messagesMost of these features are provided by the
compilation-minor-modeminor mode though not the actual compilation command and buffer. Once you have run a compilation command ineshellyou could probably get similar results by setting the minor mode tocompilation-minor-mode.