]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't allow implicit package name arg for binders
authorNoam Postavsky <npostavs@gmail.com>
Fri, 5 Aug 2016 22:43:34 +0000 (18:43 -0400)
committerNoam Postavsky <npostavs@gmail.com>
Mon, 31 Oct 2016 12:49:21 +0000 (08:49 -0400)
It's unlikely that

    (use-package foopkg :bind "<some-key>")

intendes to bind <some-key> to 'foopkg command.

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

index 96137c3c78d75cac30d002bf4d08229ef6497bc6..f99a3767777e8e92f6cf6243b4c9a3b2dd51305c 100644 (file)
@@ -712,6 +712,10 @@ If RECURSED is non-nil, recurse into sublists."
 (defun use-package-normalize-binder (name keyword args)
   (use-package-as-one (symbol-name keyword) args
     (lambda (label arg)
+      (unless (consp arg)
+        (use-package-error
+         (concat label " a (<string or vector> . <symbol or string>)"
+                 " or list of these")))
       (use-package-normalize-pairs (lambda (k) (or (stringp k) (vectorp k)))
                                    (lambda (b) (or (symbolp b) (stringp b)))
                                    name label arg))))
index d3deef995b1c57426e04f3b53c639969c8df08c1..00682e9e0fca12be1f3e43d41808c126faabb394 100644 (file)
@@ -32,6 +32,8 @@
     (should (equal (use-package-normalize-binder
                     'foopkg :bind good-values)
                    good-values)))
+  (should-error (use-package-normalize-binder
+                 'foopkg :bind '("foo")))
   (should-error (use-package-normalize-binder
                  'foopkg :bind '("foo" . 99)))
   (should-error (use-package-normalize-binder