用`cider-jack-in`在Emacs中执行Clojure

pro*_*eek 4 emacs clojure cider leiningen read-eval-print-loop

我正在尝试运行安装了苹果酒包的Clojure emacs.我在Mac OS X 10.10.4上使用Emacs 24.5.1.

I downloaded lein script and copied the script in ~/Dropbox/bin. I checked with lein repl that Clojure works fine.

cider package is installed with M-x package-install. I edited the ~/.emacs.d/init.el to specify the lein script: (add-to-list 'exec-path "~/Dropbox/bin") with the hint from Can't launch `lein` REPL in Emacs.

However, when I started emacs and run M-x cider-jack-in, I have this error message:

在此输入图像描述

When I started lein repl and executed M-x cider-connect (http://xahlee.info/clojure/clojure_emacs_cider.html), I can have the cider-repl running in Emacs.

在此输入图像描述

What might be wrong?

pro*_*eek 16

最快的解决方案是将lein象征性地链接到Emacs可以找到它的路径.这行代码解决了这个问题.

sudo ln -s ~/Dropbox/bin/lein /usr/local/bin/lein
Run Code Online (Sandbox Code Playgroud)

我总结了在emacs上安装用于运行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

    • 安装cider-nrepl
    • {:user {:plugins [[cider/cider-nrepl "0.10.0-SNAPSHOT"]]}}
    • lein deps

错误和解决方案

  • 如果出现错误The lein executable (specified bycider-lein-command' cider-boot-command') isn't on your exec-path:

    • 制作符号链接,并按init.el说明更新.
  • 如果出现错误"符号的函数定义无效:clojure-project-dir",则是因为包版本不匹配.

现在,所有的警告都消失了.

在此输入图像描述

参考

添加

对于Mac OS X,brew install leiningen可以安装lein,但是这引起了如何升级leiningen的nrepl版本的问题?.这是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
Run Code Online (Sandbox Code Playgroud)

我不得不使用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
Run Code Online (Sandbox Code Playgroud)