summaryrefslogtreecommitdiffstats
path: root/.emacs.d/slash_c.el
blob: b8d35fe31ffcc303a7e182d299920bb90b76cebd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
(if (not (intern-soft "cc-mode"))
    (require 'cc-mode))

(global-set-key [(f9)] 'compile)   ; make F9 call the compilation command
(setq compilation-window-height 8) ; make the compilation window smaller

;; Make compilation window disappear on succesful build
(setq compilation-finish-function
      (lambda (buf str)
        (if (string-match "exited abnormally" str)
            ;; there were errors
            (message "compilation errors, press C-x ` to visit")
          ;; no errors, make the compilation window go away in 0.5 seconds
          (run-at-time 0.5 nil 'delete-windows-on buf)
          (message "NO COMPILATION ERRORS!"))))