From: Jonas Bernoulli Date: Sun, 18 Dec 2016 14:47:36 +0000 (+0100) Subject: Delay decision whether to use eval-after-load until run-time X-Git-Tag: emacs-29.0.90~1306^2~15^2~285^2 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=75e0cd93c53beff2abe81b8e2f0bd25d9098f078;p=emacs.git Delay decision whether to use eval-after-load until run-time Just because a keymap variable is bound at macro-expansion-time doesn't mean that it must be bound at run-time too. Change `bind-keys-form', which is used by `bind-keys' and other macros, to return a form which delays the decision on whether to wrap the binding forms with `eval-after-load' until run-time. Fixes https://github.com/jwiegley/use-package/issues/378. --- diff --git a/lisp/use-package/bind-key.el b/lisp/use-package/bind-key.el index 995e4816ff4..35a4e3c6655 100644 --- a/lisp/use-package/bind-key.el +++ b/lisp/use-package/bind-key.el @@ -241,9 +241,9 @@ function symbol (unquoted)." (cl-flet ((wrap (map bindings) (if (and map pkg (not (eq map 'global-map))) - (if (boundp map) - bindings - `((eval-after-load + `((if (boundp ',map) + (progn ,@bindings) + (eval-after-load ,(if (symbolp pkg) `',pkg pkg) '(progn ,@bindings)))) bindings)))