diff options
author | John Wiegley <johnw@newartisans.com> | 2017-12-07 13:14:32 -0800 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2017-12-07 13:14:32 -0800 |
commit | 8fefa49d39dde99dfd13ff9551723ec387a3bfba (patch) | |
tree | dbe4b1a57074f732c64c316652d9505c01612be8 /lisp/use-package/use-package-bind-key.el | |
parent | 80e8a599b4392bbb45a6263c8e750db267b8e4e9 (diff) | |
download | emacs-8fefa49d39dde99dfd13ff9551723ec387a3bfba.tar.gz emacs-8fefa49d39dde99dfd13ff9551723ec387a3bfba.tar.bz2 emacs-8fefa49d39dde99dfd13ff9551723ec387a3bfba.zip |
Changes to the way auto-deferral is indicated
This change adds a new extension hook `use-package-autoloads/<KEYWORD>` for
specifying exactly which autoloads a keyword should imply. This is the proper
way to indicate autoloads, rather than adding to the `:commands` entry as was
done before.
Further, autoloading now must occur in order to cause implied deferred
loading; if :bind is used with only lambda forms, for example, this will not
cause deferred loading without `:defer t`.
Diffstat (limited to 'lisp/use-package/use-package-bind-key.el')
-rw-r--r-- | lisp/use-package/use-package-bind-key.el | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/lisp/use-package/use-package-bind-key.el b/lisp/use-package/use-package-bind-key.el index 4a3d421522b..6a8e3fbe8eb 100644 --- a/lisp/use-package/use-package-bind-key.el +++ b/lisp/use-package/use-package-bind-key.el @@ -114,20 +114,23 @@ deferred until the prefix key sequence is pressed." ;;;###autoload (defalias 'use-package-normalize/:bind* 'use-package-normalize-binder) +;; jww (2017-12-07): This is too simplistic. It will fail to determine +;; autoloads in this situation: +;; (use-package foo +;; :bind (:map foo-map (("C-a" . func)))) +;;;###autoload +(defalias 'use-package-autoloads/:bind 'use-package-autoloads-mode) +;;;###autoload +(defalias 'use-package-autoloads/:bind* 'use-package-autoloads-mode) + ;;;###autoload (defun use-package-handler/:bind (name keyword args rest state &optional bind-macro) - (let* ((result (use-package-normalize-commands args)) - (nargs (car result)) - (commands (cdr result))) - (use-package-concat - (use-package-process-keywords name - (use-package-sort-keywords - (use-package-plist-append rest :commands commands)) - state) - `((ignore - (,(if bind-macro bind-macro 'bind-keys) - :package ,name ,@nargs)))))) + (use-package-concat + (use-package-process-keywords name rest state) + `((ignore + (,(if bind-macro bind-macro 'bind-keys) + :package ,name ,@(use-package-normalize-commands args)))))) (defun use-package-handler/:bind* (name keyword arg rest state) (use-package-handler/:bind name keyword arg rest state 'bind-keys*)) |