From aff85304d9d9de1ef7833a4ee35b5c081cc80bc7 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Sun, 18 Jan 2026 22:14:54 +0100 Subject: [PATCH] Have 'package-find-news-file' handle built-in packages * lisp/emacs-lisp/package.el (package-find-news-file): Abort early if the package is built-in. (describe-package-1): Do not invoke 'package-find-news-file' if missing a package descriptor. --- lisp/emacs-lisp/package.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index af8a700bd18..5c18baa5e47 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2640,7 +2640,9 @@ The description is read from the installed package files." (defun package-find-news-file (pkg-desc) "Return the file name of a news file of PKG-DESC. If no such file exists, the function returns nil." - (let ((default-directory (package-desc-dir pkg-desc))) + (and-let* ((pkg-dir (package-desc-dir pkg-desc)) + (_ (not (eq pkg-dir 'builtin))) + (default-directory pkg-dir)) (catch 'success (dolist (file '("NEWS-elpa" "news") nil) ;TODO: add user option? (when (and (file-readable-p file) (file-regular-p file)) @@ -2675,7 +2677,7 @@ Helper function for `describe-package'." (maintainers (or (cdr (assoc :maintainer extras)) (cdr (assoc :maintainers extras)))) (authors (cdr (assoc :authors extras))) - (news (package-find-news-file desc))) + (news (and desc (package-find-news-file desc)))) (when (string= status "avail-obso") (setq status "available obsolete")) (when incompatible-reason