[ESS] improving ESS/julia

Vitalie Spinu @p|nuv|t @end|ng |rom gm@||@com
Wed Feb 18 15:18:09 CET 2015


 >>> 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
 > ESS-SEND-REGION.

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.

 > BTW, what's the best way to use ESS from a git repo? Just add the lisp
 > diretory to the load path, and that's it?

Yes.

 Vitalie




More information about the ESS-help mailing list