From 71ce1288fcc3e331e61af0d6e2152ec9e10f9d8e Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 23 Apr 2026 14:26:27 -0400 Subject: Handle syntax errors in `Package-Requires:` more gracefully * elpa-admin.el (elpaa--demote-deps-syntax-errors): New function. (lm-package-requires): Use it. --- elpa-admin.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/elpa-admin.el b/elpa-admin.el index 0467af3..cce5a9e 100644 --- a/elpa-admin.el +++ b/elpa-admin.el @@ -1454,6 +1454,17 @@ PROGRAM, DESTINATION, ARGS is like in `elpaa--call'." (or (apply orig-fun "package-maintainer" args) (apply orig-fun header args)))) +;; FIXME: Fix that in `package-buffer-info'. +(advice-add 'lm-package-requires :around #'elpaa--demote-deps-syntax-errors) +(defun elpaa--demote-deps-syntax-errors (orig-fun &rest args) + (condition-case err + (apply orig-fun args) + (error + ;; FIXME: Sadly, the invalid version number causes errors later on. + ;;`((syntax-error-in-Package-Requires ,(error-message-string err))) + `((syntax-error-in-Package-Requires "0") + (,(make-symbol (error-message-string err)) "0"))))) + (defun elpaa--metadata (dir pkg-spec) "Return a list (SIMPLE VERSION DESCRIPTION REQ EXTRAS). SIMPLE is non-nil if the package is simple; @@ -1811,6 +1822,7 @@ which see." ((or "md" "markdown") 'text/markdown) (_ (require 'mailcap) + (declare-function mailcap-extension-to-mime "mailcap" (extn)) (let ((mt (if ext (mailcap-extension-to-mime ext)))) (if mt (intern mt) 'text/plain))))) -- cgit v1.0