设置 SLIME 和 SLIME Emacs 中 Clojure 的 Inferior-Lisp

发布于 2024-12-02 12:43:48 字数 2098 浏览 1 评论 0 原文

SLIME

我对 Clojure 和 Slime 都很陌生。 emacs 和我一直在尝试为 Clojure 设置 SLIME。 官方文档隐含地假设您知道使用 emacs 做什么。您不仅仅可以将一堆代码粘贴到配置文件中。由于我对用于数据分析的 Clojure 感兴趣,如果可能的话,我真的不想与 Leiningen 打交道,但我想要 slime 提供的动态环境。

我已经在 /opt/clojure/ 中从 git 安装了 Clojure,并在 /opt/clojure-contrib 中安装了 clojure-contrib,我可以得到一个 repl。我按照本教程从github在`~/.bin中安装了swank-clojure、clojure-mode和slime 。当这不起作用时,我通过添加官方文档的评论部分中的一些内容来更改一些内容。

当我使用 Mx slime 启动 slime 时,我得到连续的轮询“/tmp/slime.141​​13”..(使用“Mx slime-abort-connection”中止。)

这是我的 init-clj.el

;; clojure-mode
(add-to-list 'load-path "~/.bin/clojure-mode")


;; swank-clojure
(add-to-list 'load-path "~/.bin/swank-clojure")

(setq swank-clojure-jar-path "/opt/clojure/clojure.jar"
  swank-clojure-extra-classpaths (list
                  "~/.bin/swank-clojure/src/swank"
                  "/opt/clojure/clojure-contrib/target/clojure-contrib-1.2.0-SNAPSHOT.jar"))

(require 'swank-clojure)

;; slime
(eval-after-load "slime" 
  '(progn (slime-setup '(slime-repl))))

(add-to-list 'load-path "~/.bin/slime")
(require 'slime)
(eval-after-load 'slime '(setq slime-protocol-version 'ignore))
  (slime-setup '(slime-repl))
(require 'clojure-mode)
(require 'clojure-test-mode)

这是当 ants.clj 打开时调用它时出现的错误:

(progn (load "/home/kca/.bin/slime/swank-loader.lisp" :verbose t) (funcall (read- from-string "swank-loader:init")) (funcall (read-from-string "swank:start-server") "/tmp/slime.14113" :coding-system "iso-latin-1-unix"))

Clojure 1.2.0-master-SNAPSHOT
user=> java.lang.Exception: Unable to resolve symbol: progn in this context (NO_SOURCE_FILE:1)

Inferior Lisp

我在 中编写了一个脚本.bin/ 称为 clj-repl,其中包含启动 repl 的 java 命令。然后我 Mx set-variable lower-lisp-program /home/wdkrnls/.bin/clj-repl。 Emacs 抱怨它的类型错误。

SLIME

I'm pretty new to both Clojure & emacs and I've been trying to set up SLIME for Clojure. The official documentation implicitly assumes you know what your doing with emacs. There isn't just a bunch of code you can stick into your configuration files. Since I am interested in Clojure for Data Analysis, I don't really want to deal with Leiningen if at all possible, but I want the dynamic environment that slime provides.

I have installed Clojure from git in /opt/clojure/ and clojure-contrib in /opt/clojure-contrib and I can get a repl. I installed swank-clojure, clojure-mode, and slime from github in `~/.bin following this tutorial. I changed a few things around when this wasn't working by adding some stuff from the comments section of the official documentation.

When I start slime with M-x slime I get a continuous Polling "/tmp/slime.14113".. (Abort with 'M-x slime-abort-connection'.).

Here is my init-clj.el:

;; clojure-mode
(add-to-list 'load-path "~/.bin/clojure-mode")


;; swank-clojure
(add-to-list 'load-path "~/.bin/swank-clojure")

(setq swank-clojure-jar-path "/opt/clojure/clojure.jar"
  swank-clojure-extra-classpaths (list
                  "~/.bin/swank-clojure/src/swank"
                  "/opt/clojure/clojure-contrib/target/clojure-contrib-1.2.0-SNAPSHOT.jar"))

(require 'swank-clojure)

;; slime
(eval-after-load "slime" 
  '(progn (slime-setup '(slime-repl))))

(add-to-list 'load-path "~/.bin/slime")
(require 'slime)
(eval-after-load 'slime '(setq slime-protocol-version 'ignore))
  (slime-setup '(slime-repl))
(require 'clojure-mode)
(require 'clojure-test-mode)

Here is the error I get when I call it when ants.clj is open:

(progn (load "/home/kca/.bin/slime/swank-loader.lisp" :verbose t) (funcall (read- from-string "swank-loader:init")) (funcall (read-from-string "swank:start-server") "/tmp/slime.14113" :coding-system "iso-latin-1-unix"))

Clojure 1.2.0-master-SNAPSHOT
user=> java.lang.Exception: Unable to resolve symbol: progn in this context (NO_SOURCE_FILE:1)

Inferior Lisp

I made a script in .bin/ called clj-repl that holds the java command to start a repl. I then M-x set-variable inferior-lisp-program /home/wdkrnls/.bin/clj-repl. Emacs complains its the wrong type.

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

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

发布评论

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

评论(2

慵挽 2024-12-09 12:43:48

使用 Clojure 的最佳方法是首先安装 Leiningen

然后安装 Swank Clojure 作为 Leiningen 插件。

接下来,我建议从 .emacs 中剥离当前的自定义 Clojure 设置,并安装 ELPA,然后在 .emacs 文件中设置以下初始化代码:

;; Find this line, added by ELPA:
(require 'package)
;; and add the following expression:
(add-to-list 'package-archives
             '("marmalade" . 
               "http://marmalade-repo.org/packages/") t)
;; ... and the rest of the ELPA init code
(package-initialize)

然后,运行 package-list-packages 并安装 clojure-mode > 和slime(还有 paredit 作为更好的衡量标准),以及您可能想要的任何其他内容。

这应该已经完成​​所有设置并准备好在 (Leiningen) Clojure 项目中使用 SLIME。尽管这里的过程看似复杂,但您可以从项目中创建一个“uberjar”并部署在其他服务器上,完全没有依赖麻烦。

The best way to use Clojure is to start by installing Leiningen.

Then install Swank Clojure as a Leiningen plugin.

Next, I'd recommend stripping your current custom Clojure setup from .emacs, and installing ELPA, and then setting up the following initialization code in your .emacs file:

;; Find this line, added by ELPA:
(require 'package)
;; and add the following expression:
(add-to-list 'package-archives
             '("marmalade" . 
               "http://marmalade-repo.org/packages/") t)
;; ... and the rest of the ELPA init code
(package-initialize)

Then, run package-list-packages and install clojure-mode and slime (and paredit for good measure), and anything else you might want.

This should have you all set up and ready to use SLIME in (Leiningen) Clojure projects. And despite the seemingly complex procedure here, you can create a single "uberjar" from your projects to deploy on other servers with absolutely no dependency hassle.

泪痕残 2024-12-09 12:43:48

尝试这里详细介绍的方法。在干净的 unix 或 mac 机器上从头开始设置所有内容需要几分钟的时间:

http://www.learningclojure.com/2010/08/clojure-emacs-swank-slime-maven-maven.html

Try the method detailed here. It takes a couple of minutes to set everything up from scratch on a clean unix or mac box:

http://www.learningclojure.com/2010/08/clojure-emacs-swank-slime-maven-maven.html

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