]> git.eshelyaron.com Git - emacs.git/commitdiff
:map no longer accepts lists; only eval-after-load if necessary
authorJohn Wiegley <johnw@newartisans.com>
Sat, 27 Feb 2016 08:48:29 +0000 (00:48 -0800)
committerJohn Wiegley <johnw@newartisans.com>
Sat, 27 Feb 2016 08:48:29 +0000 (00:48 -0800)
Fixes https://github.com/jwiegley/use-package/issues/324

lisp/use-package/bind-key.el

index b63c34a197645c5dcb87d59e4490e3720635915b..995e4816ff4122b96cedebbc0342f88ffc34f13a 100644 (file)
@@ -211,7 +211,6 @@ function symbol (unquoted)."
            (not (eq (car (cdr (cdr args))) :map)))
       (setq args (cons :map (cons 'global-map args))))
   (let* ((map (plist-get args :map))
-         (maps (if (listp map) map (list map)))
          (doc (plist-get args :prefix-docstring))
          (prefix-map (plist-get args :prefix-map))
          (prefix (plist-get args :prefix))
@@ -239,13 +238,15 @@ function symbol (unquoted)."
               (nconc first (list (car args)))
             (setq first (list (car args))))
           (setq args (cdr args))))
-      (cl-flet ((wrap (maps bindings)
-                      (if (and maps pkg
-                               (not (equal maps '(global-map))))
-                          `((eval-after-load
-                                ,(if (symbolp pkg) `',pkg pkg)
-                              '(progn ,@bindings)))
-                        bindings)))
+      (cl-flet
+          ((wrap (map bindings)
+                 (if (and map pkg (not (eq map 'global-map)))
+                     (if (boundp map)
+                         bindings
+                       `((eval-after-load
+                             ,(if (symbolp pkg) `',pkg pkg)
+                           '(progn ,@bindings))))
+                   bindings)))
         (append
          (when prefix-map
            `((defvar ,prefix-map)
@@ -253,23 +254,16 @@ function symbol (unquoted)."
              ,@(if menu-name
                    `((define-prefix-command ',prefix-map nil ,menu-name))
                  `((define-prefix-command ',prefix-map)))
-             ,@(if (and maps (not (equal maps '(global-map))))
-                   (wrap maps
-                         (mapcar
-                          #'(lambda (m)
-                              `(bind-key ,prefix ',prefix-map ,m ,filter))
-                          maps))
+             ,@(if (and map (not (eq map 'global-map)))
+                   (wrap map `((bind-key ,prefix ',prefix-map ,map ,filter)))
                  `((bind-key ,prefix ',prefix-map nil ,filter)))))
-         (wrap maps
+         (wrap map
                (cl-mapcan
                 (lambda (form)
                   (if prefix-map
                       `((bind-key ,(car form) ',(cdr form) ,prefix-map ,filter))
-                    (if (and maps (not (equal maps '(global-map))))
-                        (mapcar
-                         #'(lambda (m)
-                             `(bind-key ,(car form) ',(cdr form) ,m ,filter))
-                         maps)
+                    (if (and map (not (eq map 'global-map)))
+                        `((bind-key ,(car form) ',(cdr form) ,map ,filter))
                       `((bind-key ,(car form) ',(cdr form) nil ,filter)))))
                 first))
          (when next