Emacs 口齿不清 : Can't set any value to variable named 's'

标签 emacs lisp elisp

这很奇怪。如果在交互式 session 中将变量命名为“s”,我无法为变量设置任何值:

(setq s 'foo)
=> foo

s
=> nil

为什么?

更新 1:

这是 s 上 describe-variable 的输出:

s is void as a variable.

Documentation:
Not documented as a variable.

为什么 s 在 emacs lisp 中作为全局变量保持为空?

更新 2:

事实证明,它不会发生在 vanilla emacs 上(这意味着我在 .emacs 中加载的模块之一或 .emacs 中的某些代码导致了这种情况)。 所以现在的问题是:

当描述变量产生“<var> is void as a variable”时,原始源会是什么样子?

我用 setq 试过了, defconst , defvar , 和 defcustom ,但这些都没有产生我正在显示的消息。

更新 3:

上面显示的消息是在变量未绑定(bind)时产生的(尽管它可以是 fbound )。

(describe-variable 'non-existent)
=> "non-existent is void as a variable.

Documentation:
Not documented as a variable."

所以最新的问题是:有什么办法可以防止某个变量名 从被绑定(bind)?

最佳答案

修改后的问题的答案:

(defvar s)

唯一的问题是,这不会让您以交互方式对其使用 describe-variable

(然后您可以执行类似 (setplist 's '(variable-documentation "Meh")) 的操作来为其设置描述,而无需通过 defvar

关于Emacs 口齿不清 : Can't set any value to variable named 's' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3851863/

相关文章:

java - 寻找 pydoc analog for java 以从命令行读取文档

javascript - Emacs 模式与 HTML 和 JS 集成

haskell - 内部错误 : wrong-type-argument stringp nil

emacs - 如何设置 Emacs gdb 以便在箭头上显示最近的命令?

emacs - 如何防止 emacs 使用 C-x o 切换到某些窗口?

unit-testing - 在 Racket 中通过一次测试检查多个输出

haskell - 如何在 Emacs 的 Haskell 模式下评估单个表达式?

lisp - 在 LISP 中使用 defmacro 时出现未绑定(bind)变量错误

haskell - 以纯/函数式语言(Elm/Haskell)实现自引用/指针

emacs - 将 CSV 导入组织模式属性