我的 emacs/slime 设置有什么问题(编译和加载/评估不起作用)?

发布于 2024-10-09 05:24:38 字数 946 浏览 0 评论 0原文

我可以运行 emacs 并启动 slime(使用 Mx slime)。此时,我在 inferior-lisp 缓冲区中获取了 REPL,并且可以在那里运行 lisp。但是,当我在另一个缓冲区中打开 lisp 代码时,所有的 slime-goodness 都不起作用(Cx CeCc Ck 等),而且我一直在 中看到这一点消息缓冲区(计数递增):

slime-connection:未连接。

投票 “/var/folders/B9/B9B5J15dH+aNt5J5gkROEk+++TI/-Tmp-/slime.3202”..(使用 `Mx 中止 slime-abort-connection'.) [69 次]

让我觉得 slime 没有连接到正确的 lisp 解释器,但由于我对 emacs 和 lisp 很陌生,所以我被困在这里。我的设置是:

I can run emacs and start slime (with M-x slime). At this point I get the REPL in the inferior-lisp buffer and can run lisp there. But when I open up lisp code in another buffer none of the slime-goodness works (C-x C-e, C-c C-k etc.) and I keep seeing this in the Messages buffer (with an increasing count-number):

slime-connection: Not connected.

Polling
"/var/folders/B9/B9B5J15dH+aNt5J5gkROEk+++TI/-Tmp-/slime.3202".. (Abort with `M-x
slime-abort-connection'.) [69 times]

Makes me think slime is not connecting to the correct lisp interpreter, but since I am very new to emacs and lisp I am stuck here. My setup is:

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

长梦不多时 2024-10-16 05:24:38

以下是我为使 Common Lisp 和 Clojure 与优秀的 emacs-starter-kit 一起在同一个 Emacs 安装中工作而所做的工作。这不会让你同时使用两者(你必须重新启动 Emacs 才能从 CL 切换到 Clojure,反之亦然)

我相信 ELPA 中的 SLIME 版本很旧,但适用于 Clojure。较新版本的 SLIME 不适用于 Clojure。此外,这个版本的 SLIME 似乎被精简了(没有 swank-loader.el?)并且无法与 Common Lisp 一起使用。

这些是我为使其发挥作用而采取的步骤,这对我来说很有效。所有的部分都在积极开发中,所以我认为这方面的破坏很可能。

使用全新的 Emacs(根本没有任何配置,因此暂时将任何 .emacs 移动到其他地方)安装 ELPA:

http://tromey.com/elpa/install.html

在 Emacs 中,安装软件包“slime”和“slime-repl”。 (Mx package-list-packages 然后 Cs slime 然后 i 选择并 x 安装)

移动文件将 ~/.emacs.d/elpa/slime-20100404~/.emacs.d/elpa/slime-repl-20100404 复制到新目录,如 ~/hacking/lisp/elpa-slime

放弃 ELPA 安装:$ rm -rf .emacs.d

现在克隆 emacs-starter-kit 并将其移动到 .emacs.d。我只使用了来自 technomancy 的 Github 的新副本来完成此操作,因此如果您遇到问题,请先尝试一下。

使用 CVS 获取最新的 SLIME:

cvs -d :pserver:anonymous:[email protected]:/project/slime/cvsroot co cvs-slime

我认为 OS X 没有安装 CVS,因此您需要从 Macports、Homebrew 等安装它。

我将 cvs-slime 放入 ~/hacking/lisp 中。

希望下面的 Emacs Lisp 的作用显而易见:

(defun slime-common-lisp ()
  (interactive)
  (setq inferior-lisp-program "/usr/local/bin/sbcl") ; your Common Lisp impl
  (add-to-list 'load-path "~/hacking/lisp/cvs-slime/")  ; your SLIME from CVS directory
  (require 'slime)
  (slime-setup '(slime-repl))
  (slime))

(defun slime-clojure ()
  (interactive)
  (add-to-list 'load-path "~/hacking/lisp/elpa-slime")
  (require 'slime)
  (slime-setup '(slime-repl))
  (slime-connect "localhost" 4005))

对于 Clojure,您必须在端口 4005 上启动 Clojure 运行时和 swank-clojure ,我认为使用 Leiningen 是经过批准的方法:

创建一个新项目:

$ lein new project
$ cd project

project.clj 中:

(defproject newclj "1.0.0-SNAPSHOT"
    :description "FIXME: write"
    :dependencies [[org.clojure/clojure "1.2.0"]
                   [org.clojure/clojure-contrib "1.2.0"]]
    :dev-dependencies [[swank-clojure "1.2.1"]])

然后:

$ lein deps
$ lein swank

编辑添加:

如果您在使用此设置时发现 SLIME REPL 中的 Paredit 损坏,请检查以下内容:
http://www.emacswiki.org/emacs/ParEdit#toc3

至少一个另一个潜在的问题是,据我所知,如果您打开 Common Lisp 源文件然后启动 SLIME,您将无法将表单从第一个缓冲区发送到 SLIME 缓冲区。因此,在打开任何 Common Lisp 源文件之前打开一个 SLIME 缓冲区,它应该可以工作。这似乎不适用于 Clojure。

参考文献:

使用 slime-fancy (slime-autodoc) 为 clojure 和 common lisp 设置 emacs

https://github.com/technomancy/swank-clojure/issues/close#issue/31/comment/544166

The following is what I did to get Common Lisp and Clojure to work in the same Emacs installation, along with the excellent emacs-starter-kit. This won't let you use both at the same time (you have to restart Emacs to switch from CL to Clojure or vice versa)

I believe that the version of SLIME in ELPA is old, but works for Clojure. Newer version of SLIME won't work for Clojure. Additionally, this version of SLIME seems to be stripped down (no swank-loader.el?) and won't work with Common Lisp.

These are the steps I did to get this to work, it's just what worked for me. All of the bits are under active development, so I think breakage in this area is pretty likely.

With a fresh Emacs (no configuration at all, so move anything .emacs somewhere else for the moment) install ELPA:

http://tromey.com/elpa/install.html

From within Emacs, install the packages "slime" and "slime-repl". (M-x package-list-packages then C-s slime then i to select and x to install)

Move the files in ~/.emacs.d/elpa/slime-20100404 and ~/.emacs.d/elpa/slime-repl-20100404 to a new directory like ~/hacking/lisp/elpa-slime.

Throw out the ELPA install: $ rm -rf .emacs.d.

Now clone the emacs-starter-kit and move it to .emacs.d. I only did this with a fresh copy from technomancy's Github, so try that first if you have problems.

Get the latest SLIME with CVS:

cvs -d :pserver:anonymous:[email protected]:/project/slime/cvsroot co cvs-slime

I don't think OS X comes with CVS installed, so you'll need to install it from Macports, Homebrew or something.

I put cvs-slime in ~/hacking/lisp.

Hopefully it's obvious what the Emacs Lisp below does:

(defun slime-common-lisp ()
  (interactive)
  (setq inferior-lisp-program "/usr/local/bin/sbcl") ; your Common Lisp impl
  (add-to-list 'load-path "~/hacking/lisp/cvs-slime/")  ; your SLIME from CVS directory
  (require 'slime)
  (slime-setup '(slime-repl))
  (slime))

(defun slime-clojure ()
  (interactive)
  (add-to-list 'load-path "~/hacking/lisp/elpa-slime")
  (require 'slime)
  (slime-setup '(slime-repl))
  (slime-connect "localhost" 4005))

For Clojure you'd have to start the Clojure runtime and swank-clojure on port 4005, I think using Leiningen is the approved method:

Create a new project:

$ lein new project
$ cd project

In project.clj:

(defproject newclj "1.0.0-SNAPSHOT"
    :description "FIXME: write"
    :dependencies [[org.clojure/clojure "1.2.0"]
                   [org.clojure/clojure-contrib "1.2.0"]]
    :dev-dependencies [[swank-clojure "1.2.1"]])

Then:

$ lein deps
$ lein swank

Edited to add:

If you find that Paredit in the SLIME REPL is broken while using this setup, check this out:
http://www.emacswiki.org/emacs/ParEdit#toc3

At least one other potential issue with this is that, AFAICT, if you open a Common Lisp source file and then start SLIME, you won't be able to send forms from the first buffer to the SLIME buffer. So open a SLIME buffer before opening any Common Lisp source files, and it should work. This doesn't seem to apply to Clojure.

References:

emacs setup for both clojure and common lisp with slime-fancy (slime-autodoc)

https://github.com/technomancy/swank-clojure/issues/closed#issue/31/comment/544166

羁绊已千年 2024-10-16 05:24:38

如果您在系统中正确安装了 slime,那么最好使用 sbcl 并在 ~/.emacs 中添加以下行
<代码>
(setq 下级 lisp 程序“/usr/bin/sbcl”)

/usr/bin/sbcl 可能会根据您的 sbcl 安装路径而有所不同。

If u have correctly install slime in your system then better use sbcl and add the following line in your ~/.emacs

(setq inferior-lisp-program "/usr/bin/sbcl")

/usr/bin/sbcl can be different according to your sbcl installation path.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文