]> git.eshelyaron.com Git - emacs.git/commitdiff
Delay decision whether to use eval-after-load until run-time
authorJonas Bernoulli <jonas@bernoul.li>
Sun, 18 Dec 2016 14:47:36 +0000 (15:47 +0100)
committerJonas Bernoulli <jonas@bernoul.li>
Sun, 18 Dec 2016 14:47:36 +0000 (15:47 +0100)
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.

lisp/use-package/bind-key.el

index 995e4816ff4122b96cedebbc0342f88ffc34f13a..35a4e3c6655e52558cb70fc323e0cb1e9a627f56 100644 (file)
@@ -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)))