[ESS] can I make ess to recognise ~/.bashrc

Vitalie Spinu spinuvit at gmail.com
Wed Jul 24 11:30:15 CEST 2013


You are hooking into R mode, so you need to open an .R file for this to
work.  If you just open dired or any other file it will not work.

This is a better way that should work from any tramp file:


(defun R+ ()
  (interactive)
  (let ((inferior-R-program-name)
        (if (and buffer-file-name
                 (file-remote-p buffer-file-name))
            "remote/path/R"
          "local/path/R"))
    (R)))

M-x R+ will do the right thing.

BTW, I think it would make sense to add inferior-R-remote-program-name
to ESS and to perform the above automatically?


   Vitalie


 >> Jannis <bt_jannis at yahoo.de>
 >> on Tue, 23 Jul 2013 16:31:38 +0200 wrote:

 > Ok, i tried the second approach as it seemed to be the most straightworward, but
 > (contrary to may last email) it does not work. When I open a file C-x C-f
 > remotecomputer:/path and start R (with M-x R), still the default paths are
 > used. Any hints on how to debug this? Sorry for the hassle but I have very
 > limited experience with this Lisp stuff.

 > Thanks

 > Jannis

 > On 11.07.2013 14:08, Vitalie Spinu wrote:
 >> >> Jannis <bt_jannis at yahoo.de>
 >> >> on Thu, 11 Jul 2013 13:49:32 +0200 wrote:
 >> 
 >> > Thanks, Vitalie. I am now defining these environment variables pointing to
 >> > .RProfile within emacs. The last problem I have is that I need to define a
 >> > particular path to the R executable when using TRAMP to start R (M-x R) as there
 >> > are several versions of R installed.
 >> 
 >> > Apparently this setting will set this:
 >> 
 >> >      (setq inferior-R-program-name "c:/progra~1/R/R-2.15.1/bin/Rterm.exe")
 >> 
 >> > Can i adjust this so that hitting M-x R on may local machine and doing so using
 >> > tramp beeing connected to a remote server will use different paths?
 >> 
 >> Not implemented on ESS side. So you have two options, other set
 >> inferior-R-program-name to Rterm and add the containing directories to
 >> PATH environment variable, or on emacs side (not tested):
 >> 
 >> (defun my-set-R-program-name ()
 >> (set (make-local-variable 'inferior-R-program-name)
 >> (if (and buffer-file-name
 >> (file-remote-p buffer-file-name))
 >> "remote/path/R"
 >> "local/path/R")))
 >> (add-hook 'R-mode-hook 'my-set-R-program-name)
 >> This part of ESS could be much improved, but somebody has to be
 >> interested enough to do that :)
 >> 
 >> Vitalie
 >>



More information about the ESS-help mailing list