Add compile-on-save

This commit is contained in:
Alexander Bantyev 2021-06-21 14:56:54 +03:00
parent 99c6985782
commit 38b76b4527
Signed by: balsoft
GPG Key ID: E081FF12ADCB4AD5

View File

@ -207,6 +207,23 @@
(setq initial-buffer-choice 'xah-new-empty-buffer) (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) (require 'base16-theme)
(defvar base16-generated-colors (defvar base16-generated-colors