1

When I execute a long running script within the org mode, emacs freezes. Is there a way to see the (running) output of the script? Alternatively, is there a way to run script asynchronously, and then get the output back into the org buffer?

I run my shell scripts the following way:

#+BEGIN_SRC shell
 ls
#+END_SRC

Thank you!

Edit: May be there is a way to run the command in a separate buffer, to observe output, and the put truncated output back to the main buffer?

  • Can you give us a minimal working example of how you run your script using org-mode? – lawlist May 1 '20 at 2:28
  • @lawlist I added a code example – ashim May 1 '20 at 3:06
  • Thank you. I was able to get the minimal working example to work by first evaluating (require 'ob-shell). – lawlist May 1 '20 at 6:21
  • I did some preliminary tracing using the minimal working example and found that it uses the function process-file, which calls call-process -- both of which have an optional argument for DISPLAY, with limitation notations in the doc-strings; e.g., "Some file handlers might not support all variants, for example they might behave as if DISPLAY was nil, regardless of the actual value passed." I tried using the DISPLAY argument, but that did not appear to achieve your desired affect. You may wish to explore working on a custom solution that utilizes start-process instead ... – lawlist May 2 '20 at 3:05
  • @lawlist Can you please put notes from your exploration as an answer, so I can reproduce it? Thank you. – ashim May 2 '20 at 22:35
1

Alternatively, is there a way to run script asynchronously, and then get the output back into the org buffer?

There is a great package for that: ob-async

Just add :async to your header (or in a drawer, etc.).

Unfortunately I don't know of any way to monitor the process as it runs, though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.