Org Babel Bash With Noop Linesfleeting
After make org-babel-sh-evaluate handle no newline input lines correctly and make org-babel-sh-evaluate handle noop lines, there have been works on org-mode that supposedly fixed sole issues. Yet some still remain.
When using a session, org mode keeps a comint buffer open, sends the input to it and gets its output.
When you interact with a repl, it
- prints the prompt,
- meaning wait for input (ending with a newline character),
- the input line
- the output
- therefore, go back to printing the prompt,
Inside the comint buffer, because it basically is just a wrapper around a repl, all the lines are sent and the code tries hard to get rid of the prompt that gets intertwined with the output.
This works right when all the lines generate some output and end with a newline.
the actual regexp is↩︎
(setq-local comint-prompt-regexp (concat "^" (regexp-quote org-babel-sh-prompt) " *"))
this is done by
(replace-regexp-in-string comint-prompt-regexp ,org-babel-comint-prompt-separator text)))) ... then later (delete "" (split-string string-buffer ,org-babel-comint-prompt-separator))))))