[org/async-tangle] don't create window if buffer already visible

This commit is contained in:
contrapunctus 2021-07-12 08:55:06 +05:30
parent 150764aa2e
commit b9ed987fd4
1 changed files with 10 additions and 8 deletions

View File

@ -2757,19 +2757,21 @@ Create advice for =lispy-pair= - if =lispy--in-string-or-comment-p= is true, sel
(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)))
(old-win (selected-window)))
(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)))
;; don't create window if buffer already visible
(unless (get-buffer-window-list proc-buffer)
;; to avoid messing up my usual two-windows-same-buffer setup
(select-window (split-window-below))
(switch-to-buffer proc-buffer)
;; so I can access my Hydra to switch back
(boon-mode))
;; (select-window old-win)
))
#+END_SRC
*** Common Lisp