[ESS] improving ESS/julia

Tamas Papp tkp@pp @end|ng |rom gm@||@com
Sat Feb 28 10:31:38 CET 2015

On Wed, Feb 18 2015, Vitalie Spinu <spinuvit using gmail.com> wrote:

>  >>> Tamas Papp on Wed, 18 Feb 2015 12:43:00 +0100 wrote:
>  > (concat "eval(" module_name ", :(" string "))")
> You should improve on ESS module defined in etc/ess-julia.jl. Defined
> all your helper functions (ess_eval, ess_source) in there and then
> simply call them from emacs. See for example how evaluation is defined
> for R:
> ╭──────── #195 ─ /home/vspinu/VC/ESS/lisp/ess-r-d.el ──
> │      (ess-eval-command                  . ".ess.eval(\"%s\", FALSE, FALSE, file=\"%f\")\n")
> │      (ess-eval-visibly-command          . ".ess.eval(\"%s\", TRUE, TRUE, 300, file=\"%f\")\n")
> │      (ess-eval-visibly-noecho-command   . ".ess.eval(\"%s\", FALSE, TRUE, 300, file=\"%f\")\n")
> │      (ess-load-command                  . ".ess.source(\"%s\", FALSE, FALSE)\n")
> │      (ess-load-visibly-command          . ".ess.source(\"%s\", TRUE, TRUE, 300)\n")
> │      (ess-load-visibly-noecho-command   . ".ess.source(\"%s\", FALSE, TRUE, 300)\n")
> ╰──────── #200 ─
> etc/ESSR/R/.basic.R defines .ess.eval and .ess.source. Only few of the
> above are actually used from ESS.
>  > Which function should I modify for this? ESS-SEND-STRING is not using
>  > the buffer any more, and I don't know if I should modify
> You can modify `julia-send-string-function` and do whatever you want
> with it. It completely takes over `ess-send-string`. But that approach
> is pretty limited because (as you noted) buffer position is not
> supplied.
> Currently, for R the call to `ess-eval-region`, which is an exit point
> for all evaluation commands,  ends up in `ess-tracebug-send-region`
> which, in turn, takes care of "source injection". So, for more advanced
> implementation you should look at ess-tracebug-send-region. If you can
> build a similar function for julia that would be great. We then can
> dispatch it directly from ess-eval-region.
> A lot of complications in ESS code have to do with so called visible
> evaluaiton (see ess-eval-visibly). I don't think you will be able to
> implement this for julia because julia doesn't output secondary
> prompt. I also think this feature doesn't worth all the pain and I wish
> it wasn't there in the first place.

I have come up with some experimental (and rather trivial) code to
try the extensions I need:


Since I am wating for the rebase on julia-mode, I did not make this
fork/PR of ESS, rather something that can be used in addition.

Because I am not an experienced Emacs programmer, your comments would be
very welcome, especially on the Elisp code that uses ESS (it is very
short, <150 LOC in Julia and elisp altogether).

In particular, is JULIA-SEND-REGION something I can hope to integrate to
ESS? If not, what should I modify about it? Code below that is just for
hijacking ESS keystrokes until the whole thing is integrated.

I am planning to make a PR when the rebase happens, and from then on I
hope to continue making improvements to ESS/julia.



More information about the ESS-help mailing list