[ESS] executing Julia from org: error in ess-eval-region
@je30 @end|ng |rom c@m@@c@uk
Mon Aug 15 14:21:01 CEST 2022
couple of other quick points:
1. The *julia* repl gets poluted with these 'eoe' end-of-expression markers
which may be necessary, but feel clunky.
2. this is using *ESS* machinery to evaluate julia. I'm not yet
proficient enough in Julia, but feel that it might be time that a few of
us get together to think about which is the most suitable emacs
interface for a REPL in julia. I'm not convinced it is ESS, given how
much can be done in a regular julia repl that our comint interface
cannot cope with. there are a few others around that are based on
ansi-term or vterm that might be more appropriate.
which also has this for org-babel
as well as
On Mon, Aug 15 2022, Stephen Eglen wrote:
> ok... some progress...
> a workaround is that you will need to use the following in your
> .emacs -- it is simply the version from ob-julia.el with one linne added
> (search for SJE). I do not know why this alist is needed, but with
> this, I can confirm that :session now works.
> Can you please check?
> I did however need to add two Julia Packages, DataFrames and CSV, before
> it would work. This could be better documented as it was not obvious in
> the debugger.
> (defun org-babel-julia-evaluate-session
> (session body result-type result-params column-names-p)
> "Evaluate BODY in SESSION.
> If RESULT-TYPE equals `output' then return standard output as a
> string. If RESULT-TYPE equals `value' then return the value of the
> last statement in BODY, as elisp."
> (cl-case result-type
> (setq ess-local-customize-alist t) ;; SJE --- addition here.
> (insert (org-babel-chomp body))
> (let ((ess-local-process-name
> (process-name (get-buffer-process session)))
> (ess-eval-visibly-p nil))
> (ess-eval-buffer nil)))
> (let ((tmp-file (org-babel-temp-file "julia-")))
> session tmp-file
> (format org-babel-julia-write-object-command
> (org-babel-process-file-name tmp-file 'noquote)
> (if column-names-p "true" "false")
> (org-babel-result-cond result-params
> (insert-file-contents tmp-file)
> (org-babel-import-elisp-from-file tmp-file '(4)))
> (delq nil
> (lambda (line) (when (> (length line) 0) line))
> (lambda (line) ;; cleanup extra prompts left in output
> (if (string-match
> "^\\([>+.]\\([ ][>.+]\\)*[ ]\\)"
> (car (split-string line "\n")))
> (substring line (match-end 1))
> (org-babel-comint-with-output (session org-babel-julia-eoe-output)
> (insert (mapconcat #'org-babel-chomp
> (list body org-babel-julia-eoe-indicator)
> On Mon, Aug 15 2022, Stephen Eglen wrote:
>> ok, thanks.
>> In the meantime, I can now replicate your error. I'll see what I can
>> On Mon, Aug 15 2022, Fraga, Eric wrote:
>>> On Monday, 15 Aug 2022 at 12:20, Stephen Eglen wrote:
>>>> thanks. Do you know why 'results output' is needed for Julia chunks,
>>>> but not R?
>>> The implementation of ob-julia distributed with org, unfortunately, is
>>> not complete. There is a work-in-progress version  that promises to
>>> fix a few things but it's not quite ready to replace the current
>>> version, I believe.
>>>  https://github.com/nico202/ob-julia
More information about the ESS-help