From fbc6a4427c5e3d2cf282d235a3a41c3f85c587e2 Mon Sep 17 00:00:00 2001 From: dx Date: Mon, 4 May 2020 05:15:49 +0100 Subject: ~call-process -> async-shell-command Async shell command gives me a buffer for my output, is faster as it's async rather than blocking my Emacs, and all around better to use. --- Doom/.doom.d/org/literate.org | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'Doom/.doom.d/org/literate.org') diff --git a/Doom/.doom.d/org/literate.org b/Doom/.doom.d/org/literate.org index f10f7de..0bacd7e 100644 --- a/Doom/.doom.d/org/literate.org +++ b/Doom/.doom.d/org/literate.org @@ -39,6 +39,7 @@ multiple /differing/ outputs easily if it isn't specified a destination. (expand-file-name (concat dx:literate/bin-dir "\\1.el")) SRC)) #+END_SRC * Parser +** Tangle function First we need to get some sort of parser which can, given a source org file and a destination, parse and produce an Emacs lisp file. We'll copy this from the literate module of doom. @@ -49,17 +50,14 @@ literate module of doom. (when (file-newer-than-file-p SRC DEST) (let ((output (get-buffer-create "*org-tangle*"))) (unwind-protect - (or (and (zerop (call-process - "emacs" nil output nil - "-q" "--batch" - "-l" "ob-tangle" - "--eval" (format "(org-babel-tangle-file %S %S)" - SRC DEST))) - (with-current-buffer output - (message "%s" (buffer-string)) - t)) - (warn (format "Problem with tanging %S to %S" SRC DEST))) - (kill-buffer output)))))) + (async-shell-command + (concat "emacs " + "-q " "--batch " + "-l " "ob-tangle " + "--eval " + (format "'(org-babel-tangle-file %S %S)'" SRC DEST)) + "*org-tangle-messages*" + "*org-tangle-errors*")))))) #+END_SRC * Hook on save Now we need to make a hook function that, when the current buffer is an org file -- cgit v1.2.3-13-gbd6f