[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Nicer confirmation prompt for package.el
From: |
Lele Gaifax |
Subject: |
Nicer confirmation prompt for package.el |
Date: |
Sat, 18 Mar 2017 13:51:39 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) |
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 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?
ciao, lele.
--
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
address@hidden | -- Fortunato Depero, 1929.
- Nicer confirmation prompt for package.el,
Lele Gaifax <=