]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix bad interaction between bind-keys* and the :package keyword
authorJohn Wiegley <johnw@newartisans.com>
Tue, 5 Dec 2017 18:29:04 +0000 (10:29 -0800)
committerJohn Wiegley <johnw@newartisans.com>
Tue, 5 Dec 2017 18:29:51 +0000 (10:29 -0800)
Fixes https://github.com/jwiegley/use-package/issues/558

lisp/use-package/bind-key.el
test/lisp/use-package/use-package-tests.el

index 54961ecd96e91b0905055dc9a7ec36f33de2a086..f5477945b4bf5620cb15284a25981db61610c2e3 100644 (file)
@@ -222,8 +222,10 @@ function symbol (unquoted)."
   ;; jww (2016-02-26): This is a hack; this whole function needs to be
   ;; rewritten to normalize arguments the way that use-package.el does.
   (if (and (eq (car args) :package)
-           (not (eq (car (cdr (cdr args))) :map)))
+           (not (eq (car (cdr (cdr args))) :map))
+           (not keymap))
       (setq args (cons :map (cons 'global-map args))))
+
   (let ((map keymap)
         doc
         prefix-map
@@ -267,7 +269,7 @@ function symbol (unquoted)."
 
       (cl-flet
           ((wrap (map bindings)
-                 (if (and map pkg (not (eq map 'global-map)))
+                 (if (and map pkg (not (memq map '(global-map override-global-map))))
                      `((if (boundp ',map)
                            (progn ,@bindings)
                          (eval-after-load
@@ -320,8 +322,7 @@ function symbol (unquoted)."
 
 ;;;###autoload
 (defmacro bind-keys* (&rest args)
-  (macroexp-progn
-   (bind-keys-form args 'override-global-map)))
+  (macroexp-progn (bind-keys-form args 'override-global-map)))
 
 (defun get-binding-description (elem)
   (cond
index 938e990b856da4a580e68c674fedbc203d58307d..67d7c6f7e4d4a452dada0d094a2ef302ed23fc07 100644 (file)
       (use-package-ensure-elpa 'hydra '(t) 'nil)
       (require 'hydra nil nil))))
 
+(ert-deftest use-package-test/558 ()
+  (match-expansion
+   (bind-keys* :package org-ref
+               ("C-c C-r" . org-ref-helm-insert-cite-link))
+   `(bind-key "C-c C-r" #'org-ref-helm-insert-cite-link override-global-map nil)))
+
 (ert-deftest bind-key/:prefix-map ()
   (match-expansion
    (bind-keys :prefix "<f1>"