[org] create async tangle command

This commit is contained in:
contrapunctus 2021-07-07 09:45:24 +05:30
parent c2d8c4cd9e
commit b99b0d2221
1 changed files with 25 additions and 0 deletions

View File

@ -1362,6 +1362,7 @@ _u_: next word ^_l_: edit lines^ _s_: next whole symbol
("b" cp-org-block/body "source block")
("t" cp-org-set-tags "tags")
("n" cp-org-nav/body "navigation")
("B" contrapunctus-async-tangle "babel-tangle")
("0" delete-window "delete this" :color red)
("1" delete-other-windows "delete others" :color red)
@ -1445,6 +1446,7 @@ _u_: next word ^_l_: edit lines^ _s_: next whole symbol
("j" xref-find-definitions "Jump to definition")
("J" org-babel-tangle-jump-to-org "Jump to definition (Org)")
("t" (contrapunctus-el-test/body) "Test")
("B" contrapunctus-async-tangle "babel-tangle")
("0" delete-window "delete this" :color red)
("1" delete-other-windows "delete others" :color red)
@ -2712,6 +2714,29 @@ pjb suggested a different approach [[http://paste.lisp.org/display/10157][here]]
:commands explain-pause-mode
:init (explain-pause-mode))
#+END_SRC
**** async-tangle
#+BEGIN_SRC emacs-lisp
(defun contrapunctus-async-tangle (&optional prefix)
(interactive "P")
(let ((proc-buffer (get-buffer-create "*async-tangle-process*"))
(file-name (buffer-file-name))
(file-name-no-ext (file-name-sans-extension
(buffer-file-name)))
(old-win (selected-window))
(new-win (split-window-below)))
(start-process
"async-tangle" proc-buffer "emacs" "-q" "-Q" "--batch"
"--eval=(require 'ob-tangle)"
(format "--eval=(org-babel-tangle-file \"%s\")"
file-name file-name-no-ext))
;; to avoid messing up my usual two-windows-same-buffer setup
(select-window new-win)
(switch-to-buffer proc-buffer)
;; so I can access my Hydra to switch back
(boon-mode)
(select-window old-win)))
#+END_SRC
*** Common Lisp
#+BEGIN_SRC emacs-lisp
(use-package redshank