Revise :after-call & :defer-incrementally comments

Now implicitly adds the current package to :defer-incrementally's list
of packages.
This commit is contained in:
Henrik Lissner 2018-12-23 00:25:51 -05:00
parent 0efa915164
commit 451c16b8ee
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 30 additions and 10 deletions

View file

@ -97,7 +97,7 @@ fundamental-mode) for performance sake."
(def-package! savehist (def-package! savehist
;; persist variables across sessions ;; persist variables across sessions
:defer-incrementally (custom savehist) :defer-incrementally (custom)
:after-call post-command-hook :after-call post-command-hook
:config :config
(setq savehist-file (concat doom-cache-dir "savehist") (setq savehist-file (concat doom-cache-dir "savehist")
@ -129,7 +129,7 @@ savehist file."
(def-package! recentf (def-package! recentf
;; Keep track of recently opened files ;; Keep track of recently opened files
:defer-incrementally (easymenu tree-widget timer recentf) :defer-incrementally (easymenu tree-widget timer)
:after-call after-find-file :after-call after-find-file
:commands recentf-open-files :commands recentf-open-files
:config :config

View file

@ -191,14 +191,34 @@ non-nil, return paths of possible modules, activated or otherwise."
use-package-minimum-reported-time (if doom-debug-mode 0 0.1) use-package-minimum-reported-time (if doom-debug-mode 0 0.1)
use-package-expand-minimally (not noninteractive)) use-package-expand-minimally (not noninteractive))
;; Adds the :after-call custom keyword to `use-package' (and consequently, ;; Adds two new keywords to `use-package' (and consequently, `def-package!'),
;; `def-package!'). :after-call takes a symbol or list of symbols. These symbols ;; they are:
;; can be functions or hook variables.
;; ;;
;; (use-package X :after-call find-file-hook) ;; :after-call SYMBOL|LIST
;; Takes a symbol or list of symbols representing functions or hook variables.
;; The first time any of these functions or hooks are executed, the package is
;; loaded. e.g.
;; ;;
;; This will load X on the first invokation of `find-file-hook' (then it will ;; (def-package! projectile
;; remove itself from the hook/function). ;; :after-call (pre-command-hook after-find-file dired-before-readin-hook)
;; ...)
;;
;; :defer-incrementally SYMBOL|LIST|t
;; Takes a symbol or list of symbols representing packages that will be loaded
;; incrementally at startup before this one. This is helpful for large
;; packages like magit or org, which load a lot of dependencies on first load.
;; This lets you load them piece-meal, one at a time, during idle periods, so
;; that when you finally do need the package, it'll loads much quicker. e.g.
;;
;; (def-package! magit
;; ;; You do not need to include magit in this list!
;; :defer-incrementally (dash f s with-editor git-commit package)
;; ...)
;;
;; (def-package! x
;; ;; This is equivalent to :defer-incrementally (x)
;; :defer-incrementally t
;; ...)
(defvar doom--deferred-packages-alist '(t)) (defvar doom--deferred-packages-alist '(t))
(after! use-package-core (after! use-package-core
(add-to-list 'use-package-deferring-keywords :defer-incrementally nil #'eq) (add-to-list 'use-package-deferring-keywords :defer-incrementally nil #'eq)
@ -215,7 +235,7 @@ non-nil, return paths of possible modules, activated or otherwise."
`((doom-load-packages-incrementally `((doom-load-packages-incrementally
',(if (equal targets '(t)) ',(if (equal targets '(t))
(list name) (list name)
targets))) (append targets (list name)))))
(use-package-process-keywords name rest state))) (use-package-process-keywords name rest state)))
(defalias 'use-package-normalize/:after-call 'use-package-normalize-symlist) (defalias 'use-package-normalize/:after-call 'use-package-normalize-symlist)

View file

@ -15,7 +15,7 @@ what features are available.")
(def-package! magit (def-package! magit
:commands magit-file-delete :commands magit-file-delete
:defer-incrementally (dash f s with-editor git-commit package magit) :defer-incrementally (dash f s with-editor git-commit package)
:init :init
(setq magit-auto-revert-mode nil) ; we already use `global-auto-revert-mode' (setq magit-auto-revert-mode nil) ; we already use `global-auto-revert-mode'
:config :config