unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#18875: 25.0.50; Dired -- add support for ls --time-style with a space
@ 2014-10-28 16:44 Keith David Bershatsky
  2014-10-28 17:04 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Keith David Bershatsky @ 2014-10-28 16:44 UTC (permalink / raw)
  To: 18875

The ls version that I use is coreutils-8.21 for OSX.  I would like to be able to use a custom time-style format in dired-mode, such that there is a space between the date and the time:

--time-style=+%m-%d-%Y %H:%M:%S

Without modifying the source code, I have not found a viable method to set the `dired-listing-switches`.

In my quest to track down the root cause, I discovered that `indirect-directory` within `files.el` supports both a list and a string format for the `switches`.  However, `dired-indirect-directory` and other functions in dired-mode only support a string.  Therefore, I have two suggestions.

1.  Tweak the applicable functions to permit a space within the time-style when `switches` is a string format.

2.  Modify the applicable functions in dired-mode to permit support for a list form of `switches`, instead of only a string.  `indirect-files` already contains methods for dealing with detecting whether a string or a list is used, and different actions are taken based thereon.  So, copying some of the functionality from `indirect-files` may be the easiest method to add list support for `switches` in dired-mode.

Here is the related thread that I opened on the beta version of Emacs stackexchange:

http://emacs.stackexchange.com/q/2722/2287

Thanks,

Keith

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

In GNU Emacs 25.0.50.1 (x86_64-apple-darwin10.8.0, NS appkit-1038.36 Version 10.6.8 (Build 10K549))
 of 2014-10-01 on MP.local
Repository revision: 117996 dmantipov@yandex.ru-20141001132108-zdsxru2390mqyjlu
Windowing system distributor `Apple', version 10.3.1038
Configured using:
 `configure --with-ns'

Configured features:
ACL LIBXML2 ZLIB

Important settings:
  locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
  sd-mode: t
  sb-mode: t
  tb-mode: t
  shell-dirtrack-mode: t
  cm-mode: t
  bc-mode: t
  ds-mode: t
  ml-mode: t

Recent input:
<escape> x e m a c s - b u g - r e p o r t <return> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> r e p o r t - e m a c s - b u g <retur
n>

Recent messages:
Loading /Users/HOME/.0.data/.0.emacs/init.el (source)...
Loading /Users/HOME/.0.data/.0.emacs/lawlist-test.el (source)...done
Loading /Users/HOME/.0.data/.0.emacs/init.el (source)...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Wrote /Users/HOME/.0.data/.0.emacs/.lock
*beep*

Load-path shadows:
/Users/HOME/.0.data/.0.emacs/.0.apel_flim_simi/md4 hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/md4
/Users/HOME/.0.data/.0.emacs/.0.apel_flim_simi/hex-util hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/hex-util
/Users/HOME/.0.data/.0.emacs/.0.apel_flim_simi/sasl hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/net/sasl
/Users/HOME/.0.data/.0.emacs/.0.apel_flim_simi/sasl-ntlm hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/net/sasl-ntlm
/Users/HOME/.0.data/.0.emacs/.0.apel_flim_simi/sasl-digest hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/net/sasl-digest
/Users/HOME/.0.data/.0.emacs/.0.apel_flim_simi/sasl-cram hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/net/sasl-cram
/Users/HOME/.0.data/.0.emacs/.0.apel_flim_simi/ntlm hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/net/ntlm
/Users/HOME/.0.data/.0.emacs/.0.apel_flim_simi/hmac-md5 hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/net/hmac-md5
/Users/HOME/.0.data/.0.emacs/.0.apel_flim_simi/hmac-def hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/net/hmac-def
/Users/HOME/.0.data/.0.emacs/.0.wl/rfc2368 hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/mail/rfc2368
/Users/HOME/.0.data/.0.emacs/.0.wl/utf7 hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/gnus/utf7
/Users/HOME/.0.data/.0.emacs/.0.apel_flim_simi/smime hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/gnus/smime
/Users/HOME/.0.data/.0.emacs/.0.apel_flim_simi/pgg hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/obsolete/pgg
/Users/HOME/.0.data/.0.emacs/.0.apel_flim_simi/pgg-pgp5 hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/obsolete/pgg-pgp5
/Users/HOME/.0.data/.0.emacs/.0.apel_flim_simi/pgg-pgp hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/obsolete/pgg-pgp
/Users/HOME/.0.data/.0.emacs/.0.apel_flim_simi/pgg-parse hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/obsolete/pgg-parse
/Users/HOME/.0.data/.0.emacs/.0.apel_flim_simi/pgg-gpg hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/obsolete/pgg-gpg
/Users/HOME/.0.data/.0.emacs/.0.apel_flim_simi/pgg-def hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/obsolete/pgg-def

Features:
(shadow mime-setup mail-mime-setup semi-setup mime-image modb-standard
elmo-imap4 emacsbug lawlist-desktop frameset lawlist-colors reporter
lawlist-dv lawlist-mc rect lawlist-ztree lawlist-wl elmo-nntp wl-demo
wl-news wl-address wl-thread wl wl-e21 wl-draft elmo-pop3 wl-template
elmo-net elmo-cache elmo-map elmo-dop wl-folder wl-spam wl-action
wl-summary wl-refile wl-message wl-mime pgg mime-pgp wl-util pp
elmo-flag elmo-localdir mime-play filename mime-edit eword-encode
pgg-parse pccl pccl-20 pgg-def signature sendmail elmo-mime
mmelmo-buffer mmelmo-imap mime-view mime-conf calist semi-def mmimap
mime-parse mmbuffer mmgeneric elmo-filter elmo-multi elmo-spam
elsp-header elsp-generic elmo elmo-signal wl-highlight wl-vars
wl-version elmo-msgdb modb modb-generic modb-entity luna mime
elmo-util emu invisible inv-23 poem poem-e20 poem-e20_3 eword-decode
std11 elmo-date elmo-vars elmo-version w3m-load mime-w3m w3m
browse-url doc-view jka-compr image-mode w3m-hist w3m-fb bookmark-w3m
w3m-ems w3m-ccl ccl w3m-favicon w3m-image w3m-proc w3m-util
lawlist-dired dired-aux lawlist-vr-hr lawlist-ws disp-table
lawlist-calc lawlist-flyspell lawlist-yas lawlist-tex-mode skeleton
compare-w lawlist-txt-mode lawlist-tabbar lawlist-github ido view
vc-git vc vc-dispatcher tramp tramp-compat tramp-loaddefs trampver
shell thingatpt time-stamp rx log-view log-edit pcvs-util add-log
help-mode grep compile find-lisp epa epg epg-config ediff-merg
ediff-wind ediff-diff ediff-mult ediff-help ediff-init ediff-util
ediff ert ewoc debug eieio-base diff-mode conf-mode autorevert
filenotify lorg-calendar org-element lorg-search org-agenda
context-menu dired-read-filename lawlist-toodledo url-http url-auth
url-gw url url-proxy url-privacy url-expand url-methods url-history
url-cookie url-domsuf url-util url-parse auth-source eieio eieio-core
password-cache url-vars mailcap json xml lawlist-org lawlist-calendar
derived org byte-opt bytecomp byte-compile cconv org-macro
org-footnote org-pcomplete pcomplete org-list org-faces org-entities
org-version ob-emacs-lisp ob ob-tangle org-src ob-ref ob-lob ob-table
ob-keys ob-exp ob-comint comint ansi-color ring ob-core ob-eval
org-compat org-macs org-loaddefs cal-menu calendar cal-loaddefs
noutline outline gnus-sum gnus-group gnus-undo gnus-start gnus-cloud
nnimap nnmail mail-source tls utf7 mel path-util mime-def alist
mcharset mcs-20 mcs-e20 pcustom pces pces-e20 pces-20 broken poe pym
static apel-ver product netrc nnoo parse-time gnus-spec gnus-int
gnus-range message dired format-spec mml mml-sec mm-decode mm-bodies
mm-encode gmm-utils mailheader gnus-win lawlist-frame lawlist-cm
lawlist-bbdb gnus gnus-ems nnheader gnus-util mail-utils wid-edit
mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mailabbrev mail-extr rfc822 cl timezone lawlist-init pcase cl-macs gv
advice help-fns easy-mmode edmacro kmacro cl-loaddefs cl-lib savehist
server ps-print ps-def lpr find-func saveplace easymenu time-date
tooltip electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
ns-win tool-bar dnd fontset image regexp-opt fringe tabulated-list
newcomment elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer nadvice loaddefs button
faces cus-face macroexp files text-properties overlay sha1 md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process cocoa ns multi-tty emacs)

Memory information:
((conses 16 1090108 58372)
 (symbols 48 62238 0)
 (miscs 40 103 175)
 (strings 32 146233 23368)
 (string-bytes 1 4634883)
 (vectors 16 42102)
 (vector-slots 8 754914 17245)
 (floats 8 1104 24)
 (intervals 56 4308 0)
 (buffers 976 11))





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

* bug#18875: 25.0.50; Dired -- add support for ls --time-style with a space
  2014-10-28 16:44 bug#18875: 25.0.50; Dired -- add support for ls --time-style with a space Keith David Bershatsky
@ 2014-10-28 17:04 ` Eli Zaretskii
  2014-10-28 17:10 ` Keith David Bershatsky
  2014-10-28 17:33 ` Keith David Bershatsky
  2 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2014-10-28 17:04 UTC (permalink / raw)
  To: Keith David Bershatsky; +Cc: 18875

> Date: Tue, 28 Oct 2014 09:44:07 -0700
> From: Keith David Bershatsky <esq@lawlist.com>
> 
> The ls version that I use is coreutils-8.21 for OSX.  I would like to be able to use a custom time-style format in dired-mode, such that there is a space between the date and the time:
> 
> --time-style=+%m-%d-%Y %H:%M:%S
> 
> Without modifying the source code, I have not found a viable method to set the `dired-listing-switches`.

Doesn't "C-u C-x d" do what you want?





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

* bug#18875: 25.0.50; Dired -- add support for ls --time-style with a space
  2014-10-28 16:44 bug#18875: 25.0.50; Dired -- add support for ls --time-style with a space Keith David Bershatsky
  2014-10-28 17:04 ` Eli Zaretskii
@ 2014-10-28 17:10 ` Keith David Bershatsky
  2021-08-19 14:15   ` Lars Ingebrigtsen
  2014-10-28 17:33 ` Keith David Bershatsky
  2 siblings, 1 reply; 9+ messages in thread
From: Keith David Bershatsky @ 2014-10-28 17:10 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 18875

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

Keith

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

At Tue, 28 Oct 2014 19:04:15 +0200,
Eli Zaretskii wrote:
> 
> > Date: Tue, 28 Oct 2014 09:44:07 -0700
> > From: Keith David Bershatsky <esq@lawlist.com>
> > 
> > The ls version that I use is coreutils-8.21 for OSX.  I would like to be able to use a custom time-style format in dired-mode, such that there is a space between the date and the time:
> > 
> > --time-style=+%m-%d-%Y %H:%M:%S
> > 
> > Without modifying the source code, I have not found a viable method to set the `dired-listing-switches`.
> 
> Doesn't "C-u C-x d" do what you want?





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

* bug#18875: 25.0.50; Dired -- add support for ls --time-style with a space
  2014-10-28 16:44 bug#18875: 25.0.50; Dired -- add support for ls --time-style with a space Keith David Bershatsky
  2014-10-28 17:04 ` Eli Zaretskii
  2014-10-28 17:10 ` Keith David Bershatsky
@ 2014-10-28 17:33 ` Keith David Bershatsky
  2 siblings, 0 replies; 9+ messages in thread
From: Keith David Bershatsky @ 2014-10-28 17:33 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 18875

Here is an example that works when switches in a list format using `insert-directory` from files.el:

(insert-directory "/" '("--dired" "-alth" "--time-style=+%m-%d-%Y %H:%M:%S") nil t)





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

* bug#18875: 25.0.50; Dired -- add support for ls --time-style with a space
  2014-10-28 17:10 ` Keith David Bershatsky
@ 2021-08-19 14:15   ` Lars Ingebrigtsen
  2021-08-19 14:21     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 9+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-19 14:15 UTC (permalink / raw)
  To: Keith David Bershatsky; +Cc: 18875

Keith David Bershatsky <esq@lawlist.com> 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





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

* bug#18875: 25.0.50; Dired -- add support for ls --time-style with a space
  2021-08-19 14:15   ` Lars Ingebrigtsen
@ 2021-08-19 14:21     ` Lars Ingebrigtsen
  2021-08-22  8:32       ` Juri Linkov
  0 siblings, 1 reply; 9+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-19 14:21 UTC (permalink / raw)
  To: Keith David Bershatsky; +Cc: 18875

Lars Ingebrigtsen <larsi@gnus.org> writes:

> 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.

Or...  the problem isn't in that function -- it works as designed, and
parses a Lisp-style string correctly.

`insert-directory' should be using `split-string-shell-command' instead,
and I've now done that in Emacs 28.

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





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

* bug#18875: 25.0.50; Dired -- add support for ls --time-style with a space
  2021-08-19 14:21     ` Lars Ingebrigtsen
@ 2021-08-22  8:32       ` Juri Linkov
  2021-08-22 15:00         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 9+ messages in thread
From: Juri Linkov @ 2021-08-22  8:32 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 18875

>> 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.
>
> Or...  the problem isn't in that function -- it works as designed, and
> parses a Lisp-style string correctly.
>
> `insert-directory' should be using `split-string-shell-command' instead,
> and I've now done that in Emacs 28.

The commit 04f723dec944eaa7b5e99373840a8bf920ba5fdd
broke my config with the error signaled by insert-directory:
(error "Listing directory failed but ‘access-file’ worked")

When dired-listing-switches is customized to
"-Alv --block-size='1"

split-string-and-unquote parses switches correctly:
("--dired" "-Alv" ""--block-size='1" "-t")

But split-string-shell-command does a wrong thing:
("--dired" "-Alv"" "--block-size=1 -t")

and ls fails:
/bin/ls: invalid suffix in --block-size argument '1 -t'





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

* bug#18875: 25.0.50; Dired -- add support for ls --time-style with a space
  2021-08-22  8:32       ` Juri Linkov
@ 2021-08-22 15:00         ` Lars Ingebrigtsen
  2021-08-23  7:18           ` Juri Linkov
  0 siblings, 1 reply; 9+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-22 15:00 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 18875

Juri Linkov <juri@linkov.net> writes:

> The commit 04f723dec944eaa7b5e99373840a8bf920ba5fdd
> broke my config with the error signaled by insert-directory:
> (error "Listing directory failed but ‘access-file’ worked")
>
> When dired-listing-switches is customized to
> "-Alv --block-size='1"

Hm, well, that's not a valid shell string, is it?

It should be "-Alv --block-size=\"'1\"" or something like that to be
valid...

Hm...  Oh!  The doc string actually documents this (that it's not using
shell quoting).

---
Options that include embedded whitespace must be quoted
like this: "--option=value with spaces"; you can use
‘combine-and-quote-strings’ to produce the correct quoting of
each option.
---

So this was the original answer to this bug report.  I'll revert the
change.

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





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

* bug#18875: 25.0.50; Dired -- add support for ls --time-style with a space
  2021-08-22 15:00         ` Lars Ingebrigtsen
@ 2021-08-23  7:18           ` Juri Linkov
  0 siblings, 0 replies; 9+ messages in thread
From: Juri Linkov @ 2021-08-23  7:18 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Keith David Bershatsky, 18875

>> The commit 04f723dec944eaa7b5e99373840a8bf920ba5fdd
>> broke my config with the error signaled by insert-directory:
>> (error "Listing directory failed but ‘access-file’ worked")
>>
>> When dired-listing-switches is customized to
>> "-Alv --block-size='1"
>
> Hm, well, that's not a valid shell string, is it?
>
> It should be "-Alv --block-size=\"'1\"" or something like that to be
> valid...

Then split-string-shell-command parses correctly:
(split-string-shell-command "-Alv --block-size=\"'1\"")
("-Alv" "--block-size='1")

but split-string-and-unquote fails:
(split-string-and-unquote "-Alv --block-size=\"'1\"")
("-Alv" "--block-size=" "'1")

> Hm...  Oh!  The doc string actually documents this (that it's not using
> shell quoting).
>
> ---
> Options that include embedded whitespace must be quoted
> like this: "--option=value with spaces"; you can use
> ‘combine-and-quote-strings’ to produce the correct quoting of
> each option.
> ---

Ah, now I see what is the correct way, and indeed both functions work
when dired-listing-switches is customized to "-Alv \"--block-size='1\"".

(split-string-shell-command "-Alv \"--block-size='1\"")
("-Alv" "--block-size='1")

(split-string-and-unquote "-Alv \"--block-size='1\"")
("-Alv" "--block-size='1")

> So this was the original answer to this bug report.  I'll revert the
> change.

Thanks, it's good that don't need to amend the existing customization.





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

end of thread, other threads:[~2021-08-23  7:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-28 16:44 bug#18875: 25.0.50; Dired -- add support for ls --time-style with a space Keith David Bershatsky
2014-10-28 17:04 ` Eli Zaretskii
2014-10-28 17:10 ` Keith David Bershatsky
2021-08-19 14:15   ` Lars Ingebrigtsen
2021-08-19 14:21     ` Lars Ingebrigtsen
2021-08-22  8:32       ` Juri Linkov
2021-08-22 15:00         ` Lars Ingebrigtsen
2021-08-23  7:18           ` Juri Linkov
2014-10-28 17:33 ` Keith David Bershatsky

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).