Mac OSX,Emacs 24.2和nrepl.el无法正常工作

时间:2012-11-06 01:19:49

标签: emacs clojure leiningen

我正在使用nrepl.elEmacs 24.2。我的S.O版本是OS X Lion 10.7.5。

通过REPL [M-x] nrepl开始lein会话后运行命令(:~ $ lein repl)我能够连接到它但是如果我尝试使用[M-x] nrepl-jack-in我得到消息:

  进程中的

错误:无法启动nREPL服务器:/ bin / bash:   lein:找不到命令

我使用instructions in the main site安装了leiningen,并使用brew install leiningen --devel使用/usr/loca/bin命令重新安装了leiningen,但这两种方法都给出了同样的错误。

将路径exec-path添加到emacs nrepl.el列表或尝试配置nrepl-lein-command变量{{1}}以指向我的lein安装的完整路径无济于事。

我的emacs配置可以在这里找到:homebrew

我做错了什么?

谢谢:)

4 个答案:

答案 0 :(得分:12)

对于那些登陆此问题的人使用Mac:

莱因需要走在Emacs所看到的道路上。这可以通过从bash

启动Emacs来完成
/Applications/Emacs.app/Contents/MacOS/Emacs project.clj

然后:   M-x nrepl-jack-in

如果这样可以解决问题,您可以按照these instructions

配置emacs以使用正确的路径

答案 1 :(得分:12)

虽然@Arthur是正确的,但更简单的解决方案是安装exec-path-from-shell Emacs扩展程序。它会自动且相当可靠地将您的shell PATH(和MANPATH)复制到Emacs。这意味着无论您从哪里开始使用Emacs(包括聚光灯),PATH都是正确的。

答案 2 :(得分:2)

如果您在Linux中看到此错误,则在从菜单而不是shell运行emacs时,可能需要在〜/ .bash_profile而不是〜/ .bashrc中设置PATH。

答案 3 :(得分:1)

我必须这样做:

;; set the path as terminal path [http://lists.gnu.org/archive/html/help-gnu-emacs/2011-10/msg00237.html]
(setq explicit-bash-args (list "--login" "-i"))

;; fix the PATH variable for GUI [http://clojure-doc.org/articles/tutorials/emacs.html#osx] 

(defun set-exec-path-from-shell-PATH ()
  (let ((path-from-shell
         (shell-command-to-string "$SHELL -i -l -c 'echo $PATH'")))
    (setenv "PATH" path-from-shell)
    (setq exec-path (split-string path-from-shell path-separator))))

(when window-system (set-exec-path-from-shell-PATH))