Subject: bug#18875: 25.0.50; Dired -- add support for ls --time-style with a space

From: Lars Ingebrigtsen <[email-masked]>
Date: Thu, 19 Aug 2021 16:15:22 +0200

Keith David Bershatsky <[email-masked]> writes:

> Thank you, Eli, for taking a look at this report (#18875).
>
> `hour:minute:seconds` is omitted because there is a space between the
> date and the time.
>
> C-u C-x d
>
> -alh --group-directories-first --time-style=+%m-%d-%Y %H:%M:%S

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

These are things that has to be understandable to the shell, so you have
to quote things appropriately for the shell.

So I'd expect this to work:

C-u C-x d
-alh --group-directories-first --time-style="+%m-%d-%Y %H:%M:%S"

But it doesn't;

(insert-directory "/tmp/" "-alh --time-style=\"+%m-%d-%Y %H:%M:%S\"")

fails.

(split-string-and-unquote "-alh --time-style=\"+%m-%d-%Y %H:%M:%S\"")
=> ("-alh" "--time-style=" "+%m-%d-%Y %H:%M:%S")

However, this works:

(insert-directory "/tmp/" "-alh \"--time-style=+%m-%d-%Y %H:%M:%S\"")

So...  dired supports spaces in command line arguments, but you have to
quote the argument, so I'm closing this bug report.  However, there's a
bug in `split-string-and-unquote', so I'm opening a new report for that.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no