]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve use-package error message on wrong type
authorStefan Kangas <stefankangas@gmail.com>
Sun, 2 Mar 2025 02:59:22 +0000 (03:59 +0100)
committerEshel Yaron <me@eshelyaron.com>
Tue, 4 Mar 2025 20:58:13 +0000 (21:58 +0100)
* lisp/use-package/use-package-core.el (use-package): Improve error
message when passed the wrong type.  (Bug#72160)

(cherry picked from commit 38782e684bf5f67e2d8f69daeeb17f37cf4b2c3f)

lisp/use-package/use-package-core.el

index c457b5310525c1715eaa20c87b6cd975e9bb2eff..18181731231605b222c270567c2048874665f303 100644 (file)
@@ -1748,6 +1748,15 @@ Usage:
 :vc              Install the package directly from a version control system
                  (using `package-vc.el')."
   (declare (indent defun))
+  (when (stringp name)
+    (user-error "String where there should be a symbol.  \
+Try this instead: `(use-package %s ...)'"
+                name))
+  (when (and (consp name) (eq (car name) 'quote))
+    (user-error "Quoted symbol where it should be unquoted.  \
+Try this instead: `(use-package %s ...)'"
+                (symbol-name (cadr name))))
+  (cl-check-type name symbol)
   (unless (memq :disabled args)
     (macroexp-progn
      (use-package-concat