[ESS] Interact with ESS from R

Gábor Csárdi c@@rd|@g@bor @end|ng |rom gm@||@com
Mon Jun 1 17:44:20 CEST 2015

On Mon, Jun 1, 2015 at 11:10 AM, Martin Maechler
<maechler using stat.math.ethz.ch> wrote:
> Yes... and of course that was I think the real gist of Gabor's
> question.
> I don't think we can do this ... and honestly I would not know
> how this could be done in general.  Emacs does run the R
> process, so in this sense, emacs/ESS is the master and R is the
> slave.

I know nothing of ess's internals, but you can easily communicate
between parent and child, you use pipes:

I understand that this can be tricky if the R process is remote, and
also, making it portable might not be easy (although there are a lot
of programs doing this, it is must be possible).

I see you also have an option below....

> You *can* easly find out from that you are running inside ESS,
>     > "ESSR" %in% search()
>     [1] TRUE

Thanks, this is useful.

>   [35] ".essDev_source"                ".essDev.eval"
>   [37] "htsummary"
> and now of course you can start hacking these (replacing them by
> hacked versions!) from the R side.  But currently this cannot be
> used to bring ESS to eval emacs lisp expressions.
> We could enable this though, at least by something like
> a hook,
> R code equivalent would be something like
>   if(is.character(as.environment("ESSR")$emacs.eval))
>       ## in emacs, take the    as.environment("ESSR")$emacs.eval
>       ## and evaluate it as emacs lisp code
> and ESS would do this "every time" after sending R code to
> the process, or something similar ?
> or it would remove the character code, after eval()ing it ?

So how would emacs know that it has to run something as LISP code? It
would just run anything that you put in a given R object?

Anyway, I guess my question leads very far, and I am not sure if it is
desirable at all. To me it sounds kind of cool to turn on/off features
from within R, or (say) have an `ESS` R package that can interact with
Emacs. But this is probably because I am much more experienced with R
than with Emacs. :)

I think for now I am content with the answer, that there is no way to
do this. :)



More information about the ESS-help mailing list