15.5 应用自定义设置

下面的函数分别负责应用用户对变量和 face 的自定义设置。 当用户在自定义界面中执行 ‘Save for future sessions’(保存为后续会话使用)时, 系统会将一个 custom-set-variables 和/或 custom-set-faces 表达式 写入自定义文件,以便在 Emacs 下次启动时求值。

Function: custom-set-variables &rest args

该函数应用由 args 指定的变量自定义设置。 args 中的每个参数格式应为:

(var expression [now [request [comment]]])

var 是变量名(一个符号),expression 是求值后得到目标自定义值的表达式。

如果变量 var 对应的 defcustom 形式 在本次 custom-set-variables 调用之前已经被求值, 那么 expression 会被立即求值,并将变量的值设为结果。 否则,expression 会被存入变量的 saved-value 属性中, 等到相关 defcustom 被调用时再求值(通常是在定义该变量的库被加载到 Emacs 时)。

nowrequestcomment 仅供内部使用,可以省略。 now 若非 nil,表示**立即**设置变量的值, 即使该变量的 defcustom 形式尚未被求值。 request 是需要立即加载的特性列表(see 功能)。 comment 是描述该自定义项的字符串。

Function: custom-set-faces &rest args

该函数应用由 args 指定的 face 自定义设置。 args 中的每个参数格式应为:

(face spec [now [comment]])

face 是 face 名(一个符号),spec 是该 face 的自定义规格(see Defining Faces)。

nowcomment 仅供内部使用,可以省略。 now 若非 nil,表示**立即**应用该 face 规格, 即使 defface 形式尚未被求值。 comment 是描述该自定义项的字符串。


emacs

Emacs

org-mode

Orgmode

Donations

打赏

Copyright

© 2025 Jasper Hsu

Creative Commons

Creative Commons

Attribute

Attribute

Noncommercial

Noncommercial

Share Alike

Share Alike