diadochos / org-babel-eval-in-repl

Send and eval org-mode babel code blocks in various REPLs (therefore it's async)
MIT License
58 stars 8 forks source link

Support for drawers #37

Open untoreh opened 3 years ago

untoreh commented 3 years ago

With emacs-libvterm there is support for escape codes that track the prompt, command end, and command output. If the repl of a language allows to customize the prompt and insert such control codes (i.e. julia) it would be possible to just copy the output of the evaluation from the vterm buffer to the org buffer.

The advantage of this is that it is language agnostic, it does not need ad-hoc IO implementations for the language like all org-babel implementations, it's still async, and since it would copy from the vterm buffer, it would preserve the text properties, so it keeps the formatting as printed from the terminal emulator, whereas other org babel implementations loose the formatting, and instead rely on org support for pretty printing (i.e. tables)

actondev commented 3 years ago

Hi @untoreh Actually I've been wanting something like this myself as well, since I use this package (well, to be frank a new re-write of this package) a lot and rarely do thing with plain org-babel. And the last time that I want to create an org-mode file with src code & the results I (sadly) had to run the command and then manually paste the results.

if I'd go into the trouble of looking into this, I'd like also to have a complete functionality, like evaluating the whole org document (and replacing the results of all code blocks). Have you given any thoughts on this?

I guess the obvious way is to implement something with the functionality of org-babel-execute-src-block:

What do you think? And is your elisp-foo strong enough to maybe help with the task? If not, describe if you can your workflows and typical usecases of how & where this would be useful.