September 28, 2004 6:15 PM
GnuEmacs is what I use as an Integrated Development Environment for
most of my programming needs. During C/C++ development, repetitive
re-compilation using M-x recompile
is something that can use a
little bit of tweaking to make life easier. I like the compilation
window to disappear if the compilation was successful. Here's the code
to do that:
;;; Customize compilation (defun compile-check-delete (buf str) (interactive) (if (string= str "finished\n") (progn (message "Compilation Finished Successfully") (delete-other-windows)))) (setq compilation-finish-function 'compile-check-delete)
I also like to bind recompile
coupled with a shell
when I'm in C
mode to C-c C-r
.
(define-key c-mode-map (kbd "C-c C-r") (lambda () (interactive) (recompile) (shell)))
It pays to remember C-x `
to get to the locus of the first error
encountered during compilation.