I have an org file with notes about how to setup my project. One of the notes has some shell scripts, like this:
#+begin_src sh :dir ~/Workspace/MyProject :session cmake-setup
cmake -B build-debug -S . -G Ninja \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug
#+end_src
I can hit C-c C-c
there and execute the shell command. But the problem is that Emacs hangs for 5-10 seconds while that command runs. When it's done I can switch to the cmake-setup
buffer and see the output. But I'd like to switch to the shell buffer right away and see the progress. This will be essential when commands take more than a few seconds.
I found ob-async
and added the :async
header to the source block. It stops freezing emacs, but it ignores the :session
header and puts the huge amount of output into my org file.
Is there a way to make my code block execute asynchronously and keep it running in the session?
:results silent
for the block if you don't want to see a huge output.&
did it. Thank you.