ef-themes主题配色无法直接对doom-modeline生效

先发一下ef-themes和doom-modeline的相关配置:

(use-package ef-themes
      :straight '(ef-themes :type git :host github :repo "protesilaos/ef-themes")
      :init
      (setq ef-themes-headings nil)
      (setq ef-themes-mixed-fonts nil)
      (setq ef-themes-variable-pitch-ui nil)
      (ef-themes-select 'ef-summer))

(use-package doom-modeline
      :diminish doom-modeline-mode
      :config
      (setq doom-modeline-modal-icon nil)
      :hook (after-init . doom-modeline-mode))

现在每次启动emacs时,会发现配色是这样的:

modeline的底色不见了;再次(ef-themes-select 'ef-summer)就又会恢复正常:

通过手动添加:after改变这两个包的加载顺序也无效,求指点。

ef-themes 对mode-line支持不好。加载顺序调一下就行了。

(use-package ef-themes
      :after doom-modeline
      :straight '(ef-themes :type git :host github :repo "protesilaos/ef-themes")
      :init
      (setq ef-themes-headings nil)
      (setq ef-themes-mixed-fonts nil)
      (setq ef-themes-variable-pitch-ui nil)
      :config
      (ef-themes-select 'ef-summer))

仍然不行

你并没有改变加载顺序

(use-package doom-modeline
      :diminish doom-modeline-mode
      :config
      (setq doom-modeline-modal-icon nil)
      :init (doom-modeline-mode 1))

我用的是:hook (after-init . doom-modeline-mode),效果应该是一样的?

改成:init (doom-modeline-mode 1)也还是一样,没有生效。

确定把包的加载顺序换了吗?

(use-package doom-modeline
      :diminish doom-modeline-mode
      :inti
      (setq doom-modeline-modal-icon nil)
      (doom-modeline-mode 1))

(use-package ef-themes
      :straight '(ef-themes :type git :host github :repo "protesilaos/ef-themes")
      :init
      (setq ef-themes-headings nil)
      (setq ef-themes-mixed-fonts nil)
      (setq ef-themes-variable-pitch-ui nil)
      (ef-themes-select 'ef-summer))

可以确认加载顺序是先doom-modeline然后再ef-themes

    (use-package doom-modeline
      :diminish doom-modeline-mode
      :init
      (setq doom-modeline-modal-icon nil)
      (doom-modeline-mode t))

    (use-package ef-themes
      :straight '(ef-themes :type git :host github :repo "protesilaos/ef-themes")
      :after doom-modeline
      :init
      (setq ef-themes-headings nil)
      (setq ef-themes-mixed-fonts nil)
      (setq ef-themes-variable-pitch-ui nil)
      (ef-themes-select 'ef-summer))

如果你描述正确这样肯定是可以的。手动加载能成功代码也应该没问题。

一行行注释代码,找到了问题所在,犯了低级错误。我抄您的配置,字体相关定义了一个config-fonts函数,并且(add-hook 'window-setup-hook #'config-font) (add-hook 'server-after-make-frame-hook #'config-fonts),坏就坏在(add-hook 'window-setup-hook #'config-font)这个地方拼写漏了一个s,也不知道为什么一直没有报错,逐行排查才抓出这个虫。改正之后就完全没问题了。

问题解决就好。仔细看看log有没有遗漏,函数不存在应该会有报错的。

所以说反馈的时候最好先用最小配置测试一下 :rofl: