我的模式的字节编译:
(defun dict-setup-expansions ()
"Add `dict-mode' specific expansions."
(set (make-local-variable 'er/try-expand-list) (list #'dict-mark-article)))
给出警告:
Warning: assignment to free variable `er/try-expand-list'
这是正常情况,因为er/try-expand-list
是在externa中定义的;库expand-region
位于http://elpa.gnu.org
我的模式将扩展名注册到expand-region
库,但是可以在没有expand-region
模式的情况下运行我的模式。
我认为处理警告的正确方法是添加声明:
(defvar er/try-expand-list)
defvar
文档说:
The `defvar' form also declares the variable as "special",
so that it is always dynamically bound even if `lexical-binding' is t.
我用-*- lexical-binding: t -*-
。这是否意味着没有defvar
变量er/try-expand-list
属于词法范围,并且我有真正的错误?
@JeanPierre固定。
—
Givenkoa
(defvar er/try-expand-list)
。