emacs-from-scratch icon indicating copy to clipboard operation
emacs-from-scratch copied to clipboard

Calling function within :config does not affect the font setup at startup

Open korwisi opened this issue 4 years ago • 2 comments

When calling the function https://github.com/daviwil/emacs-from-scratch/blob/1a13fcf0dd6afb41fce71bf93c5571931999fed8/init.el#L213 within the :config-realm https://github.com/daviwil/emacs-from-scratch/blob/1a13fcf0dd6afb41fce71bf93c5571931999fed8/init.el#L243 it didn't affect the fonts when opening a (new) org-file. When evaluating https://github.com/daviwil/emacs-from-scratch/blob/1a13fcf0dd6afb41fce71bf93c5571931999fed8/init.el#L239 after startup, font behaviour changed as intended.

Adding it as a hook works:

(use-package org
  :hook (org-mode .efs/org-mode-setup)
  :config
  (setq org-ellipsis " ▾")
  (add-hook 'org-mode-hook (lambda () ( efs/org-mode-setup)))) 

korwisi avatar Jan 18 '21 17:01 korwisi

It could be that the org-faces "feature" isn't loaded yet so the faces aren't applied correctly. You could try this inside of :config:

(with-eval-after-load 'org-faces
  (efs/org-font-setup))

This will ensure that the function is called after org-faces is loaded.

daviwil avatar Feb 06 '21 00:02 daviwil

First of all, thanks for having a look into this! And it almost gets the job done. Almost! Works for pretty much every font setting but the monospaced font for code blocks. Kind of mysterious. Below are two screenshots to illustrate the mystery.

Your suggested with-eval-after-load approach: with-eval-after-load-approach

The add-hook approach: hook-approach

korwisi avatar Feb 07 '21 16:02 korwisi