[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Nicer confirmation prompt for package.el
From: |
Kaushal Modi |
Subject: |
Re: Nicer confirmation prompt for package.el |
Date: |
Sat, 18 Mar 2017 14:11:29 +0000 |
Hi all,
when a transaction involves different operations, current
`package-menu--prompt-transaction-p' shows prompts like
Delete package ‘x’; and Upgrade these 2 packages (y, z)?
or
Delete package ‘x’; Install package ‘y’; and Upgrade these 2 packages (w, z)?
that IMHO are a bit inelegant.
I actually like the current message, as the actions Delete, Install and Upgrade are capitalized. The user's attention is drawn to the fact that those 3 different actions are going to happen. The semi-colons are used so that those actions can be capitalized, I think.
I hacked it to the following definition
(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)
(if (and delete install)
(if upgrade ", install " " and install ")
(when install "Install "))
(package-menu--list-to-prompt install)
(if (and upgrade (or install delete))
" and upgrade "
(when upgrade "Upgrade "))
(package-menu--list-to-prompt upgrade)
"? ")))
that shows instead
Delete package ‘x’ and upgrade these 2 packages (y, z)?
or
Delete package ‘x’, install package ‘y’ and upgrade these 2 packages (w, z)?
What do you think?
This is another option where the actions are not capitalized, and so you can replace the semi-colons with commas. But I really miss the Oxford Commas here; below I have added those before the "and":
Delete package ‘x’, and upgrade these 2 packages (y, z)?
Delete package ‘x’, install package ‘y’, and upgrade these 2 packages (w, z)?
So my order of preference:
1. Current (no change) - Focus on the actions that are going to happen by capitalizing them.
2. Use of Oxford commas
--