Clojure 1.2 发布了!如何让 swank-clojure 使用这个?
我刚刚安装了一个新的 emacs,安装了 ELPA,并使用 ELPA 安装了 swank-clojure。虽然 Clojure 1.2 已发布,但当我点击“Mx slime”时,它仍然为我下载 Clojure 1.1 而不是 1.2 既然
1.2 可用,我如何让它使用它?我必须手动完成吗?我是否必须等待 slime/swank 更新才能使用 1.2?
更新:感谢您对使用 leiningen 的建议,但我所追求的是 emacs 本身启动 REPL。发生这个问题是因为 ELPA 中的 swank-clojure 包没有更新吗?
I just set up a new emacs installation, installed ELPA and installed swank-clojure with using ELPA. Although Clojure 1.2 is released, when I hit "M-x slime", it still downloaded Clojure 1.1 for me instead of 1.2
How do I get it to use 1.2 now that it's available? Do I have to do it manually? Do I have to wait for slime/swank to be updated to use 1.2?
Update: Thanks for the recommendations for using leiningen, but what I'm after is for emacs to just launch a REPL itself. Is this problem happening because the swank-clojure package in ELPA is not being updated?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
使用 Leiningen 1.3,可以轻松创建独立的 swank 会话:
您可以将 ~/.lein/bin 添加到 $PATH 中以简化此操作。
然后在 Emacs 内部:
可以使用 Mx lein-swank 从 Emacs 内部启动 swank 如果您位于项目目录中。但是,通过 swank-clojure.el 自动下载和安装 Clojure 及其他依赖项很容易出错,因此已被弃用。
With Leiningen 1.3, it's easy to create a standalone swank session:
You can add ~/.lein/bin to your $PATH to make this easier.
Then inside Emacs:
Launching swank from inside Emacs can be done with M-x lein-swank if you are inside a project directory. However, auto-download and install of Clojure and other dependencies via swank-clojure.el is error-prone and deprecated.
我相信,通过您描述的那种设置,Mx slime 会将所有内容放入
~/.clojure
和~/.swank-clojure
在类路径上。您可以通过设置swank-clojure-classpath
变量来自定义它(我将其自定义为仅使用~/.clojure
;这就是我将基本的 jar 集放在有用的地方 选项一旦您需要在类路径上添加更多内容,上述方法就不够了,有两种方法可以管理这些更复杂的情况:
1:启动 Swank,然后连接
最直接的方法是使用。 Leiningen 将其放入您的
project.clj
中:然后使用
lein swank
在项目目录中启动 swank 服务器并使用 Mx slime-connect 从 Emacs 中连接到它作为另一种可能性,David Edgar Liebke 的 cljr 显然会为您启动独立的 Swank 实例;有关详细信息,请参阅 README。
选项 2:从 Emacs
Now 中启动 Swank,以老实说,我自己倾向于从 Emacs 中启动 Swank —— 设置起来可能有点棘手(因此一开始可能不建议这样做),但以后会很方便。请参阅我对旧版本的回答问题是我用来启动 Clojure 特定的 Swank 实例的函数的一个版本,并为 Leiningen 风格的项目提供了正确的类路径配置。
I believe that with the sort of setup that you describe, M-x slime will put everything in
~/.clojure
and~/.swank-clojure
on the classpath. You can customise this by setting theswank-clojure-classpath
variable (I have it customised to use~/.clojure
only; that's where I put the basic set of jars useful for launching one-off experimental REPLs.As soon as you need more stuff on the classpath, the above is inadequate. There are two options for managing those more complex cases:
Option 1: launch Swank, then connect
The most straightforward approach is to use Leiningen. Put this in your
project.clj
:Then use
lein swank
in your project's directory to start a swank server and use M-x slime-connect to connect to it from within Emacs.As another possibility, David Edgar Liebke's cljr will apparently launch stand-alone Swank instances for you; consult the README for details.
Option 2: launch Swank from within Emacs
Now, to be entirely honest, I tend to start Swank from within Emacs myself -- it's maybe a bit trickier to setup (and thus possibly not advisable in the beginning), but quite convenient later on. See my answer to an older question for one version of a function I use to launch Clojure-specific Swank instances complete with proper classpath configuration for Leiningen-style projects.
我使用 leiningen 将 emacs slime 连接到 clojure 实例。在项目中,您总是会遇到一些依赖项,leiningen 很好地将它们放在类路径上。
它使用一个小的 clojure 文件来描述依赖关系,例如:
您可以看到更改版本只需在编辑器中敲击几次键即可。 Leiningen 从网络下载依赖项,这使得项目非常小并且可以快速进行版本控制。
运行 lein swank 会启动程序和 swank 中的 repl :
您现在可以使用 Mx slime-connect 在 emacs 中连接并接受默认值。
I use leiningen to connect emacs slime to the clojure instance. In a project you always end up with a couple of dependencies, which leiningen nicely places on the classpath.
It uses a small clojure file to describe the dependencies, e.g. :
You can see that changing versions is just a couple of keystrokes in an editor. Leiningen downloads the dependencies from the 'net which keeps the projects really smal and fast to version control.
running lein swank starts the program and the repl in swank :
you can now connect in emacs using M-x slime-connect and accept the defaults.
您只需要在点击 Mx slime 之前设置 swank-clojure-classpath 变量
假设您在 c:\jars 下有 clojure.jar、clojure-contrib.jar 和 swank-clojure.jar
在暂存缓冲区中粘贴此
Hit Cx Ce 和 Mx 史莱姆,应该可以了。
有关详细信息,请查看
https://github.com/ jochu/swank-clojure/blob/master/swank-clojure.el#L32-34
http://en.wikibooks.org/wiki/Clojure_Programming/FAQ#Where_does_swank-clojure_.28SLIME.29_look_for_Clojure.27s_jars.3F
You just need to set the swank-clojure-classpath variable before you hit M-x slime
Say if you have the clojure.jar, clojure-contrib.jar and swank-clojure.jar under c:\jars
In the scratch buffer paste this
Hit C-x C-e and the M-x slime , that should do it.
For details checkout
https://github.com/jochu/swank-clojure/blob/master/swank-clojure.el#L32-34
http://en.wikibooks.org/wiki/Clojure_Programming/FAQ#Where_does_swank-clojure_.28SLIME.29_look_for_Clojure.27s_jars.3F