在服务器上运行 R 时,如何从 emacs ess 启动 x-window?
我按照 ess 手册中的说明将 emacs-snapshot 与 ssh.el 包一起使用。
有几种方法可以打开 R 会话,但这就是我的做法:
- 打开 emacs
- C-x Cf /server:dir/file.R 这使我进入 ESS [S] 模式
- 输入 'plot(1)'
- Cc Cn to运行
- emacs 要求输入起始目录,我选择 /server:dir/
- 我希望弹出一个数字,但它不会。
在 shell 或 trapm 模式下使用 ess-remote 时,这也不起作用,但如果我将起始目录设置为本地桌面,它就会起作用。
非常感谢任何建议。我当前的解决方法是将文件打印为 pdf,然后在 DocView 模式下打开 pdf,但这需要一些额外的步骤,而且速度很慢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我以相反的方式执行此操作:
ssh -X some.server.com
通过 x11 转发连接到远程服务器。emacsclient -nw
重新启动已在运行的 Emacs 会话plot(cumsum(rnorm(100)))
in R 像往常一样然后绘图窗口出现在我通过 ssh 离开的最初的机器。
编辑:作为评论的后续内容:这适用于任何
emacs
,无论是emacs
还是emacs-snapshot
。很长一段时间我在~/.emacs
中使用(server-start)
但现在我更喜欢(仅一次)lauchemacs --daemon 之后我可以通过
emacsclient
(也作为emacsclient-snapshot
存在)连接。我真的很喜欢这个——它在一个持久会话中为我提供了围绕 R 的 Emacs,我可以连接、断开连接和重新连接。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.我选择了德克的答案,因为他为我指明了正确的方向,特别是降低了可视化数据所需的激活能量,但在这里我将详细介绍如何让它在我的桌面上工作。
1) 设置 ssh 密钥对(我之前已经这样做过,Ubuntu 的完整说明在这里)
2) 在 ~/.ssh/config 中包含以下内容
3) 在本地计算机上打开 emacs
4) Cx Cf
5) /any_server_nickname:dir/file.R 对于主目录中的文件或 /any_server_nickname:/path/to/file .R
6) 图(1)
7) Cx Cb 评估整个缓冲区。
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.