Subject: bug#63744: 28.2; fix dired-guess-default

From: Leo Liu <[email-masked]>
Date: Sun, 28 May 2023 10:40:16 +0800

On 2023-05-27 09:49 +0300, Eli Zaretskii wrote:
[snipped 10 lines]
> What is the semantics of a list of strings in this case?
> shell-command takes a single string as its argument COMMAND, it
> doesn't take a list of strings.

See the documentation of dired-guess-default.

,----
| Return a shell command, or a list of commands, appropriate for FILES.
`----

[snipped 10 lines]
> I'd rather not proliferate an undocumented "feature" that is merely a
> side effect of the particular implementation we had at some point,
> without understanding what it gives us. 

I agree in principle.

> The alternative is for you to change your customization so that EXP
> returns the car of the list it returned before, and that should be
> both easy and backward-compatible, AFAIU.

Unfortunately many (or most) things in Emacs grow from a 50% solution.
There is no alternative at the moment other than redefining
dired-guess-default.

If you have a static list it can be expressed as an element in
dired-guess-shell-alist-user as such:

   (RE "STR1" "STR2" ...)

If you have a dynamic list (for example a list from querying the OS) you
are stuck. The patch makes this possible and in my view makes
dired-guess-shell-alist-user more coherent. (RE "STR1" "STR2" ...) can
be regarded as another syntax for

   (RE ("STR1" "STR2" ...))

WDYT?