On Jun 22, 2017, at 10:57, Richard Stallman <rms@gnu.org> wrote:
(format "http%s://elpa.gnu.org/packages/"
(if (gnutls-available-p) "s" ""))
Yes, it is. But obviously I think that, since I wrote it.
I agree it is acceptable, but this looks like something that might be
needed in a number of places, so perhaps we should make a nicer
interface to do it.
There is only one instance of such a query in package.el and no other package in the emacs distribution seems to use gnutls-available-p to add an "s" to http.
Paul suggested that it would be a maintenance hassle to keep 2 almost identical urls if we spelled them out as Yuri suggested but I checked other source packages and for ex auth-source-pass-tests.el explicitly spells out all the urls without resorting to smart formatting to save a few characters.
Also, considering the way %s is abused in other places package.el, for ex in:
(message "%d package%s marked for upgrading."
(length upgrades)
(if (= (length upgrades) 1) "" "s")))))
I don't think it is good to keep the above code because it gives bad incentives to authors especially if work on i18n/l10n proceeds (even though http/https is not related to l10n).
So, I'm going to spell out the urls as I proceed with untangling code and translatable strings in package.el. I'll send a diff here when I'm done for evaluation.
Jean-Christophe