我想在本地 R
下的远程框中运行Emacs
(我不想要在远程盒子上运行Emacs。)
(let ((default-directory "/user@remote:~"))
(R))
并且一切正常,但是当与remote
的连接丢失时,R
就会死亡。这并不好,因为这意味着我必须在重新启动后将所有数据重新加载到R
,这需要时间。
是否可以告诉TRAMP
使用持久终端? (GNU Screen
或tmux
或Mosh
或dtach
)
答案 0 :(得分:9)
以下是如何在远程屏幕会话中使用ES和R运行:
ssh到远程主机(在emacs之外)
开始屏幕会话
分离
在emacs(M-x shell
)
在emacs shell中再次ssh到远程主机
恢复屏幕会话(screen -r
)
启动R
最后使用您启动R的shell缓冲区中的M-x ess-remote
将ESS附加到R进程
此帖http://blog.nguyenvq.com/2010/07/11/using-r-ess-remote-with-screen-in-emacs/
中有更多详情,屏幕截图和键绑定答案 1 :(得分:9)
以下是使用dtach的替代方法:
(defvar R-remote-host "remote-server")
(defvar R-remote-session "R")
(defvar R-remote-directory "~")
(defun R-remote (&optional remote-host session directory)
"Connect to the remote-host's dtach session running R."
(interactive (list
(read-from-minibuffer "R remote host: " R-remote-host)
(read-from-minibuffer "R remote session: " R-remote-session)
(read-from-minibuffer "R remote directory: " R-remote-directory)))
(pop-to-buffer (make-comint (concat "remote-" session)
"ssh" nil "-t" "-t" remote-host
"cd" directory ";"
"dtach" "-A" (concat ".dtach-" session)
"-z" "-E" "-r" "none"
inferior-R-program-name "--no-readline"
inferior-R-args))
(ess-remote (process-name (get-buffer-process (current-buffer))) "R")
(setq comint-process-echoes t))
调用 M-x R-remote RET RET RET RET 。
它对我有用。