使用 `cider-jack-in` 在 Emacs 中执行 Clojure
Executing Clojure in Emacs with `cider-jack-in`
我正在尝试 运行 安装了 cider 软件包的 Clojure emacs。
我在 Mac OS X 10.10.4 上使用 Emacs 24.5.1。
我下载了 lein
脚本并将脚本复制到 ~/Dropbox/bin。
我与 lein repl
确认 Clojure 工作正常。
苹果酒包与 M-x package-install
一起安装。我编辑了 ~/.emacs.d/init.el
以指定 lein 脚本:(add-to-list 'exec-path "~/Dropbox/bin")
以及来自 Can't launch `lein` REPL in Emacs.
的提示
然而,当我启动 emacs 和 运行 M-x cider-jack-in
时,我得到了这个错误信息:
当我启动 lein repl
并执行 M-x cider-connect
(http://xahlee.info/clojure/clojure_emacs_cider.html) 时,我可以在 Emacs 中使用 cider-repl 运行ning。
可能出了什么问题?
最快的解决方法是象征性地 link 进入 Emacs 可以找到它的路径。这行代码解决了这个问题。
sudo ln -s ~/Dropbox/bin/lein /usr/local/bin/lein
我总结了在 emacs 上为 运行ning Clojure 安装 cider 包的步骤,没有任何错误或警告。
苹果酒 - https://github.com/clojure-emacs/cider
安装
- 下载 lein https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
- 我复制了文件 ~/Dropbox/bin 使其可执行后。
看来/usr/local/bin不是Emacs自动查找二进制文件的路径,所以我不得不设置它。
- 运行
sudo ln -s ~/Dropbox/bin/lein /usr/local/bin/lein
- 更新
~/.emacs.d/init.el
以指定 lein 脚本的位置:
(add-to-list 'exec-path "/usr/local/bin")
更新~/.lein/profiles.clj
- Installation of cider-nrepl
{:user {:plugins [[cider/cider-nrepl "0.10.0-SNAPSHOT"]]}}
- 运行
lein deps
错误及解决方法
如果出现错误 The lein executable (specified by
cider-lein-command' 或 cider-boot-command') isn't on your exec-path
:
- 创建符号 link,并按照说明更新
init.el
。
如果出现错误"Symbol's function definition is void: clojure-project-dir",是因为包版本不匹配。
- http://www.braveclojure.com/using-emacs-with-clojure/
- 删除
~/emacs.d/elpa
中的旧包
- clojure 模式
- 苹果酒-*
- 然后,在 Emacs 中 运行
package-install
- clojure 模式
- 苹果酒
现在,所有警告都消失了。
参考资料
- Can't launch `lein` REPL in Emacs
- 苹果酒 - https://github.com/clojure-emacs/cider
已添加
对于 Mac OS X,brew install leiningen
可以安装 lein,但这导致了 中的问题。这是来自 lein brew 的消息。
nREPL server started on port 61216 on host 127.0.0.1 - nrepl://127.0.0.1:61216
REPL-y 0.3.5, nREPL 0.2.6
Clojure 1.6.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_45-b14
我不得不使用 lein 站点上的 lein 来获取正确版本的工具。
Retrieving org/clojure/clojure/1.2.0/clojure-1.2.0.pom from central
nREPL server started on port 61279 on host 127.0.0.1 - nrepl://127.0.0.1:61279
REPL-y 0.3.7, nREPL 0.2.7
Clojure 1.7.0
另一个简单的解决方案是只使用自制软件。虽然 homebrew 只是为了安装 lein 有点矫枉过正,但如果你已经在使用它,那么你需要做的就是 运行
brew update
brew install leiningen
大功告成。我使用 homebrew 来安装 emacs 和其他一些有用的应用程序,所以我已经在我的系统上安装了它。
我正在尝试 运行 安装了 cider 软件包的 Clojure emacs。 我在 Mac OS X 10.10.4 上使用 Emacs 24.5.1。
我下载了 lein
脚本并将脚本复制到 ~/Dropbox/bin。
我与 lein repl
确认 Clojure 工作正常。
苹果酒包与 M-x package-install
一起安装。我编辑了 ~/.emacs.d/init.el
以指定 lein 脚本:(add-to-list 'exec-path "~/Dropbox/bin")
以及来自 Can't launch `lein` REPL in Emacs.
然而,当我启动 emacs 和 运行 M-x cider-jack-in
时,我得到了这个错误信息:
当我启动 lein repl
并执行 M-x cider-connect
(http://xahlee.info/clojure/clojure_emacs_cider.html) 时,我可以在 Emacs 中使用 cider-repl 运行ning。
可能出了什么问题?
最快的解决方法是象征性地 link 进入 Emacs 可以找到它的路径。这行代码解决了这个问题。
sudo ln -s ~/Dropbox/bin/lein /usr/local/bin/lein
我总结了在 emacs 上为 运行ning Clojure 安装 cider 包的步骤,没有任何错误或警告。
苹果酒 - https://github.com/clojure-emacs/cider
安装
- 下载 lein https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
- 我复制了文件 ~/Dropbox/bin 使其可执行后。
看来/usr/local/bin不是Emacs自动查找二进制文件的路径,所以我不得不设置它。
- 运行
sudo ln -s ~/Dropbox/bin/lein /usr/local/bin/lein
- 更新
~/.emacs.d/init.el
以指定 lein 脚本的位置:(add-to-list 'exec-path "/usr/local/bin")
- 运行
更新
~/.lein/profiles.clj
- Installation of cider-nrepl
{:user {:plugins [[cider/cider-nrepl "0.10.0-SNAPSHOT"]]}}
- 运行
lein deps
错误及解决方法
如果出现错误
The lein executable (specified by
cider-lein-command' 或cider-boot-command') isn't on your exec-path
:- 创建符号 link,并按照说明更新
init.el
。
- 创建符号 link,并按照说明更新
如果出现错误"Symbol's function definition is void: clojure-project-dir",是因为包版本不匹配。
- http://www.braveclojure.com/using-emacs-with-clojure/
- 删除
~/emacs.d/elpa
中的旧包- clojure 模式
- 苹果酒-*
- 然后,在 Emacs 中 运行
package-install
- clojure 模式
- 苹果酒
现在,所有警告都消失了。
参考资料
- Can't launch `lein` REPL in Emacs
- 苹果酒 - https://github.com/clojure-emacs/cider
已添加
对于 Mac OS X,brew install leiningen
可以安装 lein,但这导致了
nREPL server started on port 61216 on host 127.0.0.1 - nrepl://127.0.0.1:61216
REPL-y 0.3.5, nREPL 0.2.6
Clojure 1.6.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_45-b14
我不得不使用 lein 站点上的 lein 来获取正确版本的工具。
Retrieving org/clojure/clojure/1.2.0/clojure-1.2.0.pom from central
nREPL server started on port 61279 on host 127.0.0.1 - nrepl://127.0.0.1:61279
REPL-y 0.3.7, nREPL 0.2.7
Clojure 1.7.0
另一个简单的解决方案是只使用自制软件。虽然 homebrew 只是为了安装 lein 有点矫枉过正,但如果你已经在使用它,那么你需要做的就是 运行
brew update
brew install leiningen
大功告成。我使用 homebrew 来安装 emacs 和其他一些有用的应用程序,所以我已经在我的系统上安装了它。