diff --git a/emacs.el b/emacs.el index a51be9d..b5c2e29 100644 --- a/emacs.el +++ b/emacs.el @@ -8,6 +8,7 @@ (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t) (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")) +(add-to-list 'package-archives '("nongnu" . "https://elpa.nongnu.org/nongnu/")) (package-initialize) (require 'auto-complete-config) @@ -65,7 +66,6 @@ (global-set-key (kbd "") 'm-line-up) (global-set-key (kbd "") 'm-line-down) - ;; Variables (custom-set-variables ;; custom-set-variables was added by Custom. @@ -162,3 +162,18 @@ (TeX-run-compile name command file) (TeX-process-set-variable file 'TeX-command-next TeX-command-default)) nil t :help "Create nomenclature file"))) + + ;; Helper for compilation. Close the compilation window if + ;; there was no error at all. + (defun compilation-exit-autoclose (status code msg) + ;; If M-x compile exists with a 0 + (when (and (eq status 'exit) (zerop code)) + ;; then bury the *compilation* buffer, so that C-x b doesn't go there + (bury-buffer) + ;; and delete the *compilation* window + (delete-window (get-buffer-window (get-buffer "*compilation*")))) + ;; Always return the anticipated result of compilation-exit-message-function + (cons msg code)) + ;; Specify my function (maybe I should have done a lambda function) + (setq compilation-exit-message-function 'compilation-exit-autoclose) +