[ESS] [patch] ess-load-file not working with tramp-visited files and ess-remote

Erik Iverson eriki at ccbr.umn.edu
Sat Aug 14 04:08:59 CEST 2010


The following patch should allow users to submit a .R file
visited through Tramp to a remote R process via ess-load-file,
C-c C-l.

We can currently generate an error by:

1) visiting a .R file on a remote machine through tramp
2) starting up R through ess-remote, or just M-x R on
    the tramp-visited file to start up an R session
    on that host
3) C-c C-l to call ess-load-file

We would see in *ESS-errors*:

Error in file(file, "r", encoding = encoding) :
   cannot open the connection
In addition: Warning message:
In file(file, "r", encoding = encoding) :
   cannot open file '/scp:user at machine.umn.edu:/home/user/test.R': No such file 
or directory

We see the problem: the 'tramp' part of the file name is being put in
the source command to ESS.  Obviously, R has no idea how to deal with

With the following patch, we no longer get that error in that
use case.  We still cannot use ess-load-file to load a
tramp-visited file to a *local* R session, but that seems
less useful (at least to me :).

Hopefully I'm not missing some obvious way for this to work,
let me know what you think.  If this isn't the proper format for
the patch, please advise!

Index: lisp/ess-inf.el
--- lisp/ess-inf.el	(revision 4403)
+++ lisp/ess-inf.el	(working copy)
@@ -1365,6 +1365,9 @@
  	    (ess-force-buffer-current "Process to load into: ")
        (let ((errbuffer (ess-create-temp-buffer ess-error-buffer-name))
+	    (filename (if (tramp-tramp-file-p filename)
+			  (tramp-file-name-localname (tramp-dissect-file-name filename))
+			filename))
  	    error-occurred nomessage)
  	(ess-command (format inferior-ess-load-command filename) errbuffer) ;sleep ?

More information about the ESS-help mailing list