我安装了 Emacs 29.2 和 SBCL 2.4.0:
sbcl
输出:
This is SBCL 2.4.0, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.
...
然后我使用命令M-x package-install<Ret>slime<Ret>
安装了
SLIME。我可以看到 SLIME 已安装: 很简单:
打开 Emacs
Hello, World!在 Emacs 中,我用
- 使用 Fibonacci 函数打开 lisp 文件
- 发行M-x史莱姆
- 将光标置于斐波那契函数上,然后按 C-c C-c 在 SLIME 中对其进行评估/编译。
- 切换到 SLIME 窗口并调用(斐波那契 10)
- 带有
.lisp
打开了一个 Hello, World!
C-x C-f
文件。然而,当我输入 M-x slime<Ret>
时,我得到 [No match]
。 M-x slime-mode<Ret>
也一样。这是我的 ~/.emacs 文件:
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-selected-packages '(slime paredit)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
;;;;;;;;;;;;;;;;;;;;;;;
;; I added the following according to slime install directions:
(setq inferior-lisp-program "sbcl")
sbcl
在我的路上:
% which sbcl
/opt/local/bin/sbcl
% echo $PATH
...:/Users/7stud/bin/:/opt/local/bin:....
我尝试更改.emacs
文件以使用 sbcl
的完整路径:
(setq inferior-lisp-program "/opt/local/bin/sbcl")
但我仍然得到
M-x slime [No match]
。我已经退出 Emacs 并在对
.emacs文件进行更改后重新启动它。 这是我的 ~/.emacs.d/elpa
目录(我还没碰过):
ls
输出:
archives macrostep-0.9.2.signed slime-2.29.1
gnupg paredit-26 slime-2.29.1.signed
macrostep-0.9.2 paredit-26.signed
我安装SLIME时出现了一堆警告,但我找不到这些警告记录在哪里,所以我无法发布它们。
我能够成功安装并使用该软件包
paredit
。当我打开 .lisp 文件时,它会以 Lisp 主模式打开,如果我这样做
M-x paredit-mode
,则会将 Paredit 添加为次模式:将 Paredit 添加为次要模式后,括号会匹配,因此它可以工作。
我使用的是
macOS v12.5.1 (Monterey),我安装了 Emacs:
sudo port install emacs-app
我通过显示软件包列表
M-x list-packages
来卸载 SLIME,然后搜索 SLIME 列表,
Ctrl+ S,然后在 slime 列表上键入 D,然后键入 X。我重新安装了 SLIME,再次找到 SLIME 列表,然后在史莱姆线上输入 I,然后输入 X。以下是警告:
⛔ Warning (comp): slime-autodoc.el:51:17: Warning: ‘eldoc-message’ is an obsolete function (as of eldoc-1.1.0); use ‘eldoc-documentation-functions’ instead.
⛔ Warning (comp): slime-autodoc.el:52:15: Warning: ‘eldoc-message’ is an obsolete function (as of eldoc-1.1.0); use ‘eldoc-documentation-functions’ instead.
⛔ Warning (comp): slime-autodoc.el:64:8: Warning: ‘eldoc-message’ is an obsolete function (as of eldoc-1.1.0); use ‘eldoc-documentation-functions’ instead.
⛔ Warning (comp): slime-autodoc.el:106:8: Warning: ‘font-lock-fontify-buffer’ is for interactive use only; use ‘font-lock-ensure’ or ‘font-lock-flush’ instead.
⛔ Warning (comp): slime-autodoc.el:165:14: Warning: ‘eldoc-display-message-p’ is an obsolete function (as of eldoc-1.6.0); Use ‘eldoc-documentation-functions’ instead.
⛔ Warning (comp): slime-autodoc.el:166:10: Warning: ‘eldoc-message’ is an obsolete function (as of eldoc-1.1.0); use ‘eldoc-documentation-functions’ instead.
⛔ Warning (comp): bridge.el:115:2: Warning: defvar `bridge-leftovers' docstring wider than 80 characters
⛔ Warning (comp): slime-cl-indent.el:115:2: Warning: custom-declare-variable `lisp-align-keywords-in-calls' docstring has wrong usage of unescaped single quotes (use \= or different quoting)
⛔ Warning (comp): slime-cl-indent.el:1448:2: Warning: defvar `common-lisp-indent-clause-joining-loop-macro-keyword' docstring has wrong usage of unescaped single quotes (use \= or different quoting)
⛔ Warning (comp): hyperspec.el:1320:4: Warning: Alias for ‘common-lisp-hyperspec-glossary-function’ should be declared before its referent
⛔ Warning (comp): slime.el:112:2: Warning: Alias for ‘slime-contribs’ should be declared before its referent
⛔ Warning (comp): slime.el:277:12: Warning: defcustom for ‘slime-completion-at-point-functions’ fails to specify type
⛔ Warning (comp): slime.el:689:4: Warning: Doc string after `declare'
⛔ Warning (comp): slime.el:1160:6: Warning: ‘byte-compile-file’ called with 2 arguments, but accepts only 1
⛔ Warning (comp): slime.el:2408:10: Warning: ‘hide-entry’ is an obsolete function (as of 25.1); use ‘outline-hide-entry’ instead.
⛔ Warning (comp): slime.el:3081:12: Warning: ‘beginning-of-sexp’ is an obsolete function (as of 25.1); use ‘thing-at-point--beginning-of-sexp’ instead.
⛔ Warning (comp): slime.el:3392:16: Warning: ‘beginning-of-sexp’ is an obsolete function (as of 25.1); use ‘thing-at-point--beginning-of-sexp’ instead.
⛔ Warning (comp): slime.el:3681:20: Warning: ‘find-tag-marker-ring’ is an obsolete variable (as of 25.1); use ‘xref-push-marker-stack’ or ‘xref-go-back’ instead.
⛔ Warning (comp): slime.el:4113:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
⛔ Warning (comp): slime.el:4960:6: Warning: ‘font-lock-fontify-buffer’ is for interactive use only; use ‘font-lock-ensure’ or ‘font-lock-flush’ instead.
⛔ Warning (comp): slime.el:5536:10: Warning: ‘inhibit-point-motion-hooks’ is an obsolete variable (as of 25.1); use ‘cursor-intangible-mode’ or ‘cursor-sensor-mode’ instead
⛔ Warning (comp): slime.el:5692:10: Warning: ‘inhibit-point-motion-hooks’ is an obsolete variable (as of 25.1); use ‘cursor-intangible-mode’ or ‘cursor-sensor-mode’ instead
⛔ Warning (comp): slime.el:5795:10: Warning: ‘inhibit-point-motion-hooks’ is an obsolete variable (as of 25.1); use ‘cursor-intangible-mode’ or ‘cursor-sensor-mode’ instead
⛔ Warning (comp): slime.el:6329:8: Warning: Obsolete calling convention for 'sit-for'
⛔ Warning (comp): slime.el:6611:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
⛔ Warning (comp): slime.el:7187:4: Warning: ‘easy-menu-add’ is an obsolete function (as of 28.1); this was always a no-op in Emacs and can be safely removed.
⛔ Warning (comp): slime.el:7194:4: Warning: ‘easy-menu-add’ is an obsolete function (as of 28.1); this was always a no-op in Emacs and can be safely removed.
⛔ Warning (comp): slime.el:7312:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
⛔ Warning (comp): slime-parse.el:319:20: Warning: Stray ‘declare’ form: (declare (ignore args))
⛔ Warning (comp): slime-repl.el:130:2: Warning: defvar `slime-repl-history-use-mark' docstring has wrong usage of unescaped single quotes (use \= or different quoting)
⛔ Warning (comp): slime-repl.el:138:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
⛔ Warning (comp): slime-repl.el:978:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
⛔ Warning (comp): slime-repl.el:1580:22: Warning: Stray ‘declare’ form: (declare (ignore args))
⛔ Warning (comp): slime-repl.el:1689:4: Warning: ‘easy-menu-add’ is an obsolete function (as of 28.1); this was always a no-op in Emacs and can be safely removed.
⛔ Warning (comp): slime-presentations.el:601:2: Warning: docstring wider than 80 characters
⛔ Warning (comp): slime-presentations.el:759:4: Warning: ‘easy-menu-add’ is an obsolete function (as of 28.1); this was always a no-op in Emacs and can be safely removed.
⛔ Warning (comp): slime-presentations.el:760:4: Warning: ‘easy-menu-add’ is an obsolete function (as of 28.1); this was always a no-op in Emacs and can be safely removed.
⛔ Warning (comp): slime-presentations.el:761:4: Warning: ‘easy-menu-add’ is an obsolete function (as of 28.1); this was always a no-op in Emacs and can be safely removed.
⛔ Warning (comp): slime-presentations.el:762:4: Warning: ‘easy-menu-add’ is an obsolete function (as of 28.1); this was always a no-op in Emacs and can be safely removed.
⛔ Warning (comp): slime-references.el:102:67: Warning: reference to free variable ‘name’
⛔ Warning (comp): slime-references.el:107:15: Warning: ‘:info’ called as a function
⛔ Warning (comp): slime-references.el:109:15: Warning: ‘t’ called as a function
⛔ Warning (comp): slime-references.el:109:15: Warning: the function ‘t’ is not known to be defined.
⛔ Warning (comp): slime-references.el:107:15: Warning: the function ‘:info’ is not known to be defined.
⛔ Warning (comp): slime-references.el:106:13: Warning: the function ‘case’ is not known to be defined.
⛔ Warning (comp): slime-package-fu.el:226:21: Warning: ‘looking-back’ called with 1 argument, but requires 2 or 3
⛔ Warning (comp): slime-package-fu.el:263:14: Warning: ‘looking-back’ called with 1 argument, but requires 2 or 3
⛔ Warning (comp): slime-trace-dialog.el:162:12: Warning: ‘inhibit-point-motion-hooks’ is an obsolete variable (as of 25.1); use ‘cursor-intangible-mode’ or ‘cursor-sensor-mode’ instead
⛔ Warning (comp): slime-trace-dialog.el:248:16: Warning: ‘inhibit-point-motion-hooks’ is an obsolete variable (as of 25.1); use ‘cursor-intangible-mode’ or ‘cursor-sensor-mode’ instead
⛔ Warning (comp): slime-trace-dialog.el:261:28: Warning: ‘inhibit-point-motion-hooks’ is an obsolete variable (as of 25.1); use ‘cursor-intangible-mode’ or ‘cursor-sensor-mode’ instead
⛔ Warning (comp): slime-trace-dialog.el:352:13: Warning: ‘inhibit-point-motion-hooks’ is an obsolete variable (as of 25.1); use ‘cursor-intangible-mode’ or ‘cursor-sensor-mode’ instead
⛔ Warning (comp): slime-trace-dialog.el:478:12: Warning: ‘inhibit-point-motion-hooks’ is an obsolete variable (as of 25.1); use ‘cursor-intangible-mode’ or ‘cursor-sensor-mode’ instead
我检查了
*Messages*
中的输出,但它太大了,无法发布在这里。这是输出的结尾:
...
...
Warning: Optimization failure for make-ert-test: Handler: make-ert-test--cmacro
(error "Keyword argument :file-name not one of (:name :documentation :body :most-recent-result :expected-result-type :tags)")
Warning: Optimization failure for make-ert-test: Handler: make-ert-test--cmacro
(error "Keyword argument :file-name not one of (:name :documentation :body :most-recent-result :expected-result-type :tags)")
Warning: Optimization failure for make-ert-test: Handler: make-ert-test--cmacro
(error "Keyword argument :file-name not one of (:name :documentation :body :most-recent-result :expected-result-type :tags)")
Wrote /Users/7stud/.emacs.d/elpa/slime-2.29.1/contrib/test/slime-repl-tests.elc
Checking /Users/7stud/.emacs.d/elpa/slime-2.29.1/contrib/test...
Done (Total of 57 files compiled, 2 skipped in 4 directories)
ad-handle-definition: ‘slime-note.message’ got redefined
Package ‘slime’ installed.
Operation [ Install 1 ] finished
,他们有一个 .emacs
文件,您可以通过我的 emacs 安装下载
. I used that
.emacs` 文件。首先,我将当前的 .emacs
文件和
.emacs.d/
目录移动到 .xemacs
和 .xemacs.d/
,然后将 emacs4cl .emacs 文件移动到我的主目录:~/.emacs。当我启动 emacs 时,安装的各种软件包再次出现很多警告,但是当我输入 M-x slime
时,另一个窗口启动了:.emacs
文件:
;; Customize user interface.
(when (display-graphic-p)
(tool-bar-mode 0)
(scroll-bar-mode 0))
(setq inhibit-startup-screen t)
;; Dark theme.
(load-theme 'wombat)
(set-face-background 'default "#111")
;; Use spaces, not tabs, for indentation.
(setq-default indent-tabs-mode nil)
;; Highlight matching pairs of parentheses.
(setq show-paren-delay 0)
(show-paren-mode)
;; Workaround for https://debbugs.gnu.org/34341 in GNU Emacs <= 26.3.
(when (and (version< emacs-version "26.3") (>= libgnutls-version 30603))
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3"))
;; Write customizations to a separate file instead of this file.
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(load custom-file t)
;; Enable installation of packages from MELPA.
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
(unless package-archive-contents
(package-refresh-contents))
;; Install packages.
(dolist (package '(slime paredit rainbow-delimiters))
(unless (package-installed-p package)
(package-install package)))
;; Configure SBCL as the Lisp program for SLIME.
(add-to-list 'exec-path "/usr/local/bin")
(setq inferior-lisp-program "sbcl")
;; Enable Paredit.
(add-hook 'emacs-lisp-mode-hook 'enable-paredit-mode)
(add-hook 'eval-expression-minibuffer-setup-hook 'enable-paredit-mode)
(add-hook 'ielm-mode-hook 'enable-paredit-mode)
(add-hook 'lisp-interaction-mode-hook 'enable-paredit-mode)
(add-hook 'lisp-mode-hook 'enable-paredit-mode)
(add-hook 'slime-repl-mode-hook 'enable-paredit-mode)
(require 'paredit)
(defun override-slime-del-key ()
(define-key slime-repl-mode-map
(read-kbd-macro paredit-backward-delete-key) nil))
(add-hook 'slime-repl-mode-hook 'override-slime-del-key)
;; Enable Rainbow Delimiters.
(add-hook 'emacs-lisp-mode-hook 'rainbow-delimiters-mode)
(add-hook 'ielm-mode-hook 'rainbow-delimiters-mode)
(add-hook 'lisp-interaction-mode-hook 'rainbow-delimiters-mode)
(add-hook 'lisp-mode-hook 'rainbow-delimiters-mode)
(add-hook 'slime-repl-mode-hook 'rainbow-delimiters-mode)
;; Customize Rainbow Delimiters.
(require 'rainbow-delimiters)
(set-face-foreground 'rainbow-delimiters-depth-1-face "#c66") ; red
(set-face-foreground 'rainbow-delimiters-depth-2-face "#6c6") ; green
(set-face-foreground 'rainbow-delimiters-depth-3-face "#69f") ; blue
(set-face-foreground 'rainbow-delimiters-depth-4-face "#cc6") ; yellow
(set-face-foreground 'rainbow-delimiters-depth-5-face "#6cc") ; cyan
(set-face-foreground 'rainbow-delimiters-depth-6-face "#c6c") ; magenta
(set-face-foreground 'rainbow-delimiters-depth-7-face "#ccc") ; light gray
(set-face-foreground 'rainbow-delimiters-depth-8-face "#999") ; medium gray
(set-face-foreground 'rainbow-delimiters-depth-9-face "#666") ; dark gray
如果我在包含 slime repl 的窗口上方的窗口中打开一个 hello .lisp 文件,并将光标放在函数定义的最后一个括号之外一个空格,然后点击
C-x C-e
,函数的名称将出现在粘液窗口下方的回声线。但是,我无法在 slime 中执行该函数。