首页 > 解决方案 > 'cider-jack-in' 在没有 clojure 项目的情况下运行 clojure 而不是 leiningen

问题描述

我试图在没有我只想运行 Clojure REPL 的 Clojure 项目的情况下从 emacs 执行“cider-jack-in”。但是我发现苹果酒正在尝试运行/usr/local/bin/clojure/usr/local/bin/lein不是参考我profiles.clj的 Leiningen 设置。lein当我尝试使用 Clojure 项目时,它通常可以使用。

我想知道有什么原因,即使我lein repl在终端中尝试没有 Clojure 项目时没有问题,我希望 Cider 这样做,以及设置通过 Cider 运行 Leiningen 的方法,而不需要 Clojure 项目。

我将不胜感激对此的任何评论。

标签: emacsclojureleiningencider

解决方案


在 CIDER 0.18(当前稳定版本)上,您需要设置cider-jack-in-default为符号,而不是字符串(例如'lein)。

(define-obsolete-variable-alias 'cider-default-repl-command 'cider-jack-in-default)
(defcustom cider-jack-in-default (if (executable-find "clojure") 'clojure-cli 'lein)
  "The default tool to use when doing `cider-jack-in' outside a project.
This value will only be consulted when no identifying file types, i.e.
project.clj for leiningen or build.boot for boot, could be found.

As the Clojure CLI is bundled with Clojure itself, it's the default.
In the absence of the Clojure CLI (e.g. on Windows), we fallback
to Leiningen."
  :type '(choice (const 'lein)
                 (const 'boot)
                 (const 'clojure-cli)
                 (const 'shadow-cljs)
                 (const 'gradle))
  :group 'cider
  :safe #'symbolp
  :package-version '(cider . "0.9.0"))

旧变量确实接受了一个字符串,这是真的。如果没有看到完整的堆栈跟踪,我无法确定您到底出了什么问题。一般来说,最好在 CIDER 的问题跟踪器上提出此类问题。

如果有人想知道为什么现在 CIDER 使用clojure-cli而不是lein用于无项目 REPL - 我们的想法是 Clojure CLI 是我们可以假设每个 Clojure 用户都会拥有的唯一工具,因此它是一个更安全的默认设置。


推荐阅读