1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

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.
This commit is contained in:
Noam Postavsky 2016-08-05 18:43:34 -04:00
parent 65c7b42a14
commit 9688d2f64b
2 changed files with 6 additions and 0 deletions

View 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))))

View 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