4.1.4 When to use :preface, :config and :init?

Where possible, it is better to avoid :preface, :config and :init. Instead, prefer autoloading keywords such as :bind (see Key bindings), :hook (see Hooks), and :mode (see Modes and interpreters), as they will take care of setting up autoloads for you without any need for boilerplate code. For example, consider the following declaration:

(use-package foo
  :init
  (add-hook 'some-hook 'foo-mode))

This has two problems. First, it will unconditionally load the package ‘foo’ on startup, which will make things slower. You can fix this by adding :defer t:

(use-package foo
  :defer t
  :init
  (add-hook 'some-hook 'foo-mode))

This is better, as ‘foo’ is now only loaded when it is actually needed (that is, when the hook ‘some-hook’ is run).

The second problem is that there is a lot of boilerplate that you have to write. In this case, it might not be so bad, but avoiding that was what use-package was made to allow. The better option in this case is therefore to use :hook (see Hooks), which also implies :defer t. The above is thereby reduced down to:

(use-package foo
  :hook some-hook)

Now use-package will set up autoloading for you, and your Emacs startup time will not suffer one bit.