[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Quotes in Dired listing switches

From: Juri Linkov
Subject: Quotes in Dired listing switches
Date: Wed, 23 Dec 2009 11:07:27 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.90 (x86_64-pc-linux-gnu)

To make file sizes in Dired more readable, `ls' provides the option
`--block-size'.  (info "(coreutils) What information is listed") says:

     `--block-size="'1"' prints a byte count with the thousands
     separator of the current locale.

However, this doesn't work in Dired when set by `dired-listing-switches'.
After setting

  (setq dired-listing-switches "-al --block-size=\"'1\"")

`C-x d' fails with the error message:

  insert-directory: Listing directory failed but `access-file' worked

because in `insert-directory', `call-process' called as

(apply 'call-process
       insert-directory-program nil t nil
       '("--dired" "-al" "--block-size=\"'1\"" "--" "/tmp/."))

creates a Dired buffer with the following line:

  /bin/ls: invalid --block-size argument `"'1"'

When using `--block-size' without double quotes

(setq dired-listing-switches "-al --block-size='1")

then Dired works correctly, but with e.g. `C-x d /sudo::/tmp'
Tramp hangs because the unmatched single quote causes the shell
to wait for the closing quote.

Fortunately, (info "(coreutils) Block size") mentions the
environment variable `LS_BLOCK_SIZE' that indeed works with:

  (setenv "LS_BLOCK_SIZE" "'1")

without using Dired switches.

But I still have a question: would it be possible to solve this problem
without resorting to an environment variable that may not exist
for other similar cases?

Juri Linkov

reply via email to

[Prev in Thread] Current Thread [Next in Thread]