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

From: Kévin Le Gouguec <[email-masked]>
Date: Fri, 28 Jun 2019 19:58:13 +0200

Drew Adams <[email-masked]> writes:

> But the new question (and actually it's not even a
> question - it should be, no?) seems even less clear
> to me:

A question would probably make the interaction more fluid, I agree.
As fun as messing with text properties has been, I would still very much
favour a simpler solution in the form of a better question (where
"better" mostly means "does not talk about wildcards").

As I mentioned, the only reason I came up with these highlighting
shenanigans is because I could not come up with a better phrasing.

Point taken about the new phrasing possibly being less clear; I was
aiming for some sort of "is the following statement correct? yes/no"
interaction.

> (And too long - "highlighted chars won't be substituted"
> says the same thing as "the highlighted...".)

(Silly question: is it kosher to use contractions such as "won't" in
user-facing text?  Or were you pointing out the superfluous "the" and/or
suggesting "chars" rather than "characters"?)

>  "Should highlighted chars be substituted? "
>
> or
>
>  "Substitute highlighted occurrences of `*'? "

Mmm; currently this prompt is raised when the code detects that the
characters will *not* be substituted; answering "yes" makes Dired go on
with the command, answering "no" aborts.

If we phrased the question like you suggest, we should probably change
the code to actually perform the substitutions should the user answer
"yes".

> 1. It's not clear to me what someone will understand
>    by "substituted" here.  What would (otherwise) be
>    substituted for what, where, and for what purpose?
>    What substitution are we talking about, and how
>    would a user be expected to know what we mean, here?

Right.  Not sure how to make things clearer without quoting
dired-do-shell-command's documentation, which would make the prompt
quite verbose.

> 2. Are there multiple different "characterS" involved,
>    or is the confirmation about only _one_ character,
>    in (possibly) multiple locations - occurrences of
>    one char?

One character in (possibly) multiple locations.

> 3. Is it the case that the new prompt does not, itself,
>    show the character?  Do you have to look elsewhere
>    to see which char or chars(?) are meant by the
>    prompt?  Shouldn't the prompt itself show the char?

It does; the prompt shows the full command, and applies the warning face
to the character(s).

> A final comment, which I'm not sure is relevant:
>
> We should not, in any case, _rely_ on any
> highlighting to get across meaning (semantics).
> Highlighting should always be an extra - a
> nice-to-have.  Some users will not see the
> highlighting - it cannot be the only thing that
> gets the intended meaning across.
>
> (Again, I'm not saying that we _are_ relying on
> highlighting this way.  I just want to be sure
> we're not.  We don't want to unnecessarily
> introduce an accessibility problem.)

With the current patches, we absolutely totally completely _would_ rely
on highlighting to get across semantics.  Thank you for spelling it out
as an accessibility problem; that kind of confirms my nagging feeling
that the highlighting method has an unfavorable benefit/cost ratio (IOW,
it's cute, but it might make things worse for some users).

So to conclude, these are the paths forward that I see:

(0. Drop the issue and grit my teeth when the warning shows up.)

1. find a simple rephrasing,

2. keep trying to make a more elaborate prompt, only using some other
   tricks to point out the characters.

Example of path 1:

> Confirm--do you mean to send `*' verbatim to the shell?

(I don't like this one because it sounds like "do you want us to quote
`*' to make sure the shell does not expand it?")

Example of path 2:

> Confirm--do you mean to send these characters as-is to the shell?
> sed -e 's/foo?/foo!/' -e 's/bar?/bar!'
>              ^                 ^

(I.e. using '^' to denote the non-isolated characters; not sure how
clear it is that "these" refers to "the caracters underlined by a '^'")