[ESS] assiciation to ESS-R process

Andreas Leha andreas.leha at med.uni-goettingen.de
Fri Mar 25 09:05:28 CET 2011


Hi Rodney,

thanks for looking into this.  The hook works, but I do not see, how I
could specify the name of the R session - it is hard-coded into the hook
then, right?

Just for the background: I am asking because I use org-mode, which has
the nice feature of allowing multiple R sessions (defined by a destinct
name).  In org-mode the R-code is encapsulated in source-blocks of this
form:
#+begin_src R :session foo
   print("some R code here")
#+end_src
This example block will be executed in the R session *foo*.
Now, when the cursor is inside the source-block and C-c ' is pressed, a
new buffer in ESS mode is presented with the source code only.  And I
would like this buffer to be associated to the R session *foo* right
away.  As soon as I evaluate some code from this new buffer, it is
associated with the correct R session, but before that all (completion)
functionality is not available.
In order to get org-mode fixed in this respect, I'd need to know how to
get such association.

Regards,
Andreas



Am 24.03.2011 20:55, schrieb Rodney Sparapani:
> On 03/24/11 05:15 AM, Andreas Leha wrote:
>> Hi all,
>>
>> I have a simple question concerning the association of a buffer editing
>> a .R file and an ESS-R process.
>>
>> Whenever I open a .R-file, it is not associated (as indicated by
>> [none]).  The association happens only as soon as I evaluate something
>> or run ess-switch-process.
>>
>> Now my question:
>> I am looking for a function that I can run (or buffer-local variable I
>> can set) to associate the buffer to an R session of a given name.  If an
>> R process with the given name does not exist it should be started.
>>
>> Is such a function available?
>>
>> Regards,
>> Andreas
>
> You can probably accomplish what you want via R-mode-hook.
> This works for me:
> (add-hook 'R-mode-hook 'R)
>
> Rodney
>
> ______________________________________________
> ESS-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help



More information about the ESS-help mailing list