From 38b76b4527cf5dd11f32ae4cac2c86f355c9ad75 Mon Sep 17 00:00:00 2001 From: Alexander Bantyev Date: Mon, 21 Jun 2021 14:56:54 +0300 Subject: [PATCH] Add compile-on-save --- modules/applications/emacs/init.el | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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