2017-09-21 28 views
0

我正在使用emacs ess和tramp遠程執行一些R腳本。 我通常在服務器上有一個R腳本,我通過emacs在我的服務器上以交互方式運行它。這項工作一切順利。爲eshcs和tramp傳遞ssh的-X參數

但是我不能設法讓我的R腳本出現劇情窗口。我想從emacs獲得相同的行爲,如果我運行 ssh -X [email protected]
然後以交互方式做一些R,並在我的本地機器上出現圖。

我已經修改了我的.ssh/config中添加ForwardX11 yes選項,它適用於在我的服務器直接查詢SSH而不是使用Emacs /王牌

我也曾嘗試定製流浪漢默認 - 選項模式「(見https://superuser.com/questions/609414/emacs-doesnt-use-ssh-config-when-accessing-files-on-a-remote-machine),但這也不起作用。

我也遇到了這個非常類似的問題: How can I launch an x-window from emacs ess when running R on a server?

但是:

1)接受的答案是沒有直接回答該forwardX問題

2)第二個答案是不工作(我做錯了什麼?或者在某處丟失配置?)

感謝您的幫助,


編輯我使用Emacs 23.1.1在Ubuntu的16.04

回答

0
(with-eval-after-load 'tramp 
    (add-to-list 'tramp-methods 
       '("sshx11" 
       (tramp-login-program  "ssh") 
       (tramp-login-args   (("-l" "%u") ("-p" "%p") ("%c") 
               ("-e" "none") ("-X") ("%h"))) 
       (tramp-async-args   (("-q"))) 
       (tramp-remote-shell   "/bin/sh") 
       (tramp-remote-shell-login ("-l")) 
       (tramp-remote-shell-args ("-c")) 
       (tramp-gw-args    (("-o" "GlobalKnownHostsFile=/dev/null") 
               ("-o" "UserKnownHostsFile=/dev/null") 
               ("-o" "StrictHostKeyChecking=no") 
               ("-o" "ForwardX11=yes"))) 
       (tramp-default-port   22))) 
    (tramp-set-completion-function "sshx11" tramp-completion-function-alist-ssh)) 

這只是一個 「SSH」 方法的副本,與 「-X」 添加到流浪漢的login-ARGS。然後你可以訪問一個文件/目錄C-x C-f /sshx11:[email protected]:path/to/target

+0

嗨,謝謝你的回答。不幸的是,它不工作。 可以肯定的是,我在'.emacs'中添加了這個命令,用/ sshx11打開一個新文件:user @ host:path/to/target啓動了我的R腳本並做了一個簡單的繪圖。什麼都沒發生。 所以我還在'tramp-login-args'中加了'「-X」'。 然後我真的檢查了這個ssh命令行是用來查看緩衝區的,並且沒問題。但是我的情節仍然沒有出現在我的R/tramp會話中。在我的emacs或服務器的配置中可能有問題嗎? –

+0

由於看起來我的問題可能是特定於我的計算機配置,如果其他人可以確認此解決方案解決了他們的問題,我很高興驗證它作爲一般問題的一般答案。雖然因爲我無法檢查自己我寧願等待確認 –

+0

糟糕,我貼錯了東西。現在已經修復了。 – jpkotta