custom.el 看似被加载两次

如题,请问为什么两次加载 custom.el? 配置在 init.el 中:

;; Load the settings recorded through emacs
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
;; Load the custom file if it exists
(when (file-exists-p custom-file)
  (load custom-file))

谢谢 :slightly_smiling_face:

这好像是标准做法…

能在 init.el 中找到其他 load 调用吗,用 occur 看一下

以及 custom.el 中是否只有 custom-set-variables 呢

没看出哪里加载两次了。log一次是开始加载,一次是加载完毕的消息。加载 custom.el 过程中有其他消息输出而已。

1 个赞

楼上正解

出现这种情况说明 custom.el 中调用了 load ,当然这可能是自动调用的

我写了两个文件 1.el 和 2.el,1.el 中有 (load “./2.el”) ,然后 load 1.el 会得到这样的结果:

2 个赞

谢谢大佬,@include-yy, @seagle0128. 没有加载两次,原来是没看懂log. :grinning: