On 15/11/2021 23:05, Daniel Kraus wrote:
Max Nikulin writes:
Attached is the patch changed the logic to use a temp file with org-babel-eval.
Thank you for contribution. I do not have strong objection any more. I
am not familiar with babel internals, so I leave further discussion to
maintainers.
If you have not signed copyright assignment yet, likely you should do it
to proceed (I am unsure concerning precise rules concerning line
counting). See https://orgmode.org/contribute.html and
https://orgmode.org/worg/org-contribute.html for details.
Somehow it doesn't feel too great to create unnecessary temp files
but I looked how other babel backends do it and e.g. ob-js and ob-haskell
use the same logic.
Code fragment might be huge enough to exceed limit on arguments length,
so I think that file is safer. Some interpreters and compilers generates
more meaningful errors and stacktraces when act on a file. Another
option is to feed content to process standard input. With `call-process'
or an related command it should be possible to implement any variant,
including raw argument without intermediate shell pass. See info
"(elisp) Synchronous Processes" or
https://www.gnu.org/software/emacs/manual/html_node/elisp/Synchronous-Processes.html
+ (with-temp-file script-file
+ (insert expanded))
+ (org-babel-eval
+ (format "%s %s" bb (org-babel-process-file-name script-file))
+ "")))
Since other babel packages use the same approach, I will not argue. By
the way, isn't second argument of `org-babel-eval' intended for code
that may be executed without a temporary file?
Some babel languages support sessions. I have no idea if it is
applicable to babashka.