2013-09-17 05:04:34 +00:00
|
|
|
(require 'cc-mode)
|
2013-09-18 03:19:40 +00:00
|
|
|
(add-hook 'c-mode-hook '(lambda () (c-toggle-auto-state t)))
|
|
|
|
(add-hook 'c++-mode-hook '(lambda () (c-toggle-auto-state t)))
|
2013-09-17 05:04:34 +00:00
|
|
|
|
|
|
|
;; From http://xugx2007.blogspot.ca/2007/06/benjamin-rutts-emacs-c-development-tips.html
|
|
|
|
(setq compilation-finish-function
|
|
|
|
(lambda (buf str)
|
|
|
|
|
2013-09-18 12:46:05 +00:00
|
|
|
(if (or (string-match "exited abnormally" str)
|
|
|
|
(string-match "FAILED" (buffer-string)))
|
2013-09-17 05:04:34 +00:00
|
|
|
|
|
|
|
;;there were errors
|
2013-09-18 12:46:05 +00:00
|
|
|
(message "There were errors. SPC-e-n to visit.")
|
2013-09-17 05:04:34 +00:00
|
|
|
|
|
|
|
;;no errors, make the compilation window go away in 0.5 seconds
|
2013-09-19 17:36:45 +00:00
|
|
|
(delete-windows-on buf)
|
|
|
|
(message "compilation ok."))))
|