From 9688d2f64bd01b86a98ccd87138e6fc0a345e62b Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Fri, 5 Aug 2016 18:43:34 -0400 Subject: [PATCH] Don't allow implicit package name arg for binders It's unlikely that (use-package foopkg :bind "") intendes to bind to 'foopkg command. --- lisp/use-package/use-package.el | 4 ++++ test/lisp/use-package/use-package-tests.el | 2 ++ 2 files changed, 6 insertions(+) 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." (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 ( . )" + " 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)))) 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 @@ -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 -- 2.39.2