diff options
| author | Artur Malabarba | 2015-04-06 17:05:53 +0100 |
|---|---|---|
| committer | Artur Malabarba | 2015-04-06 17:09:43 +0100 |
| commit | c91fd97dfb54863365e7153d0ccde144c79bb54f (patch) | |
| tree | 1f6d669c6bb20e3c67f70fac19d6a4915123fad5 /lisp | |
| parent | 67c152efc3d30679bc10641f78159af1aa077999 (diff) | |
| download | emacs-c91fd97dfb54863365e7153d0ccde144c79bb54f.tar.gz emacs-c91fd97dfb54863365e7153d0ccde144c79bb54f.zip | |
* emacs-lisp/package.el: Make the execute prompt less verbose.
(package-menu--list-to-prompt): New function.
(package-menu--prompt-transaction-p): Use "Upgrade" to make the
package-menu-execute prompt less verbose.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 3 | ||||
| -rw-r--r-- | lisp/emacs-lisp/package.el | 60 |
2 files changed, 39 insertions, 24 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d747f5240d5..d2f01c34c22 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -3,6 +3,9 @@ | |||
| 3 | * emacs-lisp/package.el: Fix lack of "new" packages. | 3 | * emacs-lisp/package.el: Fix lack of "new" packages. |
| 4 | (package-menu--new-package-list) | 4 | (package-menu--new-package-list) |
| 5 | (package-menu--old-archive-contents): No longer local. | 5 | (package-menu--old-archive-contents): No longer local. |
| 6 | (package-menu--list-to-prompt): New function. | ||
| 7 | (package-menu--prompt-transaction-p): Use "Upgrade" to make the | ||
| 8 | package-menu-execute prompt less verbose. | ||
| 6 | 9 | ||
| 7 | 2015-04-06 Paul Eggert <eggert@cs.ucla.edu> | 10 | 2015-04-06 Paul Eggert <eggert@cs.ucla.edu> |
| 8 | 11 | ||
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 4f71c196de3..3188da5f439 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el | |||
| @@ -2699,30 +2699,42 @@ call will upgrade the package." | |||
| 2699 | (length upgrades) | 2699 | (length upgrades) |
| 2700 | (if (= (length upgrades) 1) "" "s"))))) | 2700 | (if (= (length upgrades) 1) "" "s"))))) |
| 2701 | 2701 | ||
| 2702 | (defun package-menu--prompt-transaction-p (ins del) | 2702 | (defun package-menu--list-to-prompt (packages) |
| 2703 | "Prompt the user about installing INS and deleting DEL. | 2703 | "Return a string listing PACKAGES that's usable in a prompt. |
| 2704 | INS and DEL are lists of `package-desc'. Either may be nil, but | 2704 | PACKAGES is a list of `package-desc' objects. |
| 2705 | not both." | 2705 | Formats the returned string to be usable in a minibuffer |
| 2706 | (y-or-n-p | 2706 | prompt (see `package-menu--prompt-transaction-p')." |
| 2707 | (concat | 2707 | (cond |
| 2708 | (when ins | 2708 | ;; None |
| 2709 | (let ((lins (length ins))) | 2709 | ((not packages) "") |
| 2710 | (if (= lins 1) | 2710 | ;; More than 1 |
| 2711 | (format "INSTALL package `%s'" | 2711 | ((cdr packages) |
| 2712 | (package-desc-full-name (car ins))) | 2712 | (format "these %d packages (%s)" |
| 2713 | (format "INSTALL these %d packages (%s)" | 2713 | (length packages) |
| 2714 | lins | 2714 | (mapconcat #'package-desc-full-name packages ", "))) |
| 2715 | (mapconcat #'package-desc-full-name ins ", "))))) | 2715 | ;; Exactly 1 |
| 2716 | (when (and del ins) " and ") | 2716 | (t (format "package `%s'" |
| 2717 | (when del | 2717 | (package-desc-full-name (car packages)))))) |
| 2718 | (let ((ldel (length del))) | 2718 | |
| 2719 | (if (= ldel 1) | 2719 | (defun package-menu--prompt-transaction-p (install delete) |
| 2720 | (format "DELETE package `%s'" | 2720 | "Prompt the user about installing INSTALL and deleting DELETE. |
| 2721 | (package-desc-full-name (car del))) | 2721 | INSTALL and DELETE are lists of `package-desc'. Either may be |
| 2722 | (format "DELETE these %d packages (%s)" | 2722 | nil, but not both." |
| 2723 | ldel | 2723 | (let* ((upg (cl-intersection install delete :key #'package-desc-name)) |
| 2724 | (mapconcat #'package-desc-full-name del ", "))))) | 2724 | (ins (cl-set-difference install upg :key #'package-desc-name)) |
| 2725 | "? "))) | 2725 | (del (cl-set-difference delete upg :key #'package-desc-name))) |
| 2726 | (y-or-n-p | ||
| 2727 | (concat | ||
| 2728 | (when upg "UPGRADE ") | ||
| 2729 | (package-menu--list-to-prompt upg) | ||
| 2730 | (when (and upg ins) | ||
| 2731 | (if del "; " "; and ")) | ||
| 2732 | (when ins "INSTALL ") | ||
| 2733 | (package-menu--list-to-prompt ins) | ||
| 2734 | (when (and del (or ins upg)) "; and ") | ||
| 2735 | (when del "DELETE ") | ||
| 2736 | (package-menu--list-to-prompt del) | ||
| 2737 | "? ")))) | ||
| 2726 | 2738 | ||
| 2727 | (defun package-menu--perform-transaction (install-list delete-list &optional async) | 2739 | (defun package-menu--perform-transaction (install-list delete-list &optional async) |
| 2728 | "Install packages in INSTALL-LIST and delete DELETE-LIST. | 2740 | "Install packages in INSTALL-LIST and delete DELETE-LIST. |