如何在ESS/Emacs中后台执行R进程? [英] How can I background the R process in ESS / Emacs?

查看:96
本文介绍了如何在ESS/Emacs中后台执行R进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

启动R环境时,我经常运行较长的R脚本.我希望能够在Emacs/ESS中加载/运行R脚本,并在另一个缓冲区中继续其他工作.

I often run long R scripts when I start my R environment. I would like to be able to load / run the R script in Emacs / ESS and continue other work in another buffer.

当我按C-g或C-c C-c时,该过程被中断,必须重新启动脚本.

When I press C-g or C-c C-c the process is interrupted, and I must restart the script.

在ESS/Emacs中使R进程后台化的最佳方法是什么?

What is the best way to background the R process in ESS / Emacs?

谢谢您的回答和评论,但是它们都没有解决以下事实:加载/运行大型脚本时Emacs冻结,并且您无法更改缓冲区.

Thank you for your answers and comments, but none of them address the fact that Emacs freezes when you load / run a large script and you can't change buffer.

我想我的问题要笼统一些-Emacs可以后台执行一个流程来让您继续工作吗?

I suppose my question is a little more general - can Emacs background a process to let you keep working?

推荐答案

ESS将R作为异步进程运行.您不需要任何背景.您可以将代码运行几个小时,并且仍可在ESS中不间断地工作.

ESS runs R as asynchronous process. You don't need to background anything. You can run your code for hours and still work in ESS uninterrupted.

您的问题似乎是另外一回事.当您执行脚本时,您可以明显地"执行它,即您执行的代码被打印到终端上.这会导致Emacs冻结.

Your problem seems to be something else. When you execute your script you do it "visibly", i.e. your executed code is printed to the terminal. This cause Emacs to freeze.

ess-eval-visibly设置为nil,大量代码将立即发送到R:

Set ess-eval-visibly to nil and huge chunks of code will be sent to R instantly:

(setq ess-eval-visibly nil)

干杯.

[更新]

在最新版本的ESS中,ess-eval-visibply有一个新设置-'nowait.它将您的代码放在下级缓冲区中,然后将其发送到子进程.这样,您可以随后查看代码和所有输出,而无需等待子进程完成.

There is a new setting for ess-eval-visibply in recent versions of ESS - 'nowait. It places your code in an inferior buffer and then sends it to the subprocess. In this way you can see your code and all the output afterwards without waiting for the subprocess to finish.

[/update]

[/update]

这篇关于如何在ESS/Emacs中后台执行R进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆