]> git.eshelyaron.com Git - emacs.git/commitdiff
Merge remote-tracking branch 'origin/pr/349'
authorJohn Wiegley <johnw@newartisans.com>
Thu, 16 Feb 2017 19:14:25 +0000 (11:14 -0800)
committerJohn Wiegley <johnw@newartisans.com>
Thu, 16 Feb 2017 19:14:25 +0000 (11:14 -0800)
1  2 
lisp/use-package/use-package.el

index f933ce2d936c2427c19bbecb47e38f45fcdd5a57,f99a3767777e8e92f6cf6243b4c9a3b2dd51305c..b20d149cb8627353d3a5a5a62cce5efef2e36fe1
@@@ -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)