From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Jean-Christophe Helary Newsgroups: gmane.emacs.devel Subject: Re: package.el strings Date: Sun, 17 Jun 2018 23:02:08 +0900 Message-ID: References: <83y3rpeubc.fsf@gnu.org> <07C02D08-66BB-4454-AA25-B512BFC39A2A@gmail.com> <83vamk965y.fsf@gnu.org> <84FCCBF3-F20F-48E2-B05E-F6DB218D8896@gmail.com> <87lgdarcwi.fsf@gmail.com> <87in8eqk93.fsf@gmail.com> <87wowroub1.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (Mac OS X Mail 11.4 \(3445.8.2\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_6E3B28B6-EE9F-4E08-9B9E-34BC5F7D2499" X-Trace: blaine.gmane.org 1529244704 29733 195.159.176.226 (17 Jun 2018 14:11:44 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 17 Jun 2018 14:11:44 +0000 (UTC) Cc: Emacs developers To: Noam Postavsky Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jun 17 16:11:40 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fUYP5-0007ZY-Od for ged-emacs-devel@m.gmane.org; Sun, 17 Jun 2018 16:11:40 +0200 Original-Received: from localhost ([::1]:55433 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fUYRB-0004CG-6N for ged-emacs-devel@m.gmane.org; Sun, 17 Jun 2018 10:13:49 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56911) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fUYG1-0002w7-LN for emacs-devel@gnu.org; Sun, 17 Jun 2018 10:02:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fUYFy-00088X-FP for emacs-devel@gnu.org; Sun, 17 Jun 2018 10:02:17 -0400 Original-Received: from mail-pf0-x22b.google.com ([2607:f8b0:400e:c00::22b]:34552) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fUYFy-00087H-3i for emacs-devel@gnu.org; Sun, 17 Jun 2018 10:02:14 -0400 Original-Received: by mail-pf0-x22b.google.com with SMTP id a63-v6so6931732pfl.1 for ; Sun, 17 Jun 2018 07:02:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=fSPOfXzskQUK9Q1jLeyePeByJI+xkbD3+ixx8ckADRg=; b=cyY3uRiHlDuyEJpiVNbHV483mDc6Mv7T7zDq7suu1HxYjt+wVNk3RT1VD6wknOsEST UBaIz5qWHvrd5RNS3kT399PMN4QaGBF292sW2Wgh0ZByo/OODdKc+op1LcWsADMMerq/ lQBhTGaj5/sQzFJsLyxpBBAB/CrSTvvYuSnaTviOd5+CM9rGhSSPfEeesoFg685VqXP7 RCOxs4wk+yyw6xB9lQ1W6UMCI3czdQoIYMDBxOYV3r7AItd6edn1I5Ym4tPEkD25dPvi rQ7L5DKrFt0K+sv9d1EpH/Bfe+n5tCiQEH1yczVUOdmyKva00Am1M8617BsBOL+mV89W clRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=fSPOfXzskQUK9Q1jLeyePeByJI+xkbD3+ixx8ckADRg=; b=sKczKw7l6OYCPSJdCzqwiH1ih3oM9vlGsHUXRoTWZINvdfqGa4Rfv8wB012ZHSWGeL WRCfkAaCddG2iiiiHU2G358d+X/85Sb6UB5gLgpKpffyLqZg2ULwP7fz1XdJshd7y9ey 5754yNXaSZi9X3eYdk+auPyoG3PM2fj9CjXlIPGVf4qYe0+uD+17gNsnDIwD7bxrA4ev CPusfBeW8oVVrqzQbW3I3gqL+cGp8erE180cUTuDv5WzqaNnvv8lh+k4kLir+v/kQaCe 1TfsQc/uMTB/gS/ekUQDNaAPM5/gAAEQEaO7gIYBXwRpM4FI9tS1sdX1O7y8kbEOJum1 LQlA== X-Gm-Message-State: APt69E2GZ8Q0iPFOz2odHRHCgbfdypSwY5KwOH9MmqAt/8uF8b1HNuTG KSq3b9p5Ll3vRA/h9YauKxg= X-Google-Smtp-Source: ADUXVKIaWMDgCTvzMdZ95NltThcgBryUSr3IW+4zVOx7G/azfFtd5iBsKQws61/r398WsoWaEM1BXA== X-Received: by 2002:a65:4e09:: with SMTP id r9-v6mr7806640pgt.369.1529244132746; Sun, 17 Jun 2018 07:02:12 -0700 (PDT) Original-Received: from [192.168.1.7] (pl31219.ag0304.nttpc.ne.jp. [111.89.224.243]) by smtp.gmail.com with ESMTPSA id j23-v6sm389206pfi.137.2018.06.17.07.02.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Jun 2018 07:02:10 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.3445.8.2) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::22b X-Mailman-Approved-At: Sun, 17 Jun 2018 10:13:40 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:226405 Archived-At: --Apple-Mail=_6E3B28B6-EE9F-4E08-9B9E-34BC5F7D2499 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Noam, 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. Here would be the log message: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D * lisp/emacs-lisp/package.el: reformat message strings for future l10n =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D --Apple-Mail=_6E3B28B6-EE9F-4E08-9B9E-34BC5F7D2499 Content-Disposition: attachment; filename=package.el_0617.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="package.el_0617.diff" Content-Transfer-Encoding: 7bit diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 94d98178c4..9e49b6964e 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -200,8 +200,10 @@ package-load-list :version "24.1") (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)))) + "An alist of archives from which to fetch. The default value points to the GNU Emacs package repository. @@ -1015,6 +1017,7 @@ package-buffer-info (let ((file-name (match-string-no-properties 1)) (desc (match-string-no-properties 2)) (start (line-beginning-position))) +;; The terminating comment could be a generic string that is not in English (unless (search-forward (concat ";;; " file-name ".el ends here")) (error "Package lacks a terminating comment")) ;; Try to include a trailing newline. @@ -1552,7 +1555,7 @@ package--download-one-archive (let* ((location (cdr archive)) (name (car archive)) (content (buffer-string)) - (dir (expand-file-name (format "archives/%s" name) package-user-dir)) + (dir (expand-file-name (concat "archives/" name) package-user-dir)) (local-file (expand-file-name file dir))) (when (listp (read-from-string content)) (make-directory dir t) @@ -2034,12 +2037,12 @@ package-install-selected-packages (cond (available (when (y-or-n-p - (format "%s packages will be installed:\n%s, proceed?" + (format "Packages to install: %d (%s), proceed? " (length available) - (mapconcat #'symbol-name available ", "))) + (mapconcat #'symbol-name available " "))) (mapc (lambda (p) (package-install p 'dont-select)) available))) ((> difference 0) - (message "%s packages are not available (the rest already installed), maybe you need to `M-x package-refresh-contents'" + (message "Packages that are not available: %d (the rest is already installed), maybe you need to `M-x package-refresh-contents'" difference)) (t (message "All your packages are already installed")))))) @@ -2158,9 +2161,9 @@ package-autoremove (let ((removable (package--removable-packages))) (if removable (when (y-or-n-p - (format "%s packages will be deleted:\n%s, proceed? " + (format "Packages to delete: %d (%s), proceed? " (length removable) - (mapconcat #'symbol-name removable ", "))) + (mapconcat #'symbol-name removable " "))) (mapc (lambda (p) (package-delete (cadr (assq p package-alist)) t)) removable)) @@ -2247,12 +2250,9 @@ describe-package-1 (setq status "available obsolete")) (when incompatible-reason (setq status "incompatible")) - (prin1 name) - (princ " is ") - (princ (if (memq (aref status 0) '(?a ?e ?i ?o ?u)) "an " "a ")) - (princ status) - (princ " package.\n\n") + (princ (format "Package %S is %s.\n\n" name status)) + ;; TODO: remove the string decorations and reformat the strings for future l10n (package--print-help-section "Status") (cond (built-in (insert (propertize (capitalize status) @@ -2634,9 +2634,9 @@ package-menu-toggle-hiding (user-error "The current buffer is not a Package Menu")) (setq package-menu--hide-packages (not package-menu--hide-packages)) - (message "%s packages" (if package-menu--hide-packages - "Hiding obsolete or unwanted" - "Displaying all")) + (if package-menu--hide-packages + (message "Hiding obsolete or unwanted packages") + (message "Displaying all packages")) (revert-buffer nil 'no-confirm)) (defun package--remove-hidden (pkg-list) @@ -2960,11 +2960,11 @@ package-menu-hide-package (let ((hidden (cl-remove-if-not (lambda (e) (string-match re (symbol-name (car e)))) package-archive-contents))) - (message (substitute-command-keys - (concat "Hiding %s packages, type `\\[package-menu-toggle-hiding]'" - " to toggle or `\\[customize-variable] RET package-hidden-regexps'" - " to customize it")) - (length hidden))))) + (message "Packages to hide: %d. Type `%s' to toggle or `%s' to customize" + (length hidden) + (substitute-command-keys "\\[package-menu-toggle-hidding]") + (substitute-command-keys "\\[customize-variable] RET package-hidden-regexps"))))) + (defun package-menu-describe-package (&optional button) "Describe the current package. @@ -3099,7 +3099,7 @@ package-menu--mark-upgrades-1 (setq package-menu--mark-upgrades-pending nil) (let ((upgrades (package-menu--find-upgrades))) (if (null upgrades) - (message "No packages to upgrade.") + (message "No packages to upgrade") (widen) (save-excursion (goto-char (point-min)) @@ -3112,9 +3112,9 @@ package-menu--mark-upgrades-1 (package-menu-mark-install)) (t (package-menu-mark-delete)))))) - (message "%d package%s marked for upgrading." - (length upgrades) - (if (= (length upgrades) 1) "" "s"))))) + (message "Packages marked for upgrading: %d" + (length upgrades))))) + (defun package-menu-mark-upgrades () "Mark all upgradable packages in the Package Menu. @@ -3137,17 +3137,12 @@ package-menu--list-to-prompt PACKAGES is a list of `package-desc' objects. Formats the returned string to be usable in a minibuffer prompt (see `package-menu--prompt-transaction-p')." - (cond - ;; None - ((not packages) "") - ;; More than 1 - ((cdr packages) - (format "these %d packages (%s)" - (length packages) - (mapconcat #'package-desc-full-name packages ", "))) - ;; Exactly 1 - (t (format-message "package `%s'" - (package-desc-full-name (car packages)))))) + ;; The case where `package' is empty is handled in + ;; package-menu--prompt-transaction-p below + (format "%d (%s)" + (length packages) + (mapconcat #'package-desc-full-name packages " "))) + (defun package-menu--prompt-transaction-p (delete install upgrade) "Prompt the user about DELETE, INSTALL, and UPGRADE. @@ -3155,16 +3150,14 @@ package-menu--prompt-transaction-p Either may be nil, but not all." (y-or-n-p (concat - (when delete "Delete ") - (package-menu--list-to-prompt delete) - (when (and delete install) - (if upgrade "; " "; and ")) - (when install "Install ") - (package-menu--list-to-prompt install) - (when (and upgrade (or install delete)) "; and ") - (when upgrade "Upgrade ") - (package-menu--list-to-prompt upgrade) - "? "))) + (when delete + (format "Packages to delete: %s. " (package-menu--list-to-prompt delete))) + (when install + (format "Packages to install: %s. " (package-menu--list-to-prompt install))) + (when upgrade + (format "Packages to upgrade: %s. " (package-menu--list-to-prompt upgrade))) + "Proceed? "))) + (defun package-menu--partition-transaction (install delete) "Return an alist describing an INSTALL DELETE transaction. @@ -3248,25 +3241,24 @@ package-menu-execute (when (or noquery (package-menu--prompt-transaction-p .delete .install .upgrade)) (let ((message-template - (concat "Package menu: Operation %s [" - (when .delete (format "Delet__ %s" (length .delete))) - (when (and .delete .install) "; ") - (when .install (format "Install__ %s" (length .install))) - (when (and .upgrade (or .install .delete)) "; ") - (when .upgrade (format "Upgrad__ %s" (length .upgrade))) + (concat "[ " + (when .delete + (format "Delete %d " (length .delete))) + (when .install + (format "Install %d " (length .install))) + (when .upgrade + (format "Upgrade %d " (length .upgrade))) "]"))) - (message (replace-regexp-in-string "__" "ing" message-template) "started") + (message "Operation %s started" message-template) ;; Packages being upgraded are not marked as selected. (package--update-selected-packages .install .delete) (package-menu--perform-transaction install-list delete-list) (when package-selected-packages (if-let* ((removable (package--removable-packages))) - (message "Package menu: Operation finished. %d packages %s" - (length removable) - (substitute-command-keys - "are no longer needed, type `\\[package-autoremove]' to remove them")) - (message (replace-regexp-in-string "__" "ed" message-template) - "finished")))))))) + (message "Operation finished. Packages that are no longer needed: %d. Type `%s' to remove them" + (length removable) + (substitute-command-keys "\\[package-autoremove]")) + (message "Operation %s finished" message-template)))))))) (defun package-menu--version-predicate (A B) (let ((vA (or (aref (cadr A) 1) '(0))) @@ -3333,11 +3325,11 @@ package-menu--populate-new-package-list (defun package-menu--find-and-notify-upgrades () "Notify the user of upgradable packages." (when-let* ((upgrades (package-menu--find-upgrades))) - (message "%d package%s can be upgraded; type `%s' to mark %s for upgrading." - (length upgrades) - (if (= (length upgrades) 1) "" "s") - (substitute-command-keys "\\[package-menu-mark-upgrades]") - (if (= (length upgrades) 1) "it" "them")))) + (message "Packages that can be upgraded: %d; type `%s' to mark for upgrading." + (length upgrades) + (substitute-command-keys "\\[package-menu-mark-upgrades]")) + )) + (defun package-menu--post-refresh () "If there's a *Packages* buffer, revert it and check for new packages and upgrades. --Apple-Mail=_6E3B28B6-EE9F-4E08-9B9E-34BC5F7D2499 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Jean-Christophe > On May 30, 2018, at 7:38, Noam Postavsky wrote: > > On 28 April 2018 at 19:46, Jean-Christophe Helary > wrote: > >> Thank you. I see what you mean and that makes perfect sense. Give me a few >> days. > > Ping? Did you intend to make any other changes? If it's just about > that one concat vs format thing I can just do it on my end before > pushing. Jean-Christophe Helary ----------------------------------------------- http://mac4translators.blogspot.com @brandelune --Apple-Mail=_6E3B28B6-EE9F-4E08-9B9E-34BC5F7D2499--