简体   繁体   English

如何通过TRAMP / Emacs远程控制nrepl-ritz-jack-in工作

[英]How can I make nrepl-ritz-jack-in work remotely over TRAMP / Emacs

What I want: 我想要的是:

I have a clojure program on a remote site, let's call it mccarthy . 我在远程站点上有一个clojure程序,我们称之为mccarthy What I want to do is connect to a nrepl-ritz from my laptop, preferably using nrepl-ritz-jack-in . 我想要做的是从我的笔记本电脑连接到nrepl-ritz ,最好使用nrepl-ritz-jack-in The jack in works fine for a local program, but doesn't seem to connect to a remote program. 插孔适用于本地程序,但似乎没有连接到远程程序。

Attempt 1 尝试1

Cx Cf on /mccarthy:code/program/project.clj Cx Cf on /mccarthy:code/program/project.clj

(require 'nrepl-ritz)

Mx nrepl-ritz-jack-in Mx nrepl-ritz-jack-in

Result 结果

Emacs appears to hang. Emacs似乎挂了。 If I go to the *nrepl-server* buffer, I see this: 如果我转到*nrepl-server*缓冲区,我会看到:

Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.flatland.drip.Main.invoke(Main.java:117)
    at org.flatland.drip.Main.start(Main.java:88)
    at org.flatland.drip.Main.main(Main.java:64)
Caused by: java.lang.AssertionError: Assert failed: project
    at leiningen.ritz_nrepl$start_jpda_server.invoke(ritz_nrepl.clj:23)
    at leiningen.ritz_nrepl$ritz_nrepl.doInvoke(ritz_nrepl.clj:95)

(and tons of other lines, too...) (还有很多其他线路......)

I am using drip on my laptop, but not on mccarthy , so clearly nrepl-ritz-jack-in is not detecting that it's a remote file. 我在笔记本电脑上使用drip ,但不是在mccarthy ,所以很明显nrepl-ritz-jack-in没有检测到它是一个远程文件。 Regular old nrepl-jack-in will work as expected in this case, however. 然而,在这种情况下,常规的旧nrepl-jack-in将按预期工作。

Attempt 2 尝试2

I also tried starting an nrepl-ritz using lein on mccarthy : 我也尝试在mccarthy上使用lein一个nrepl-ritz

mattox@mccarthy$ lein ritz-nrepl
nREPL server started on port 42874

From my laptop I forward a port so local 42874 connects to 42874 on mccarthy : 从我的笔记本电脑,我转发端口,因此本地42874连接到42874mccarthy

ssh -L 42874:localhost:42874 -N mccarthy

Then, from my local Emacs: 然后,从我当地的Emacs:

(require 'nrepl-ritz)

Mx nrepl Mx nrepl

Host: 127.0.0.1 主持人: 127.0.0.1

Port: 42874 港口: 42874

This gives me a connection: 这给了我一个联系:

; nREPL 0.1.7-preview
user> 

So to test it out, I run 所以为了测试它,我跑了

Mx nrepl-ritz-threads Mx nrepl-ritz-threads

It gives me a nice table of threads. 它给了我一个很好的线程表。

Mx nrepl-ritz-break-on-exception Mx nrepl-ritz-break-on-exception

user> (/ 1 0)

Result 结果

This hangs, but sometimes shows a hidden debugging buffer with some restarts available. 这会挂起,但有时会显示一个隐藏的调试缓冲区,并且可以重启一些。 If I tell it to pass the exception back to the program, it never gives control back to the REPL. 如果我告诉它将异常传递回程序,它永远不会将控制权交还给REPL。

I've done plenty of searches but have not been able to get anything more specific than "make sure lein is on your path" (And I did do that, on both machines...). 我已经做了大量的搜索,但是没有能够得到比“确保lein在你的路上”更具体的东西(而且我确实在两台机器上都这样做了......)。

If the repl is still running from the previous cider-jack-in, you should either use the cidercommand to connect to the running instance, or stop the previous before starting a new one 如果repl仍在从前一个cider-jack-in运行,你应该使用cidercommand连接到正在运行的实例,或者在开始一个新的之前停止前一个

From Here ` Clojure - connection issue re-running cider-jack-in 从这里` Clojure - 连接问题重新运行cider-jack-in

Also see this https://devcenter.heroku.com/articles/debugging-clojure 另请参阅此https://devcenter.heroku.com/articles/debugging-clojure

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM