Hugo hook: work in background

This commit is contained in:
MitchMarq42 2022-11-25 22:36:51 -09:00
parent 102c4d447f
commit 38358e8fae

View File

@ -662,12 +662,13 @@ Return nil if DIR is not in a hugo project at all."
(if hugo-dir
(let* ((default-directory hugo-dir)
(buffer (get-buffer-create "*hugo*")))
(pop-to-buffer buffer)
(compilation-mode)
(if (zerop (let ((inhibit-read-only t))
(call-process "sh" nil buffer t "-c" "hugo")))
(message "Hugo re-generated!")
(error "Hugo Failed, better change something!"))))))
(with-current-buffer buffer
;; (pop-to-buffer buffer)
(compilation-mode)
(if (zerop (let ((inhibit-read-only t))
(call-process "sh" nil buffer t "-c" "hugo")))
(message "Hugo re-generated!")
(error "Hugo Failed, better change something!")))))))
(add-hook 'after-save-hook
(lambda () (hugo-compile default-directory))))