如何从 Emacs 中自动加载 leiningen repl?

发布于 2024-10-05 02:05:34 字数 426 浏览 0 评论 0原文

我正在使用 Emacs,与 Leiningen 的 swank 集成。每次我需要开始使用 .clj 文件时,我都必须:

  1. 从控制台运行 emacs pack/my-ns.clj
  2. 输入Mx lein-swank
  3. 编译缓冲区。
  4. 在 Clojure REPL 中更改命名空间,即输入 (in-ns 'pack.my-ns)

如何自动执行此过程以从控制台运行类似 emacs-clj pack/my-ns.clj 并让我的环境准备好使用?

I'm using Emacs, integrated with Leiningen's swank. Each time I need to start working with .clj file I have to:

  1. Run emacs pack/my-ns.clj from console.
  2. Type M-x lein-swank.
  3. Compile buffer.
  4. In Clojure REPL change namespace, i.e. type (in-ns 'pack.my-ns).

How can I automate this process to just run from console something like emacs-clj pack/my-ns.clj and get my environment ready to use?

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

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

发布评论

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

评论(2

ぺ禁宫浮华殁 2024-10-12 02:05:34

我没有你提出的问题的答案,但你应该能够在 Clojure 文件中用 Cc Mp 替换第四步,然后 emacs 应该提示你想要什么命名空间与自动检测到的文件的名称空间一起使用,因此您只需按 Enter 键即可。 Cc Mp 映射到 slime-repl-set-package

更新:

刚刚偶然发现

I don't have an answer to the question you posed, but you should be able to replace your 4th step with C-c M-p while in your Clojure file and then emacs should prompt you as to what namespace you want to be in with the namespace of the file auto-detected so you can simply hit enter. C-c M-p maps to slime-repl-set-package.

Update:

Just stumbled across this. Should be able to take what is said in that answer and modify it so upon initial connection to swank files get compiled. Could also set it up to automatically switch to namespace and make the repl buffer active.

听风念你 2024-10-12 02:05:34

Swank 在启动时应该自动加载 project.clj 中 :repl-init-script 指向的命名空间,因此如果您想将其设置为起始命名空间,这应该可以帮助您开始。

Swank should automatically load the namespace pointed to by :repl-init-script in project.clj when it starts, so if you want to set that to your starting namespace, that should get you started.

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