Subject: Re: [elpa] elpa-admin 1d766451f8: Suggest `package-install' to install packages (bug#63800)

From: Stefan Monnier <[email-masked]>
Date: Thu, 13 Jul 2023 13:26:41 -0400

Ihor Radchenko [2023-07-13 13:35:53] wrote:

> Stefan Monnier <[email-masked]> writes:
>
>>> There is no bug in Emacs here. Just on ELPA page providing instructions
>>> that are not working for :core packages.
>>
>> I still think there's a bug in there because the behavior may not be
>> what the user expects.  Maybe `package-install` should be improved so
>> that, instead of doing nothing it tells or prompts the user about the
>> possibility to upgrade the package (presumably only do it when called interactively).
>
> AFAIU, one of the problems is that already installed packages do not
> even show up in the completion and one cannot enter
> M-x package-install <RET> org <RET>. The last <RET> will only trigger
> completion window where org is not listed at all.
>
> But wasn't this discussed in the past? There was quite a lengthy
> discussion about this in the past (I did not quite follow it until the
> end).
>
>>> I could also put the `list-packages' suggestion behind check if the
>>> package is :core or not.
>>
>> That would be best.  Even better would be to provide instructions we
>> don't have to be ashamed of.  E.g. replace `package-install` with
>> `package-upgrade` for packages that are in-core.
>
> package-upgrade is not available in any of the released Emacs versions.
> Do note that some people still use ELPA to install packages for Emacs
> 26.

How 'bout simply:

diff --git a/elpa-admin.el b/elpa-admin.el
index 2c2d2aeab7..3d2bdcc2ef 100644
--- a/elpa-admin.el
+++ b/elpa-admin.el
@@ -1863,10 +1863,7 @@ arbitrary code."
       (insert (format "<dt>Badge</dt><dd><img src=\"%s.svg\"/></dd>\n" (elpaa--html-quote name)))
       (elpaa--html-insert-docs pkg-spec)
       (insert "</dl>")
-      (insert (format "<p>To install this package, run in Emacs:</p>
-                       <pre>M-x <span class=\"kw\">list-packages</span> RET</pre>
-                       <p>Then, find <span class=\"kw\">%s</span> in the list, click on the link, and click <pre>Install</pre>.</p>"
-                      name))
+      (insert "<p>To install this package from Emacs, use <code>package-install</code> or <code>list-packages</code>.</p>")
       (let* ((readme-content (elpaa--get-README pkg-spec srcdir))
              (readme-text plain-readme)
              (readme-html (elpaa--section-to-html readme-content))

-- Stefan