]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't allow :commands, :bind, etc., to be given an empty list
authorJohn Wiegley <johnw@newartisans.com>
Tue, 28 Nov 2017 19:16:12 +0000 (11:16 -0800)
committerJohn Wiegley <johnw@newartisans.com>
Tue, 28 Nov 2017 19:17:05 +0000 (11:17 -0800)
This makes the following an error:

    :commands
    :commands nil
    :commands ()

Fixes https://github.com/jwiegley/use-package/issues/512

lisp/use-package/use-package.el

index 26ede8483fdcb379a45f7f9c89f1bfffc4b628f1..77c2aebdc1055f7f6e9c679fddbea9c204cddebc 100644 (file)
@@ -828,12 +828,12 @@ If the package is installed, its entry is removed from
 (defun use-package-as-one (label args f)
   "Call F on the first element of ARGS if it has one element, or all of ARGS."
   (declare (indent 1))
-  (if (and (listp args) (listp (cdr args)))
+  (if (and (not (null args)) (listp args) (listp (cdr args)))
       (if (= (length args) 1)
           (funcall f label (car args))
         (funcall f label args))
     (use-package-error
-     (concat label " wants a list"))))
+     (concat label " wants a non-empty list"))))
 
 (put 'use-package-as-one 'lisp-indent-function 'defun)