emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: package.el strings


From: Jean-Christophe Helary
Subject: Re: package.el strings
Date: Sun, 17 Jun 2018 23:45:46 +0900

Eli,

Thank you for the quick check.

On Jun 17, 2018, at 23:33, Eli Zaretskii <address@hidden> wrote:

From: Jean-Christophe Helary <address@hidden>
Date: Sun, 17 Jun 2018 23:02:08 +0900
Cc: Emacs developers <address@hidden>

There is indeed another change I want to make but that can wait. It involves removing some of the text decorations to be able to straighten some strings.

If there is an agreement to proceed I can do that later. In the meanwhile it would be nice if you could first commit the biggest part of the modifications.

Thanks, but there are a couple of hunks I don't understand:

(defcustom package-archives `(("gnu" .
-                               ,(format "http%s://elpa.gnu.org/packages/"
-                                        (if (gnutls-available-p) "s" ""))))
+                               ,(let ((https "https://elpa.gnu.org/packages/")
+                                      (http   "http://elpa.gnu.org/packages/"))
+                                  (if (gnutls-available-p) https http))))
+

Why did you need this change?

That's something we discussed last year:

On Jul 1, 2017, at 10:56, Jean-Christophe Helary <address@hidden> wrote:


On Jun 22, 2017, at 10:57, Richard Stallman <address@hidden> 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 


-           (dir (expand-file-name (format "archives/%s" name) package-user-dir))
+           (dir (expand-file-name (concat "archives/" name) package-user-dir))

Same question here.

I don't remember. I wrote this part last year. I guess I was trying to separate format and concat use: format for user visible strings and concat for internal strings. But you can also read that as a reaction to the format abuse in package.el... concat makes the string shorter without compromise.

-        (message "No packages to upgrade.")
+        (message "No packages to upgrade")

I think our style is not to include a period in messages.

I think I removed a period here. What are you referring to?


Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune



reply via email to

[Prev in Thread] Current Thread [Next in Thread]