aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoam Postavsky2016-08-05 18:43:34 -0400
committerNoam Postavsky2016-10-31 08:49:21 -0400
commit9688d2f64bd01b86a98ccd87138e6fc0a345e62b (patch)
treed30c08aa47881e969f2bda0500a734777d8f8efb
parent65c7b42a14c5ad42d4b6c6e6547c793e0ccbfe80 (diff)
downloademacs-9688d2f64bd01b86a98ccd87138e6fc0a345e62b.tar.gz
emacs-9688d2f64bd01b86a98ccd87138e6fc0a345e62b.zip
Don't allow implicit package name arg for binders
It's unlikely that (use-package foopkg :bind "<some-key>") intendes to bind <some-key> to 'foopkg command.
-rw-r--r--lisp/use-package/use-package.el4
-rw-r--r--test/lisp/use-package/use-package-tests.el2
2 files changed, 6 insertions, 0 deletions
diff --git a/lisp/use-package/use-package.el b/lisp/use-package/use-package.el
index 96137c3c78d..f99a3767777 100644
--- a/lisp/use-package/use-package.el
+++ b/lisp/use-package/use-package.el
@@ -712,6 +712,10 @@ If RECURSED is non-nil, recurse into sublists."
712(defun use-package-normalize-binder (name keyword args) 712(defun use-package-normalize-binder (name keyword args)
713 (use-package-as-one (symbol-name keyword) args 713 (use-package-as-one (symbol-name keyword) args
714 (lambda (label arg) 714 (lambda (label arg)
715 (unless (consp arg)
716 (use-package-error
717 (concat label " a (<string or vector> . <symbol or string>)"
718 " or list of these")))
715 (use-package-normalize-pairs (lambda (k) (or (stringp k) (vectorp k))) 719 (use-package-normalize-pairs (lambda (k) (or (stringp k) (vectorp k)))
716 (lambda (b) (or (symbolp b) (stringp b))) 720 (lambda (b) (or (symbolp b) (stringp b)))
717 name label arg)))) 721 name label arg))))
diff --git a/test/lisp/use-package/use-package-tests.el b/test/lisp/use-package/use-package-tests.el
index d3deef995b1..00682e9e0fc 100644
--- a/test/lisp/use-package/use-package-tests.el
+++ b/test/lisp/use-package/use-package-tests.el
@@ -33,6 +33,8 @@
33 'foopkg :bind good-values) 33 'foopkg :bind good-values)
34 good-values))) 34 good-values)))
35 (should-error (use-package-normalize-binder 35 (should-error (use-package-normalize-binder
36 'foopkg :bind '("foo")))
37 (should-error (use-package-normalize-binder
36 'foopkg :bind '("foo" . 99))) 38 'foopkg :bind '("foo" . 99)))
37 (should-error (use-package-normalize-binder 39 (should-error (use-package-normalize-binder
38 'foopkg :bind '(99 . sym)))) 40 'foopkg :bind '(99 . sym))))