]> git.eshelyaron.com Git - emacs.git/commitdiff
Allow :custom (foo1 bar1) (foo2 bar2) etc
authorJohn Wiegley <johnw@newartisans.com>
Tue, 28 Nov 2017 22:16:13 +0000 (14:16 -0800)
committerJohn Wiegley <johnw@newartisans.com>
Tue, 28 Nov 2017 22:16:13 +0000 (14:16 -0800)
Fixes https://github.com/jwiegley/use-package/issues/518

lisp/use-package/use-package.el

index 648e2c7c8aea61bdbc43a93174651a81820a7ffc..f6c21e0a903d1fd269f97ec3cb2162b61befecd0 100644 (file)
@@ -1420,7 +1420,7 @@ deferred until the prefix key sequence is pressed."
     (lambda (label arg)
       (unless (or (symbolp arg) (consp arg))
         (use-package-error
-         (concat label " a <symbol> or a (<symbol> . <symbol or function>)"
+         (concat label " a <symbol> or (<symbol or list of symbols> . <symbol or function>)"
                  " or list of these")))
       (use-package-normalize-pairs
        #'(lambda (k)
@@ -1463,20 +1463,15 @@ deferred until the prefix key sequence is pressed."
 ;;; :custom
 ;;
 
-(defun use-package-normalize/:custom (name-symbol keyword args)
+(defun use-package-normalize/:custom (name keyword args)
   "Normalize use-package custom keyword."
-  (cond
-   ((and (= (length args) 1)
-         (listp (car args))
-         (listp (car (car args))))
-    (car args))
-   ((and (= (length args) 1)
-         (listp (car args)))
-    args)
-   (t
-    (use-package-error
-     (concat label " a (<symbol> <value> [comment])"
-             " or list of these")))))
+  (use-package-as-one (symbol-name keyword) args
+    (lambda (label arg)
+      (unless (listp arg)
+        (use-package-error
+         (concat label " a (<symbol> <value> [comment])"
+                 " or list of these")))
+      arg)))
 
 (defun use-package-handler/:custom (name keyword args rest state)
   "Generate use-package custom keyword code."