all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Nicer confirmation prompt for package.el
@ 2017-03-18 12:51 Lele Gaifax
  2017-03-18 14:11 ` Kaushal Modi
  0 siblings, 1 reply; 3+ messages in thread
From: Lele Gaifax @ 2017-03-18 12:51 UTC (permalink / raw)
  To: emacs-devel

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.
lele@metapensiero.it  |                 -- Fortunato Depero, 1929.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Nicer confirmation prompt for package.el
  2017-03-18 12:51 Nicer confirmation prompt for package.el Lele Gaifax
@ 2017-03-18 14:11 ` Kaushal Modi
  2017-03-23  8:15   ` Richard Copley
  0 siblings, 1 reply; 3+ messages in thread
From: Kaushal Modi @ 2017-03-18 14:11 UTC (permalink / raw)
  To: Lele Gaifax, Emacs developers

[-- Attachment #1: Type: text/plain, Size: 2221 bytes --]

On Sat, Mar 18, 2017, 8:52 AM Lele Gaifax <lele@metapensiero.it> wrote:

> 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

-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 3878 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Nicer confirmation prompt for package.el
  2017-03-18 14:11 ` Kaushal Modi
@ 2017-03-23  8:15   ` Richard Copley
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Copley @ 2017-03-23  8:15 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: Lele Gaifax, Emacs developers

On 18 March 2017 at 14:11, Kaushal Modi <kaushal.modi@gmail.com> wrote:
>
>
> On Sat, Mar 18, 2017, 8:52 AM Lele Gaifax <lele@metapensiero.it> wrote:
>>
>> 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.

That might have been the idea but it's incorrect and looks bad.
A semicolons doesn't end a sentence.

It's not necessary to tell the user what to focus on. The user isn't an idiot :)

[...]

> 1. Current (no change) - Focus on the actions that are going to happen by
> capitalizing them.

> 2.  Use of Oxford commas

Perfectly easy to parse the list with or without the serial comma. In my opinion
the comma seems jarring in this case.

I like Lele's suggestion.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-23  8:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-18 12:51 Nicer confirmation prompt for package.el Lele Gaifax
2017-03-18 14:11 ` Kaushal Modi
2017-03-23  8:15   ` Richard Copley

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.