首页 > Emacs, Lisp > 建立 Lisp 开发环境

建立 Lisp 开发环境

Slime 是 Emacs 下的一个写 Common Lisp 的一个插件

Download

如果是从源代码安装的话, 需要从 Slime 的官网上下载安装包, 然后进行安装.

Install

在 Gentoo 上安装很简单:

# emerge -av slime

Configuration

(setq inferior-lisp-program "/usr/bin/sbcl")
(add-to-list 'load-path "/usr/share/emacs/site-lisp/slime/")
(require 'slime)
(slime-setup)

装好后, 在我的机器上, 会显示以下错误

  ASDF 2 is not compatible with ASDF-BINARY-LOCATIONS, which you are using. 
ASDF 2 now achieves the same purpose with its builtin ASDF-OUTPUT-TRANSLATIONS, 
which should be easier to configure. Please stop using ASDF-BINARY-LOCATIONS, 
and instead use ASDF-OUTPUT-TRANSLATIONS. See the ASDF manual for details. 
In case you insist on preserving your previous A-B-L configuration, but 
do not know how to achieve the same effect with A-O-T, you may use function 
ASDF:ENABLE-ASDF-BINARY-LOCATIONS-COMPATIBILITY as documented in the manual; 
call that function where you would otherwise have loaded and configured A-B-L..

Gentoo 中 asdf 默认的配置文件(/etc/gentoo-init.lisp)有点问题, 注释掉以下几行 就可以了

(asdf:oos 'asdf:load-op :asdf-binary-locations)
(setf asdf:*centralize-lisp-binaries* t)
(setf asdf:*source-to-target-mappings* '((#p"/usr/lib/sbcl/" nil) (#p"/usr/lib64/sbcl/" nil)))

修改为

;; (asdf:oos 'asdf:load-op :asdf-binary-locations)
;; (setf asdf:*centralize-lisp-binaries* t)
;; (setf asdf:*source-to-target-mappings* '((#p"/usr/lib/sbcl/" nil) (#p"/usr/lib64/sbcl/" nil)))

注意该配置文件是在 /etc/sbclrc 定义的

;;; The following is required if you want source location functions to
;;; work in SLIME, for example.
 
(setf (logical-pathname-translations "SYS")
    '(("SYS:SRC;**;*.*.*" #p"/usr/lib64/sbcl/src/**/*.*")
      ("SYS:CONTRIB;**;*.*.*" #p"/usr/lib64/sbcl/**/*.*")))
 
;;; Setup ASDF2
(load "/etc/gentoo-init.lisp")

Enjoy

使用 M-x slime 就可以启动 slime 了, 启动画面做得很炫

分类: Emacs, Lisp 标签: ,
  1. 2013年6月13日20:22 | #1

    I need to to thank you for this good read!! I absolutely loved every bit of it. I’ve got you book marked to check out new stuff you post…

  1. 本文目前尚无任何 trackbacks 和 pingbacks.