Improve use-package error message on wrong type

* lisp/use-package/use-package-core.el (use-package): Improve error
message when passed the wrong type.  (Bug#72160)
This commit is contained in:
Stefan Kangas 2025-03-02 03:59:22 +01:00
parent be8a7c9c88
commit 38782e684b

View file

@ -1893,6 +1893,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