[ESS] setting environment variables before starting R

Vitalie Spinu spinuvit at gmail.com
Thu Mar 27 22:35:16 CET 2014


 >>> Ross Boylan on Thu, 27 Mar 2014 13:47:38 -0700 wrote:

 > On 3/27/2014 1:22 PM, Vitalie Spinu wrote:
 >> Yes, process-environment is one way tot go but it will affect all the
 >> processes spanned by Emacs. If you want only for R then Sys.setenv from
 >> .Rprofile should do what you want.
 >> 
 >> Vitalie
 > I have seen some comments that Sys.setenv may be too late to affect the library
 > paths R uses (I mean paths in the LD_LIBRARY_PATH sense, not the R sense) and
 > it's certainly too late for PATH to affect which R gets run.  Do I need PATH set
 > when I launch emacs to affect ESS's choice of R binaries?

Ah, ok. For that specific variably it is indeed late. Then you have to
set it either in .emacs by adding to process-environment. I don't think
there is other option if you want to affect only the processes started
in emacs. 

You can affect only R process if you dynamically rebind
process-environment variable while calling R. Something along the lines:

(defun my-R ()
  (interactive)
  (let ((process-environment ....))
     (R)))


  Vitalie



More information about the ESS-help mailing list