diff --git a/modules/applications/emacs/init.el b/modules/applications/emacs/init.el index 200f665..c7261cd 100755 --- a/modules/applications/emacs/init.el +++ b/modules/applications/emacs/init.el @@ -207,6 +207,23 @@ (setq initial-buffer-choice 'xah-new-empty-buffer) +(defun compile-on-save-start () + (let ((buffer (compilation-find-buffer))) + (unless (get-buffer-process buffer) + (recompile)))) + +(define-minor-mode compile-on-save-mode + "Minor mode to automatically call `recompile' whenever the +current buffer is saved. When there is ongoing compilation, +nothing happens." + :lighter " CoS" + (if compile-on-save-mode + (progn (make-local-variable 'after-save-hook) + (add-hook 'after-save-hook 'compile-on-save-start nil t)) + (kill-local-variable 'after-save-hook))) + + + (require 'base16-theme) (defvar base16-generated-colors