From ce3fac717205457c35eb486501754cc681127c9e Mon Sep 17 00:00:00 2001 From: fpi Date: Thu, 23 Jul 2020 10:38:59 +0200 Subject: [WIP] Add basic version of async tangling --- emacs-init.org | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'emacs-init.org') diff --git a/emacs-init.org b/emacs-init.org index 660e3be..abff790 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -47,8 +47,21 @@ they are tangled upon save I use this function. (expand-file-name "git/projects/dotfiles/" (getenv "HOME"))) (org-babel-tangle) (message "%s tangled" buffer-file-name))) +(defmacro fpi/tangle-async (&optional file) + "Tangle FILE with a separate emacs instance. -(add-hook 'org-mode-hook (lambda () (add-hook 'before-save-hook #'fpi/tangle-dotfiles nil t)) t) +Note that this does not respect any customization of the tangle +process in your init file as it is not loaded. This uses the +emacs-async library." + (interactive) + (let ((file (or file (buffer-file-name)))) + (and file + (not (file-remote-p file)) + `(async-start + (lambda () + (require 'org) + (org-babel-tangle-file ,file) + 'ignore))))) #+END_SRC As I use =org-crypt= all =.org= files need to be decrypted before tangling, saved without encrypting and encrypted after tangling and -- cgit v1.2.3