1
votes

I am using emacs ess and tramp to remotely execute some R script. I typically have an R script on a server, and I run it interactively on my server, through emacs. This work all well and fine.

However I can not manage to have the plot windows appears from my R script. I would like to obtain from emacs the same behavior that if I ran ssh -X [email protected]
and then do some R interactively, with plot appearing on my local machine.

I have modified my .ssh/config to add the ForwardX11 yes option, which works for a direct ssh query on my sever but not with emacs/trump

I have also tried the option to customize tramp-default-mode` (see https://superuser.com/questions/609414/emacs-doesnt-use-ssh-config-when-accessing-files-on-a-remote-machine) but this does not work either.

I also came across this very similar question: How can I launch an x-window from emacs ess when running R on a server?

However:

1) The accepted answer is not a direct answer to the forwardX problem

2) The second answer is not working (am I doing something wrong ? or missing a configuration somewhere?)

Thanks for your help,


edit I use Emacs 23.1.1 on a Ubuntu 16.04

1

1 Answers

1
votes
(with-eval-after-load 'tramp
  (add-to-list 'tramp-methods
               '("sshx11"
                 (tramp-login-program        "ssh")
                 (tramp-login-args           (("-l" "%u") ("-p" "%p") ("%c")
                                              ("-e" "none") ("-X") ("%h")))
                 (tramp-async-args           (("-q")))
                 (tramp-remote-shell         "/bin/sh")
                 (tramp-remote-shell-login   ("-l"))
                 (tramp-remote-shell-args    ("-c"))
                 (tramp-gw-args              (("-o" "GlobalKnownHostsFile=/dev/null")
                                              ("-o" "UserKnownHostsFile=/dev/null")
                                              ("-o" "StrictHostKeyChecking=no")
                                              ("-o" "ForwardX11=yes")))
                 (tramp-default-port         22)))
  (tramp-set-completion-function "sshx11" tramp-completion-function-alist-ssh))

This is just a copy of the "ssh" method, with the "-X" added to tramp-login-args. Then you can visit a file/directory with C-x C-f /sshx11:user@host:path/to/target.