我的emacs / slime设置有什么问题(编译和加载/ eval不工作)? [英] What is wrong with my emacs/slime setup (compile-and-load/eval not working)?

查看:237
本文介绍了我的emacs / slime设置有什么问题(编译和加载/ eval不工作)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以运行emacs并启动粘滞(使用 M-x slime )。在这一点上,我得到了在下面的lisp 缓冲区中的REPL,并且可以在那里运行lisp。但是当我在另一个缓冲区中打开lisp代码时,没有任何一个粘性工具( Cx Ce Cc Ck 等。)并且我在消息缓冲区(随着计数增加)中看到这一点:


- 连接:未连接。



轮询
/var/folders/B9/B9B5J15dH+aNt5J5gkROEk+++ (中止与`Mx
slime-abort-connection'。)[69次]


让我想起泥没有连接到正确的lisp解释器,但是由于我非常新的emacs和lisp我被困在这里。我的设置是:




解决方案

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



我相信SLIME的版本在ELPA是旧的,但适用于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 then Cs slime then i 选择和 x 来安装)



移动〜/ .emacs中的文件.d / elpa / slime-20100404 〜/ .emacs.d / elpa / slime-repl-20100404 c $ c>〜/ hacking / lisp / elpa-slime 。



抛出ELPA安装: $ rm -rf.emacs.d



现在克隆emacs-starter-kit并将其移动到 .emacs。 ð。我只是从技术人员的Github的新的副本中做到这一点,所以先尝试一下,如果你有问题。



获取最新的SLIME与CVS:

  cvs -d:pserver:anonymous:anonymous@common-lisp.net:/ project / slime / cvsroot co cvs-slime 

我不认为OS X安装了CVS,所以你需要从Macports,Homebrew或其他东西安装。 / p>

我把 cvs-slime 〜/ hacking / lisp



希望以下Emacs Lisp可以明显看出:

 (defun slime-common-lisp()
(interactive)
(setq inferior-lisp-program/ usr / local / bin / sbcl);你的Common Lisp impl
你的SLIME从CVS目录
(require'slime)
(slime-setup'(slime-repl)-to-list'load-path〜/ hacking / lisp / cvs-slime / )
(slime))

(defun slime-clojure()
(interactive)
(add-to-list'load-path〜/ hacki ng / lisp / elpa-slime)
(需要粘贴)
(slime-setup'(slime-repl))
(slime-connectlocalhost4005))

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



创建一个新项目:

  $ lein new project 
$ cd project

project.clj

 (defproject newclj1.0.0 
:描述FIXME:写
:依赖[[org.clojure / clojure1.2.0]
[org.clojure / clojure-contrib1.2.0 ]]
:dev-dependencies [[swank-clojure1.2.1]])

然后:

  $ lein deps 
$ lein swank
/ pre>

编辑添加:



如果您发现使用此SLIME REPL中的Paredit已损坏设置,检查出来:
http://www.emacswiki.org/emacs/ParEdit#toc3



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



参考文献:



用于clojure和common lisp的粘贴设置-fancy(slime-autodoc)



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


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:

解决方案

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:anonymous@common-lisp.net:/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

这篇关于我的emacs / slime设置有什么问题(编译和加载/ eval不工作)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆