emacs + common lisp 中奇怪的自动完成结果

Strange autocompletion result in emacs + common lisp

我在我的开发环境中使用 Emacs 和 SLIME。当我输入 (write-to 然后输入 C-M-i 时,我得到以下自动完成:

Click on a completion to select it.
In this buffer, type RET to select the completion near point.

Possible completions are:
write-to-sting
write-to-string

我知道 Common Lisp 很强大,但我想 write-to-sting 不在 ANSI 标准中。 Google 没有为此功能提供一次点击。然后我试图在SBCL代码中找到它,但是alas

(documentation 'write-to-sting 'function) returns nil 所以它没有文档字符串。

当我尝试执行函数 (write-to-sting) 时,我得到 The function COMMON-LISP-USER::WRITE-TO-STING is undefined.

Apropos 还发现了一个未绑定的函数:

(apropos 'write-to)
WRITE-TO
WRITE-TO-STING
WRITE-TO-STRING (fbound)

我的问题是:这是怎么回事?有谁知道这个函数背后的故事吗?

在您与 Lisp 环境交互的某个时刻, 写了 write-to-sting 并且它被 Lisp reader 读取了。该符号驻留在 COMMON-LISP-USER 包中。毕竟,也许您打算实现一个向 Sting 发送电子邮件的功能,谁知道呢? 自动完成通过过滤环境中当前已知的符号来工作。

您可以安全地(unintern 'write-to-sting)(或实现它)。