在服务器上运行R时,如何从emacs ess启动x窗口? [英] How can I launch an x-window from emacs ess when running R on a server?
问题描述
按照ess手册中的说明,我将emacs-snapshot与ssh.el软件包一起使用.
I am using emacs-snapshot with the ssh.el package, following the instructions from the ess manual.
有几种方法可以打开R会话,但这是我的方法:
There are a few ways to open an R session, but this is how I do it:
- 打开emacs
- C-x C-f/server:dir/file.R这使我进入ESS [S]模式
- 输入'plot(1)'
- 要运行的C-c C-n
- emacs询问起始目录,然后选择/server:dir/
- 我想弹出一个数字,但不会.
在shell或流浪汉模式下使用ess-remote时,这也不起作用,但是如果我将起始目录设置为本地桌面,则它确实起作用.
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.
任何建议,不胜感激.我当前的解决方法是将文件打印为pdf,然后在DocView模式下打开pdf,但这需要一些额外的步骤并且很慢.
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.
推荐答案
我用另一种方法来做:
-
ssh -X some.server.com
通过x11转发连接到远程服务器.
ssh -X some.server.com
to connect to a remote server with x11 forwarding.
emacsclient -nw
重新启动已经运行的Emacs会话
emacsclient -nw
to restart an Emacs session that is already running
plot(cumsum(rnorm(100)))
然后,绘图窗口将出现在我ssh
离开的初始计算机上.
Then the plot windows appears on the initial machine I ssh
'ed away from.
作为注释的后续内容:这适用于任何emacs
,无论是emacs
还是emacs-snapshot
.很长时间以来,我在~/.emacs
中使用了(server-start)
,但是现在我更喜欢(只是一次)lauch emacs --daemon
,之后我可以通过emacsclient
(也以emacsclient-snapshot
存在)连接.我真的很喜欢-在连接,断开连接和重新连接的持久会话中,它为我提供了R周围的Emacs.
As a follow-up to the comment: This works for any emacs
, either emacs
or emacs-snapshot
. For a long time I used (server-start)
in the ~/.emacs
but now I prefer that (just once) lauch emacs --daemon
after which I can then connect to via emacsclient
(which also exists as emacsclient-snapshot
). I really like this -- it gives me Emacs around R in a persistent session that I connect, disconnect and reconnect to.
这篇关于在服务器上运行R时,如何从emacs ess启动x窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!