From: John Wiegley Date: Thu, 16 Feb 2017 19:14:25 +0000 (-0800) Subject: Merge remote-tracking branch 'origin/pr/349' X-Git-Tag: emacs-29.0.90~1306^2~15^2~275 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a4c3244f3099decbcec813cb1c51182d423745a5;p=emacs.git Merge remote-tracking branch 'origin/pr/349' --- a4c3244f3099decbcec813cb1c51182d423745a5 diff --cc lisp/use-package/use-package.el index f933ce2d936,f99a3767777..b20d149cb86 --- a/lisp/use-package/use-package.el +++ b/lisp/use-package/use-package.el @@@ -747,34 -678,27 +747,27 @@@ manually updated package. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; -;; :bind, :bind* +;;; :bind, :bind* ;; - (defsubst use-package-is-sympair (x &optional allow-vector) - "Return t if X has the type (STRING . SYMBOL)." + (defsubst use-package-is-pair (x car-pred cdr-pred) + "Return non-nil if X is a cons satisfying the given predicates. + CAR-PRED and CDR-PRED are applied to X's `car' and `cdr', + respectively." (and (consp x) - (or (stringp (car x)) - (and allow-vector (vectorp (car x)))) - (symbolp (cdr x)))) - - (defsubst use-package-is-string-pair (x) - "Return t if X has the type (STRING . STRING)." - (and (consp x) - (stringp (car x)) - (stringp (cdr x)))) + (funcall car-pred (car x)) + (funcall cdr-pred (cdr x)))) (defun use-package-normalize-pairs - (name label arg &optional recursed allow-vector allow-string-cdrs) - "Normalize a list of string/symbol pairs. - If RECURSED is non-nil, recurse into sublists. - If ALLOW-VECTOR is non-nil, then the key to bind may specify a - vector of keys, as accepted by `define-key'. - If ALLOW-STRING-CDRS is non-nil, then the command name to bind to - may also be a string, as accepted by `define-key'." + (key-pred val-pred name label arg &optional recursed) + "Normalize a list of pairs. + KEY-PRED and VAL-PRED are predicates recognizing valid keys and + values, respectively. + If RECURSED is non-nil, recurse into sublists." (cond - ((or (stringp arg) (and allow-vector (vectorp arg))) + ((funcall key-pred arg) (list (cons arg (use-package-as-symbol name)))) - ((use-package-is-sympair arg allow-vector) + ((use-package-is-pair arg key-pred val-pred) (list arg)) ((and (not recursed) (listp arg) (listp (cdr arg))) (mapcar #'(lambda (x)