1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-12 18:55:13 -08:00

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.
This commit is contained in:
Philip Kaludercic 2026-02-01 19:41:04 +01:00
parent 24f45c85ea
commit 9b1935dc2e
No known key found for this signature in database

View file

@ -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))) "."