custom-set-default 不是给用户用来设定变量用的,而是给 defcustom 用的 :set 选项的默认值。
customize-set-value 和 customize-set-variable 是用来 M-x 交互式调用的,提供当前 defcustom 变量的䃼全。后者会用 custom-set,前者不会。
setopt 才是设计用在配置代码里做少量修改的。有 custom-set 时用优先用它,没有就用 set-default,是没有加載变量对应的包时也要使变量生效时用的。它不会去主动 require 对应的包。
setq 现在有编译时对变量是否定义的檢查,不在意的话无所谓,在意就用 setq-default,这个也能全局设定 buffer local variable。setq 在 byte code 里有专门的指令,而 setq-default 只会展开成对 set-default 的 funcall。setq-local 一般不用在配置选项里,不提
custom-set-variables 才是用来让用户批量设置 defcustom 的,等价于 (custom-theme-set-variables 'user ...),后者顾名思意是给 theme 用的。和 setopt 区別是只有在对应的 defcustom 加載时才会生效,确保调用的是正确的 custom-set。
use-package 如果 :config 和 :defer t 一起用,那就等于 eval-after-load,:ensure t 时
:config 等价于 :init。:custom 用的是 (custom-theme-set-variables ʻuse-package ...)。
Emacs 的 theme 不只管理 face,也能管理 defcustom,而且能同时打开以组合多个 theme,也能在关闭 theme 时正确重置变量。用 setq/setopt 就没有这个好处了。