冲突(?)“格式” emacs 和 SBCL 的功能
我有带有 SLIME 和 SBCL 的 emacs。我遇到了一个问题,即 emacs 将“FORMAT”定义为 format string &rest 对象,因此在 REPL 中,当我尝试评估类似 (format t "hello") 的内容时,我收到错误:类型参数错误:stringp, t。
这是要重写函数的情况吗?如何让 emacs 使用 SBCL 中定义的函数?
我猜这是相当简单的新手问题,但在谷歌上搜索“format”关键字真的很难:)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Emacs Lisp 和 Common Lisp(SBCL 是它的实现)是两种不同语言;这就好像您在询问如何从 Emacs Lisp 中调用 Java 的 System.out.println 一样。
Emacs Lisp 用于扩展和定制 Emacs 的行为。
Common Lisp 是一种通用编程语言,有多种实现方式,SBCL 就是其中之一。它与 Emacs 或 Emacs Lisp 无关(也许历史和文化上除外)。
SLIME 是一个从 Emacs 内部与正在运行的 Common Lisp 图像对话的工具,您必须首先使用
Mx slime
启动它;启动 SLIME 后,您可以将表单发送到*slime-repl sbcl*
缓冲区中正在运行的 Common Lisp 图像(在您的情况下为 SBCL)。您将找到另一个名为
*scratch*
的缓冲区,您可以在其中键入和计算 Emacs Lisp 表单。请记住,这与 Common Lisp 无关。但是,您需要注意,有一个 Emacs Lisp 扩展,它向 Emacs Lisp 添加了许多 Common Lisp 结构,但它仍然是 Emacs Lisp,如果您阅读了相关内容,请不要感到困惑。
是的,一开始可能会令人困惑,但别担心,这只是暂时的。
编辑:
我想补充一点,如果您对 Common Lisp 感兴趣,您应该阅读以下一本或全部书籍:
另一方面,如果您有兴趣扩展和定制 Emacs 本身,您应该阅读以下书籍:
祝你好运。
Emacs Lisp and Common Lisp (SBCL is an implementation of it) are two different languages; it is as if you were asking how to call Java's
System.out.println
from your Emacs Lisp.Emacs Lisp is used to extend and customize the behavior or Emacs.
Common Lisp is a general purpose programming language, of which there are several implementations, SBCL being one of them. It is not related to Emacs or Emacs Lisp (except, perhaps historically and culturally).
SLIME is a tool to talk to a running Common Lisp image from inside Emacs, you must first start it with
M-x slime
; after you have started SLIME, you can send forms to your running Common Lisp image (SBCL in your case) within the*slime-repl sbcl*
buffer.You will find another buffer named
*scratch*
where you can type and evaluate Emacs Lisp forms. Just remember that this has nothing to do with Common Lisp.But, you need to be aware that there is an Emacs Lisp extension that adds many Common Lisp constructs to Emacs Lisp, but it is still Emacs Lisp, don't get confused if you read something about that.
Yeah it may be confusing at first, but don't worry, it's only temporal.
Edit:
I would like to add that if you are interested in Common Lisp, you should read one or all of the following books:
On the other hand, if you are interested in extending and customizing Emacs itself, you should read the following book:
Good luck.
经过一番调查,我发现 .emacs 配置文件中的 SLIME 初始化脚本不正确。所以,当我使用inferior-lisp时,它不是SBCL。这是解释此事的链接:slime-devel 列表 。
因此,我将
(setq lower-lisp-program "/some/path/to/sbcl/executable.exe")
更改为(setq lower-lisp-program "sbcl") 在配置文件中。这让我进入了 SBCL,它的完美本质:)
After some investigation I found out that SLIME init script in .emacs config file was incorrect. So, while I was using inferior-lisp, it was not SBCL. Here's the link explaining the matter: slime-devel list.
So, I changed
(setq inferior-lisp-program "/some/path/to/sbcl/executable.exe")
to(setq inferior-lisp-program "sbcl")
in config file. And that got me to SBCL in it's perfect nature :)