Subject: Re: bug#35564: [PATCH v5] Tweak dired warning about "wildcard" characters

From: Kévin Le Gouguec <[email-masked]>
Date: Sun, 22 Dec 2019 17:02:07 +0100

Eli Zaretskii <[email-masked]> writes:

>> From: Kévin Le Gouguec <[email-masked]>
>> Cc: Juri Linkov <[email-masked]>,  [email-masked],
>>   [email-masked],  [email-masked],  [email-masked],
>>   [email-masked]
>> Date: Fri, 20 Dec 2019 21:34:07 +0100
>> 
>> - in the simplest case, the UI change is minor: it turns this message:
>> 
>>   > Confirm--do you mean to use ‘?’ as a wildcard? (y or n)
>> 
>>   into this one:
>> 
>>   > 1 occurrence of ‘?’ will not be substituted.  Proceed? (y, n, ?) ?
>> 
>>   (or, with read-multiple-choice:)
>> 
>>   > 1 occurrence of ‘?’ will not be substituted.  Proceed? (_y_es, _n_o, toggle _d_etails, _?_): 
>
> Is this the best wording you've been able to arrive at?  It sounds
> slightly confusing to me (but then I don't use this facility too
> much).  The confusing part is that it talks about "substitution", and
> the user might not be aware that there is any substitution going on.

Indeed, that's why the prompt now supports an additional action to pop a
help buffer explaining what the deal is[1].

Fundamentally, this prompt *is* about the substitution feature.  Dired
detects non-isolated occurrences of '*' and '?', and requests
confirmation before proceeding without substituting them.  With this in
mind, explicitly mentioning "substitution" doesn't sound too outlandish…

(
  Or, we could assume that the current message is correct (i.e. it's the
  wildcards we want to warn about) but the condition that triggers it is
  wrong, i.e. Dired should be smarter and only warn when the characters
  are unquoted and unescaped.  That sounds complex to implement though.

  As Drew noted[2], another way to handle this would be asking users
  whether they want to substitute the non-isolated characters.  That
  still implies talking about "substitution" though.  Also, users can
  already mark occurrences of '?' for substitution using backquotes, as
  explained in the new help buffer.
)

To wrap up, I'd say that the current message makes me go:

"Huh?  No, I don't want to use these characters as wildcards."
*hits "n", command is aborted*
*confusion: extreme & growing*

I'm hoping that the new message will have users go:

"Huh?  Why would Dired substitute these characters?"
*hits "?", skims, hits "y", moves on*
*confusion: mild & receding*

Thank you for your patience, and for reviewing this.

[1] 
> If your command contains occurrences of ‘*’ surrounded by
> whitespace, ‘dired-do-shell-command’ substitutes them for the
> entire file list to process.  Otherwise, if your command contains
> occurrences of ‘?’ surrounded by whitespace or ‘`’, Dired will
> run the command once for each file, substituting ‘?’ for each
> file name.
> 
> Your command contains occurrences of ‘?’ that will not be
> substituted, and will be passed through normally to the shell.
> 
> sed 's/?/!/'
> 
> (Press ^ to add markers below these occurrences.)

[2] bug#35564#83