I am using emacs-snapshot with the ssh.el package, following the instructions from the ess manual.
There are a few ways to open an R session, but this is how I do it:
- open emacs
- C-x C-f /server:dir/file.R this puts me in ESS [S] mode
- Type 'plot(1)'
- C-c C-n to run
- emacs asks for starting directory, and I choose the /server:dir/
- I would like for a figure to pop up but it wont.
This also doesn't work when using ess-remote in shell or tramp mode, but it does work if I set the starting directory to my local desktop.
Any advice much appreciated. My current workaround is to print the file to pdf and then open pdf in DocView mode, but this takes a few extra steps and is slow.
I do it the other way around:
ssh -X some.server.com
to connect to a remote server with x11 forwarding.emacsclient -nw
to restart an Emacs session that is already runningplot(cumsum(rnorm(100)))
in R as usualThen the plot windows appears on the initial machine I
ssh
'ed away from.Edit: As a follow-up to the comment: This works for any
emacs
, eitheremacs
oremacs-snapshot
. For a long time I used(server-start)
in the~/.emacs
but now I prefer that (just once) lauchemacs --daemon
after which I can then connect to viaemacsclient
(which also exists asemacsclient-snapshot
). I really like this -- it gives me Emacs around R in a persistent session that I connect, disconnect and reconnect to.I selected Dirk's answer because he pointed me in the right direction, and especially for lowering the energy of activation required to visualize my data, but here I am going to give the details of how I got this to work on my desktop.
1) set ssh keypairs (I had previously done this, full instructions for Ubuntu here)
2) include the following in ~/.ssh/config
3) open emacs on local machine
4) C-x C-f
5) /any_server_nickname:dir/file.R for files in home directory or /any_server_nickname:/path/to/file.R
6) plot(1)
7) C-x C-b to evaluate entire buffer.