~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.
This commit is contained in:
@@ -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))
|
(expand-file-name (concat dx:literate/bin-dir "\\1.el")) SRC))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
* Parser
|
* Parser
|
||||||
|
** Tangle function
|
||||||
First we need to get some sort of parser which can, given a source org file and
|
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
|
a destination, parse and produce an Emacs lisp file. We'll copy this from the
|
||||||
literate module of doom.
|
literate module of doom.
|
||||||
@@ -49,17 +50,14 @@ literate module of doom.
|
|||||||
(when (file-newer-than-file-p SRC DEST)
|
(when (file-newer-than-file-p SRC DEST)
|
||||||
(let ((output (get-buffer-create "*org-tangle*")))
|
(let ((output (get-buffer-create "*org-tangle*")))
|
||||||
(unwind-protect
|
(unwind-protect
|
||||||
(or (and (zerop (call-process
|
(async-shell-command
|
||||||
"emacs" nil output nil
|
(concat "emacs "
|
||||||
"-q" "--batch"
|
"-q " "--batch "
|
||||||
"-l" "ob-tangle"
|
"-l " "ob-tangle "
|
||||||
"--eval" (format "(org-babel-tangle-file %S %S)"
|
"--eval "
|
||||||
SRC DEST)))
|
(format "'(org-babel-tangle-file %S %S)'" SRC DEST))
|
||||||
(with-current-buffer output
|
"*org-tangle-messages*"
|
||||||
(message "%s" (buffer-string))
|
"*org-tangle-errors*"))))))
|
||||||
t))
|
|
||||||
(warn (format "Problem with tanging %S to %S" SRC DEST)))
|
|
||||||
(kill-buffer output))))))
|
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
* Hook on save
|
* Hook on save
|
||||||
Now we need to make a hook function that, when the current buffer is an org file
|
Now we need to make a hook function that, when the current buffer is an org file
|
||||||
|
|||||||
Reference in New Issue
Block a user