From: Jean-Christophe Helary <jean.christophe.helary@gmail.com>
To: Emacs developers <emacs-devel@gnu.org>
Subject: Re: package.el strings
Date: Thu, 26 Apr 2018 22:40:32 +0900 [thread overview]
Message-ID: <BF81CCF4-05D9-4A78-A3D3-34D1C0F62DB1@gmail.com> (raw)
In-Reply-To: <87lgdarcwi.fsf@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2963 bytes --]
> 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
> 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"
> ^
> 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
> ^
> 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) ""
>> + (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? ")))
>> +
>>
>
>> @@ -3262,25 +3252,23 @@ package-menu-execute
>
>> + (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))))))
>
> Perhaps this one too? (although in this case it would mean splitting up
> the brackets)
>
>> + (message "Operation finished. Packages that are no longer needed: %d. Type `%s' to remove them"
> ^ ^
> Double spacing Double spacing
>
> This line is getting pretty long, perhaps it should be broken up?
>
Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune
[-- Attachment #2.1: Type: text/html, Size: 1247 bytes --]
[-- Attachment #2.2: package.el_0426.diff --]
[-- Type: application/octet-stream, Size: 10898 bytes --]
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.
[-- Attachment #2.3: Type: text/html, Size: 7436 bytes --]
prev parent reply other threads:[~2018-04-26 13:40 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-24 5:08 package.el strings Jean-Christophe Helary
2017-05-24 11:00 ` Jean-Christophe Helary
2017-05-24 12:04 ` Dmitry Gutov
2017-05-24 12:07 ` Jean-Christophe Helary
2017-05-24 12:36 ` Yuri Khan
2017-05-24 14:16 ` Richard Stallman
2017-07-14 2:53 ` Jean-Christophe Helary
2017-07-15 12:52 ` Eli Zaretskii
2017-07-15 14:48 ` Jean-Christophe Helary
2017-07-16 13:55 ` Jean-Christophe Helary
2017-07-16 14:16 ` Eli Zaretskii
2017-07-16 14:35 ` Eli Zaretskii
2017-07-16 14:37 ` Jean-Christophe Helary
2017-07-17 15:28 ` Jean-Christophe Helary
2017-07-22 9:23 ` Eli Zaretskii
2018-04-18 6:38 ` Jean-Christophe Helary
2018-04-26 1:10 ` Noam Postavsky
2018-04-26 6:31 ` Jean-Christophe Helary
2018-04-26 11:28 ` Noam Postavsky
2018-04-26 13:32 ` Jean-Christophe Helary
2018-04-28 22:11 ` Noam Postavsky
2018-04-28 23:46 ` Jean-Christophe Helary
2018-05-29 22:38 ` Noam Postavsky
2018-05-29 22:46 ` Jean-Christophe Helary
2018-06-17 14:02 ` Jean-Christophe Helary
2018-06-17 14:33 ` Eli Zaretskii
2018-06-17 14:45 ` Jean-Christophe Helary
2018-06-17 14:50 ` Eli Zaretskii
2018-06-17 14:58 ` Jean-Christophe Helary
2018-06-20 13:53 ` Jean-Christophe Helary
2018-06-20 15:54 ` Eli Zaretskii
2018-06-20 16:19 ` Jean-Christophe Helary
2018-06-24 15:37 ` Noam Postavsky
2018-06-24 21:57 ` Jean-Christophe Helary
2018-06-24 23:09 ` Noam Postavsky
2018-06-25 1:39 ` Jean-Christophe Helary
2018-06-25 23:22 ` Noam Postavsky
2018-06-27 4:21 ` Jean-Christophe Helary
2018-06-27 18:32 ` Noam Postavsky
2018-04-29 19:43 ` Stefan Monnier
2018-04-26 13:40 ` Jean-Christophe Helary [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BF81CCF4-05D9-4A78-A3D3-34D1C0F62DB1@gmail.com \
--to=jean.christophe.helary@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.