Subject: Re: bug#5762: 24.0.50; Show available disk space with -h option when using ls with -h option

From: Thierry Volpiatto <[email-masked]>
Date: Wed, 24 Mar 2010 08:29:24 +0100

Thierry Volpiatto <[email-masked]> writes:

> Hi,
> in dired when using `dired-listing-switches' with -h option, the second
> line of dired buffer is like:
>
> total used in directory 24M available 19275100
>
> it should show:
>
> total used in directory 24M available 19G
>
> I suggest to modify `insert-directory' like this:
>
> ,----[ files.el (insert-directory) ]
> | [....]
> | (let* ((directory-free-space-args (if (string-match "h" dired-listing-switches)
> |                                       (concat directory-free-space-args "h")
> |                                       directory-free-space-args))
> |        (available (get-free-disk-space ".")))
> |   (when (re-search-forward "^ *\\(total\\)" nil t)
> |     (when available
> |       ;; Replace "total" with "used", to avoid confusion.
> |       (replace-match "total used in directory" nil nil nil 1)
> |       (end-of-line)
> |       (insert " available " available))))))))))
> `----
>
> Find a patch attached.

Even better is to parse `dired-actual-switches', like that it update
correctly when using C-u s in dired.

Find the precedent patch modified here.

-- 
Thierry Volpiatto
Gpg key: http://pgp.mit.edu/