From 9b1935dc2e600d47fff9250b052dd80cc658b34f Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Sun, 1 Feb 2026 19:41:04 +0100 Subject: [PATCH] Explain why package suggestions match * lisp/emacs-lisp/package.el (package--autosugest-prompt): Go through all suggestions for the same package and mention why a package suggestion was relevant. --- lisp/emacs-lisp/package.el | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 23a95c73416..d587c8bbfd9 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -4679,12 +4679,25 @@ Emacs can provide the editor support for these kinds of files:" nl) (insert nl "(Note that there are multiple candidate packages, so you have to select which to install!)" nl)) - (pcase-dolist ((and sug `(,pkg . ,_)) packages) + (pcase-dolist (`(,pkg . ,sugs) (seq-group-by #'car packages)) (insert nl "* " (buttonize "Install" (lambda (_) - (package--autosuggest-install-and-enable sug) + (package--autosuggest-install-and-enable + (car sugs)) (quit-window))) - " \"" (buttonize (symbol-name pkg) #'describe-package pkg) "\".") + " \"" (buttonize (symbol-name pkg) #'describe-package pkg) "\" (") + (dolist (sug sugs) + (unless (eq (char-before) ?\() + (insert ", ")) + (pcase sug + (`(,_ auto-mode-alist . ,_) + (insert "matches file extension ")) + (`(,_ magic-mode-alist . ,_) + (insert "matches magic bytes")) + (`(,_ interpreter-mode-alist . ,_) + (insert "matches interpreter ")))) + (delete-horizontal-space) (insert ")") + (add-to-list 'package--autosuggest-suggested pkg)) (insert nl "* " (buttonize "Do not install anything" (lambda (_) (quit-window))) "."