From c516f217d620c153d4e7e61a4ea8b921eb9e84b0 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Tue, 2 Sep 2025 16:06:19 +0200 Subject: [PATCH] Gracefully handle the non-existence of "package-autosuggest.eld" * lisp/package/package-autosuggest.el (package-autosuggest-database): Check if the file name exists and is readable before slurping the contents. --- lisp/package/package-autosuggest.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lisp/package/package-autosuggest.el b/lisp/package/package-autosuggest.el index b0a6e863191..6125adb456b 100644 --- a/lisp/package/package-autosuggest.el +++ b/lisp/package/package-autosuggest.el @@ -37,10 +37,11 @@ (defconst package-autosuggest-database (eval-when-compile - (with-temp-buffer - (insert-file-contents - (expand-file-name "package-autosuggest.eld" data-directory)) - (read (current-buffer)))) + (if-let* ((db (expand-file-name "package-autosuggest.eld" data-directory)) + ((file-exists-p db))) + (with-temp-buffer + (insert-file-contents db) + (read (current-buffer))))) "List of hints for packages to suggest installing. Each hint has the form (PACKAGE TYPE DATA), where PACKAGE is a symbol denoting the package and major-mode the hint applies to, TYPE is one of