Update documentation for :defer t

This commit is contained in:
syl20bnr 2018-02-27 23:01:03 -05:00
parent 29c78ce841
commit e2b1cecb77
3 changed files with 17 additions and 11 deletions

View File

@ -228,16 +228,16 @@ The aspiring layer author is recommended to have a look at the =use-package=
This simply loads Helm. It is essentially equivalent to =(require 'helm)=.
#+begin_src emacs-lisp
(use-package helm
:defer t)
(use-package helm)
#+end_src
This defers the loading of Helm using the auto-load facility and the auto-load
commands provided by the Helm source code. It is, in fact, a no-op.
By default =use-package= will try to defer the loading of the packages by using
the auto-load facility and the auto-load commands provided by the package source
code. So actually in the example above the code won't load =Helm= until one of
the auto-loaded functions is called.
#+begin_src emacs-lisp
(use-package helm
:defer t
:init
;; Code to execute before Helm is loaded
:config
@ -251,6 +251,15 @@ section is not executed until after loading, if ever. It is essentially
equivalent to simply running the =:init= block, and then adding the =:config=
block in an =with-eval-after-load=.
#+begin_src emacs-lisp
(use-package helm
:demand t)
#+end_src
=:demand t= will force the package to be fully loaded right away. It
effectively disable lazy loading.
#+begin_src emacs-lisp
(use-package helm
:commands (helm-find-files helm-M-x))

View File

@ -386,14 +386,12 @@ that allows easy lazy-loading and configuration of packages. Here are the basics
to using it:
#+BEGIN_SRC emacs-lisp
;; Basic form of use-package declaration. The :defer t tells use-package to
;; try to lazy load the package.
(use-package package-name
:defer t)
;; Basic form of use-package declaration. By default the package will be
;; lazy loaded.
(use-package package-name)
;; The :init section is run before the package loads. The :config section is
;; run after the package loads
(use-package package-name
:defer t
:init
(progn
;; Change some variables

View File

@ -175,7 +175,6 @@ In the file =packages.el= of the python layer:
(defun python/init-company-anaconda ()
(use-package company-anaconda
:defer t
:init
(spacemacs|add-company-backends
:backends company-anaconda