有没有一种快速的方法可以连接 clojure swank 和 slime 以在 emacs 中快速复制?

发布于 2024-11-26 16:33:17 字数 644 浏览 5 评论 0原文

我有一个问题:

当我将 emacs 与 clojure 和 elein (leiningen 扩展)一起使用时,我将代码写入文件内,然后我需要连接到 swang,我输入“elein swank”并打开 conexion...2 步骤)我打开一个 repl...3) 我输入 slime-connect (然后按 y 两次)4) 这一步真的很烦人:我需要使用我的文件或更改名称空间...

到目前为止一切顺利...问题是如果里面我的文件有一个小错误(可能是括号)现在我侮辱我的代码并且我已经重复所有步骤......再次!

对我来说这真的很烦人,我真的很喜欢 emacs,我已经使用它很长时间并且是最好的编辑器,但是将它与 netbeans 进行比较(我今天尝试这个......它很好,但它的 repl 很糟糕......)与 netbeans我只需要单击一下即可完成所有这些步骤...

我可以按“加载文件”,这会将我的文件加载到 repl 中...说真的! 如果我在 NS 中按引用别名/文件,它会打开 repl 并更改名称空间...现在很好

...我的问题是是否可以在 emacs 中创建一个命令而不是制作所有内容...也许,这会非常好。 .a 命令而不是打开 repl 并加载我的文件或我的 ns...会很棒...可能吗?...有人这样做吗?...非常感谢,祝您

有美好的一天!

I've a question:

When I use emacs with clojure and elein (leiningen extension) I write my code inside a file, then I need connect to swang, I type "elein swank" and open the conexion...2 step) I open a repl...3) I type slime-connect (and press y two times) 4) this step is really annoying: I need use my file or change the namespace...

so far so good..the problem is if inside my file there is a little mistake (maybe a parentheses) now I insult my code and I've repeat all steps...again!!

for me this is really annoying, I really like emacs, I've used this for long time and is the best editor, but comparing this to netbeans (I try this today..It's nice but its repl suck...) with netbeans I only need ONE click for do all these steps...

I can press "load file" and this load my file inside repl....seriously!!
and if I press refer alias/file in NS it open the repl and change the namespace...so good

now..my question is if is possible create a command inside emacs than make everything..maybe and it would be really nice..a command than open a repl and load my file or my ns...would be great...is it possible?...has someone do it??..thanks

thanks a lot a have a good day!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

雨落□心尘 2024-12-03 16:33:17

elein-swank 应该会在为您启动后自动连接到 swank 后端。最近修复的一个错误阻止了某些 swank-clojure 版本的这种情况,因此您可能需要将 elein.el 更新到最新版本。

您可以使用 elein-reswank 重新启动后端并在必要时重新连接。

一旦运行,Cc Ck 将在后端编译并加载 .clj 文件。 Cc Cz 会将您从任何 clojure 源缓冲区转到 REPL。

希望这些技巧将有助于简化您的 emacs/slime 体验——这确实是一个很好的工作环境,所以如果可以的话请坚持下去! :-)

elein-swank should automatically connect to the swank backend after starting it for you. There was a recently-fixed bug which prevented this for some swank-clojure versions, so you might want to update your elein.el to the latest version.

You can use elein-reswank to restart the backend and reconnect to it if necessary.

Once it's running, C-c C-k will compile and load a .clj file in the backend. C-c C-z will flip you to the REPL from any clojure source buffer.

Hopefully those tips will help to streamline your emacs/slime experience -- it's really a nice working environment, so stick with it if you can! :-)

忘羡 2024-12-03 16:33:17

如果您还没有尝试过,您可能想尝试一下 swank-clojure。

使用 swank-clojure,您只需 Mx clojure-jack-in,它就会加载 REPL。如果您从 project.clj 文件中调用它,它会使项目的所有命名空间可用。启动需要几秒钟,但之后就非常容易,您无需重新加载。

You might want to try out swank-clojure if you aren't already.

With swank-clojure you just M-x clojure-jack-in and it loads the REPL. If you call it from within a project.clj file, it makes all the namespaces of your project available. It takes a few seconds to start, but after that it's very easy and you don't have to reload.

云淡风轻 2024-12-03 16:33:17

如果您犯了一个错字,为什么需要重新加载所有内容?您只需运行 lein swank 一次并使用 slime-connect 连接到 swank ...然后您就可以根据需要加载和评估您的代码。要(重新)加载文件,您可以使用 slime-load-file 命令,该命令绑定到 Cc Cl...

您还可以查看 来自新鲜 clojure-mode 的 Mx clojure-jack-in 命令...

PS 我个人运行一整天(有时甚至几天)的 swank 会话,没有离开它,编写新代码,评估它,等等。

Why you need to reload everything if you made one typo? You just need to run lein swank once and connect to swank using slime-connect... And then you can load and evaluate your code as you want. To (re-)load your file you can use slime-load-file command, that is bound to C-c C-l...

You can also to look to M-x clojure-jack-in command from fresh clojure-mode...

P.S. I personally run swank sessions for a whole day (and sometime several days), without leaving it, writing new code, evaluating it, etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文