Add new customization variable `use-package-deferring-keywords'

This commit is contained in:
John Wiegley 2017-12-04 00:11:46 -08:00
parent 6d51e52342
commit 0be575766c
2 changed files with 22 additions and 10 deletions

View file

@ -35,6 +35,10 @@
declaration, and the macro-expanded version (without verbosity-related declaration, and the macro-expanded version (without verbosity-related
code). Note that this still does not help if there are parsing errors, which code). Note that this still does not help if there are parsing errors, which
will still cause Emacs to encounter a Lisp error at startup time. will still cause Emacs to encounter a Lisp error at startup time.
- New customization variable `use-package-deferring-keywords`, mainly intended
for use by extension packages, indicates keywords that, if used without
`:demand`, cause deferred loading (as if `:defer t` had been specified).
- New `:hook` keyword. - New `:hook` keyword.

View file

@ -97,6 +97,21 @@ declaration is incorrect."
:type '(repeat symbol) :type '(repeat symbol)
:group 'use-package) :group 'use-package)
(defcustom use-package-deferring-keywords
'(:bind
:bind*
:bind-keymap
:bind-keymap*
:interpreter
:mode
:magic
:magic-fallback
:commands
:hook)
"Unless `:demand' is used, keywords in this list imply deferred loading."
:type '(repeat symbol)
:group 'use-package)
(defcustom use-package-verbose nil (defcustom use-package-verbose nil
"Whether to report about loading and configuration details. "Whether to report about loading and configuration details.
If you customize this, then you should require the `use-package' If you customize this, then you should require the `use-package'
@ -499,16 +514,9 @@ This is in contrast to merely setting it to 0."
;; Certain keywords imply :defer, if :demand was not specified. ;; Certain keywords imply :defer, if :demand was not specified.
(when (and (not (plist-member args :demand)) (when (and (not (plist-member args :demand))
(not (plist-member args :defer)) (not (plist-member args :defer))
(or (plist-member args :bind) (cl-some #'identity
(plist-member args :bind*) (mapcar (apply-partially #'plist-member args)
(plist-member args :bind-keymap) use-package-deferring-keywords)))
(plist-member args :bind-keymap*)
(plist-member args :interpreter)
(plist-member args :mode)
(plist-member args :magic)
(plist-member args :magic-fallback)
(plist-member args :commands)
(plist-member args :hook)))
(setq args (append args '(:defer t)))) (setq args (append args '(:defer t))))
(when (and (plist-member args :load) (when (and (plist-member args :load)