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: Thu, 26 Apr 2018 22:40:32 +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> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_755B81DB-08C3-49CF-812C-1A31538A1CFC" X-Trace: blaine.gmane.org 1524749931 29071 195.159.176.226 (26 Apr 2018 13:38:51 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 26 Apr 2018 13:38:51 +0000 (UTC) To: Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Apr 26 15:38:46 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 1fBh6d-0007Gz-9B for ged-emacs-devel@m.gmane.org; Thu, 26 Apr 2018 15:38:39 +0200 Original-Received: from localhost ([::1]:42381 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fBh8i-0004Sm-JA for ged-emacs-devel@m.gmane.org; Thu, 26 Apr 2018 09:40:48 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50223) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fBh8a-0004SZ-C0 for emacs-devel@gnu.org; Thu, 26 Apr 2018 09:40:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fBh8X-00029r-8I for emacs-devel@gnu.org; Thu, 26 Apr 2018 09:40:40 -0400 Original-Received: from mail-pf0-x22d.google.com ([2607:f8b0:400e:c00::22d]:35772) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fBh8W-000297-QE for emacs-devel@gnu.org; Thu, 26 Apr 2018 09:40:37 -0400 Original-Received: by mail-pf0-x22d.google.com with SMTP id j5so18405757pfh.2 for ; Thu, 26 Apr 2018 06:40:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:mime-version:subject:date:references:to:in-reply-to:message-id; bh=5UX82GO8uW+OKPFX808FoV+K2DxAfLQo8nqa/h5vIxk=; b=RDaaEZ0qbX2Dot9dqYpUR3baQhijwKkzLQFBnmnDRG+OxsNZMzlvvAL58MyZhVkNxJ 4gGHsb/48qEuOP4NB8ff538ODlFh6qsNq7+5Inbdt5SzmYEB5WpB9M+eYIEW8R2xrUMw 8E5HXwykUq8E5YvHMOTyxM6tn+8b3FMTf1eR3a34/2q7LvJAvxX66OjbLCRwJhLoygUL Ih7n/FSHSfDi1vClCFkdNI3QD8NrBF9cQL7sd4fd2hcD7nNIJjB+qmgehUV4cJ8atrI5 ITxCBuShOXmKIgF/da1QSTNFPWQITupliOW1fh3PG/AsdeKq/QC9luWMTYMrpYZR6cJQ i/6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:mime-version:subject:date:references:to :in-reply-to:message-id; bh=5UX82GO8uW+OKPFX808FoV+K2DxAfLQo8nqa/h5vIxk=; b=WNPyp9BXLHugND8qwWm8ue02RmD37cYJ6Qzc5cwyIgOZEcoaLeCYk64kKwzzHCGfrJ 1RIGN1qaaI9LyN/u/aCyAaNBxDupaDHypd1+fts2p4d+11MONsgPZEcvlE8uuDr7f0Z3 mQoszUkEkGiMPw/SGa5ZauPK4OqpWh+F71Hh6IeSvGIw4XiMQ6Vt0S7hhixaIG0dGLb2 sSXIkFJff4heC1kteoYdDAaGJa4OfIVKZQjvm2tP9iE1CbKoS+hhtdziYgFZnubP2abR n156adIveRDfuGJLT3GAFZba/kgQovn9XbvsGatkySUwOcWNA5yYR3GN7vcgt6uwBkEL 4f9Q== X-Gm-Message-State: ALQs6tAEVxZQI4yHxjzeSXdqk0NovbHV72j45/B/gZHdzQpBLflwkJU4 oScWijtk0hHmV9elPqgAANw5Yg== X-Google-Smtp-Source: AIpwx49ktV5wKvDCiRlBbiBs7uF455RsNktBRsEgK+0ayJIj/nI9KYuJG1Dyqzp40DguRCTOBMn72Q== X-Received: by 2002:a17:902:8488:: with SMTP id c8-v6mr34133228plo.357.1524750035649; Thu, 26 Apr 2018 06:40:35 -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 67sm45752200pfp.122.2018.04.26.06.40.33 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Apr 2018 06:40:34 -0700 (PDT) In-Reply-To: <87lgdarcwi.fsf@gmail.com> X-Mailer: Apple Mail (2.3445.6.18) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::22d 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:224906 Archived-At: --Apple-Mail=_755B81DB-08C3-49CF-812C-1A31538A1CFC Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Apr 26, 2018, at 10:10, Noam Postavsky wrote: >=20 >=20 >> Almost 9 months and nothing in master. Was there anything wrong with >> the code? >=20 > I think the problem is more a lack of people who "make changes in > package.el". Although there's enough that your patch no longer = applies > cleanly. >=20 > error: patch failed: lisp/emacs-lisp/package.el:3262 > error: lisp/emacs-lisp/package.el: patch does not apply Here is the updated patch with fixes for the comments you made. Jean-Christophe=20 > Some minor comments below. >=20 >> +;; 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")) >=20 > Should that be a FIXME or TODO? >=20 >> + (message "Packages to hide: %s. Type `%s' to toggle or `%s' to = customize" > ^ > Missing double space >=20 >> (defun package-menu--list-to-prompt (packages) >> +;; The case where `package' is empty is handled in >> +;; package-menu--prompt-transation-p below > ^ > transaction =20 >=20 >> (defun package-menu--prompt-transaction-p (delete install upgrade) >=20 >> + (format "%s%s%s%s" >=20 > This kind of format call is that same as concat, right? >=20 >> + (if (not delete) "" >> + (format "Packages to delete: %s. " = (package-menu--list-to-prompt delete))) >> + (if (not install) "" >> + (format "Packages to install: %s. " = (package-menu--list-to-prompt install))) >> + (if (not upgrade) "" >> + (format "Packages to upgrade: %s. " = (package-menu--list-to-prompt upgrade))) >> + "Proceed? "))) >> + >>=20 >=20 >> @@ -3262,25 +3252,23 @@ package-menu-execute >=20 >> + (format "[ %s%s%s]" >> + (if (not .delete) "" >> + (format "Delete %d " (length .delete))) >> + (if (not .install) "" >> + (format "Install %d " (length .install))) >> + (if (not .upgrade) "" >> + (format "Upgrade %d " (length = .upgrade)))))) >=20 > Perhaps this one too? (although in this case it would mean splitting = up > the brackets) >=20 >> + (message "Operation finished. Packages that are no = longer needed: %d. Type `%s' to remove them" > ^ = ^ > Double spacing = Double spacing >=20 > This line is getting pretty long, perhaps it should be broken up? >=20 Jean-Christophe Helary ----------------------------------------------- http://mac4translators.blogspot.com @brandelune --Apple-Mail=_755B81DB-08C3-49CF-812C-1A31538A1CFC Content-Type: multipart/mixed; boundary="Apple-Mail=_AC534EEE-335E-4A31-BBAE-8F0397FBAA6C" --Apple-Mail=_AC534EEE-335E-4A31-BBAE-8F0397FBAA6C Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii

On Apr 26, 2018, at 10:10, Noam Postavsky <npostavs@gmail.com> = wrote:


Almost 9 = months and nothing in master. Was there anything wrong with
the code?

I think = the problem is more a lack of people who "make changes in
package.el".  Although there's enough that your patch no = longer applies
cleanly.

=    error: patch failed: = lisp/emacs-lisp/package.el:3262
   error: = lisp/emacs-lisp/package.el: patch does not apply

Here = is the updated patch with fixes for the comments you made.

Jean-Christophe 

= --Apple-Mail=_AC534EEE-335E-4A31-BBAE-8F0397FBAA6C Content-Disposition: attachment; filename=package.el_0426.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="package.el_0426.diff" Content-Transfer-Encoding: 7bit diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 94d98178c4..3546fa0fb1 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,8 @@ 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)) + (package--print-help-section "Status") (cond (built-in (insert (propertize (capitalize status) @@ -2634,9 +2633,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 +2959,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 +3098,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 +3111,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,34 +3136,27 @@ 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. DELETE, INSTALL, and UPGRADE are lists of `package-desc' objects. 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) - "? "))) + (format "%s%s%s%s" + (if (not delete) "" + (format "Packages to delete: %s. " (package-menu--list-to-prompt delete))) + (if (not install) "" + (format "Packages to install: %s. " (package-menu--list-to-prompt install))) + (if (not 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 +3240,23 @@ 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))) - "]"))) - (message (replace-regexp-in-string "__" "ing" message-template) "started") + (format "[ %s%s%s]" + (if (not .delete) "" + (format "Delete %d " (length .delete))) + (if (not .install) "" + (format "Install %d " (length .install))) + (if (not .upgrade) "" + (format "Upgrade %d " (length .upgrade)))))) + (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 +3323,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=_AC534EEE-335E-4A31-BBAE-8F0397FBAA6C Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii

Some minor comments below.

+;; 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"))

Should that be a = FIXME or TODO?

+      (message "Packages to hide: = %s. Type `%s' to toggle or `%s' to customize"
=             &n= bsp;           &nbs= p;            =   ^
=             &n= bsp;           &nbs= p;            =   Missing double space

(defun package-menu--list-to-prompt = (packages)
+;; The case where `package' is empty is = handled in
+;; package-menu--prompt-transation-p below
=             &n= bsp;           &nbs= p;       ^
=             &n= bsp;           &nbs= p; transaction      

(defun = package-menu--prompt-transaction-p (delete install upgrade)

+   (format "%s%s%s%s"
This kind of format call is that same as concat, right?

+ =           (if (not = delete) ""
+ =             (f= ormat "Packages to delete: %s. " (package-menu--list-to-prompt = delete)))
+ =           (if (not = install) ""
+ =             (f= ormat "Packages to install: %s. " (package-menu--list-to-prompt = install)))
+ =           (if (not = upgrade) ""
+ =             (f= ormat "Packages to upgrade: %s. " (package-menu--list-to-prompt = upgrade)))
+ =           "Proceed? = ")))
+


@@ -3262,25 +3252,23 @@ = package-menu-execute

+ =             &n= bsp; (format "[ %s%s%s]"
+ =             &n= bsp;         (if (not = .delete) ""
+ =             &n= bsp;           (for= mat "Delete %d " (length .delete)))
+ =             &n= bsp;         (if (not = .install) ""
+ =             &n= bsp;           (for= mat "Install %d " (length .install)))
+ =             &n= bsp;         (if (not = .upgrade) ""
+ =             &n= bsp;           (for= mat "Upgrade %d " (length .upgrade))))))

Perhaps this one too? (although in this case it would mean = splitting up
the brackets)

+ =             &n= bsp;  (message "Operation finished. Packages that are no = longer needed: %d. Type `%s' to remove them"
=             &n= bsp;           &nbs= p;            =           ^ =             &n= bsp;           &nbs= p;            =  ^
=             &n= bsp;           &nbs= p;            =           Double = spacing =             &n= bsp;           &nbs= p;Double spacing

This line is getting = pretty long, perhaps it should be broken up?


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


= --Apple-Mail=_AC534EEE-335E-4A31-BBAE-8F0397FBAA6C-- --Apple-Mail=_755B81DB-08C3-49CF-812C-1A31538A1CFC--