I read this Reddit thread about favorite themes, and got intrigued by the spacemacs theme1.
I added that theme to my init
file, and tried making it the default
theme. I use use-package
, and configured the theme as follows:
(use-package spacemacs-theme
:ensure t
:config
(load-theme 'spacemacs-light t)
)
When re-evaluating my init
file, the theme didn't load. I tried to run
only the (load-theme 'spacemacs-light t)
line, and the theme loaded. I
changed the :config
to :init
in the package configuration, and it
loaded when I re-loaded emacs.
What, then, is the difference between :init
and :config
in
use-package
?
The answer to that question, which I found it in this stack-overflow
answer, is that in
use-package
, whatever defined inside the :init
keyword, will load
whenever emacs is loading. What's in the :config
, though, will be
executed only when the package is actually loaded (i.e lazy
loading)2.
Here's how my configuration for that theme looks like now:
(use-package spacemacs-theme
:ensure t
:init
(load-theme 'spacemacs-light t)
)