Closed devmotion closed 2 years ago
I can reproduce the error here and confirmed your suggestion fixes the issue. Thank you very much!
I too think the format of the results needs improvement (esp. for vectors, matrices, etc.). Using the same format as REPL would be an option but I would also like to make it as consistent as possible with other ob-* packages. But to be honest, I haven't been able to consider much yet. Suggestions are always very welcome.
Thanks for the quick fix!
One possible idea could also be to support a :display
option, similar to emacs-jupyter. If specified, then print
/show
could use the provided mime type. And otherwise one could either always fall back to text/plain, or have a list of standard mime types (such as text/html, image/png, text/plain etc.) in some pre-defined order and check if the result supports them (with Base.invokelatest(showable, mime, result)
) and use the supported mime type (similar to what Literate.jl does and I guess IJulia, and hence emacs-jupyter).
Thanks for the idea. Allowing the user control with the header argument sounds a reasonable choice. I will check how those other programs handle this.
I updated the code to show results in text/plain MIME type as you suggested. Thank you! #12
Sometimes I run into world age errors. E.g., when executing the code blocks in the following org-mode document
in the associated REPL the following errors are thrown:
I think this could be solved by not calling
print
in e.g. https://github.com/shg/ob-julia-vterm.el/blob/a7ff8f05e4a7af4082262c7a7ba3d83ae490a7f3/ob-julia-vterm.el#L98 butBase.invokelatest(print, io, result)
. (Similar to e.g. the use ofinvokelatest
in Literate: https://github.com/fredrikekre/Literate.jl/blob/master/src/Literate.jl.)An additional question is if one should call something like
Base.invokelatest(show, io, MIME("text/plain"), result)
instead, matching the default mime type in the REPL.