Add a :demand directive, to override deferred loading ()

GitHub-reference: https://github.com/jwiegley/use-package/issues/65
This commit is contained in:
John Wiegley 2013-12-04 19:44:09 -06:00
parent 9d395a4019
commit c3704ac36e

View file

@ -345,6 +345,7 @@
:config :config
:defer :defer
:defines :defines
:demand
:diminish :diminish
:disabled :disabled
:ensure :ensure
@ -383,7 +384,7 @@ Return the list of recognized keywords."
(eval (list '\` (plist-get plist prop)))) (eval (list '\` (plist-get plist prop))))
(defmacro use-package (name &rest args) (defmacro use-package (name &rest args)
"Use a package with configuration options. "Use a package with configuration options.
For full documentation. please see commentary. For full documentation. please see commentary.
@ -401,6 +402,7 @@ For full documentation. please see commentary.
:interpreter Form to be added to `interpreter-mode-alist'. :interpreter Form to be added to `interpreter-mode-alist'.
:defer Defer loading of package -- automatic :defer Defer loading of package -- automatic
if :commands, :bind, :mode or :interpreter are used. if :commands, :bind, :mode or :interpreter are used.
:demand Prevent deferred loading in all cases.
:config Runs if and when package loads. :config Runs if and when package loads.
:if Conditional loading. :if Conditional loading.
:disabled Ignore everything. :disabled Ignore everything.
@ -539,7 +541,8 @@ For full documentation. please see commentary.
`(load ,name t) `(load ,name t)
`(require ',name nil t)))) `(require ',name nil t))))
,(if (or commands (plist-get args :defer)) ,(if (and (or commands (plist-get args :defer))
(not (plist-get args :demand)))
(let (form) (let (form)
(mapc #'(lambda (command) (mapc #'(lambda (command)
(push `(autoload (function ,command) (push `(autoload (function ,command)