Open frederic-santos opened 3 years ago
Well, if this can help:
When one single Julia command is separated with newlines, the iESS process reads the first (incomplete) line, and then (ess-process-get 'busy)
is now t
. At this stage, it does not even try to read the following lines. It seems that there is something like an ess-wait-for-process
that is triggered after the first incomplete line, and it obviously hangs the whole process since the rest of the command is not passed to the iESS buffer. I couldn't find where is the problem, since there is no such instruction in ess-julia.el
. However, this problem does not exist in iESS[R] buffers, so there is really something wrong specifically with the Julia part.
Here is a concrete illustration. That piece of code does not work:
(julia)
(with-current-buffer "*julia*"
(insert "a8 = repeat(collect(4:-1:1),\n inner=[1],\n outer=[2])")
(inferior-ess-send-input)) ; hangs
For my ob-julia backend, I wrote a piece of code that concatenates Julia commands into one single line, so that they can be executed in iESS[julia] buffers. Now this kind of thing works within my backend: actually, removing the newlines is enough to make things work:
(with-current-buffer "*julia*"
(insert "a8 = repeat(collect(4:-1:1), inner=[1], outer=[2])")
(inferior-ess-send-input)) ; okay, works
Don't know whether you can (or want to) change that directly in ESS. It's not a blocking bug for me any longer, but it's stil quite a strange behavior.
However, there is no such problem with R:
(R)
(with-current-buffer "*R*"
(insert "d = data.frame(c(1, 2, 3),\n c(4, 7, 8),\n c(9, 10, 15))")
(inferior-ess-send-input)) ; okay, works
Thanks for investigating. I think the issue is that julia doesn't define a secondary prompt: https://github.com/emacs-ess/ESS/blob/a694b2627992bda5489c1b4b5bb750c590aa8d85/lisp/ess-julia.el#L290
This makes it impossible to implement busy detection for that language.
Possibly we should define the secondary prompt as 7 spaces, i.e. the number of signs in julia>
. But ESS should also handle the case of no secondary prompt gracefully.
I'm interested in ob-ess-julia
replacing ob-julia
, but it would be a real pain to do this while multi-line code blocks aren't supported in sessions. Is there a good chance this could be implemented in the near future?
Thanks @tecosaur . Indeed, if we can find a way to allow for busy detection in Julia and/or defining a secondary prompt, this will obviously help to achieve a correct ob-julia
. I think I can do without that, but clearly, this will be much more painful, and will require some dirty workarounds.
Hi,
This might be a question rather than a bug report. However, there is a strange behavior from iESS[julia] buffers, that I don't manage to explain. Here is a minimal reproducible example.
Open a terminal (so, don't use Emacs!), run
julia
, and paste the following code into the Julia REPL:Everything should be okay, and your array should be displayed normally. (For Emacs: this will also work if
julia
is started fromeshell
rather than within the ESS framework.)Now, open Emacs, do
M-x julia
, paste and submit the same piece of code into the iESS[julia] buffer. Result: the Julia process hangs forever and no result is displayed. Basically any command written on several lines will result in a frozen process. This is even stranger, because the same command can perfectly be executed when doing aC-c C-c
on an ESS[julia] source code buffer.This is not harmless, because I'm writing a Julia backend for org-mode based on ESS, and this behavior makes simply impossible to evaluate some Julia code blocks into iESS[julia] buffers with
org-babel-comint-with-output
.Thanks!
(P.-S.: I'm on Linux, with the latest melpa version of ESS.)