all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
To: bug-gnu-emacs@gnu.org
Subject: bug#5762: 24.0.50; Show available disk space with -h option when using ls with -h option
Date: Wed, 24 Mar 2010 08:29:24 +0100	[thread overview]
Message-ID: <874ok6rxd7.fsf@tux.homenetwork> (raw)
In-Reply-To: <87y6hitdmp.fsf@tux.homenetwork>

[-- Attachment #1: Type: text/plain, Size: 1195 bytes --]

Thierry Volpiatto <thierry.volpiatto@gmail.com> 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/

[-- Attachment #2: patch-r107473 --]
[-- Type: application/octet-stream, Size: 1735 bytes --]

# HG changeset patch
# User Thierry Volpiatto <thierry.volpiatto@gmail.com>
# Date 1269415422 -3600
# Node ID 6a3555ebe64174aeea55f8cce725ef68f328fdd8
# Parent  7cceab93f61c48239c690c8bf8abe0e34c64e746
files.el (insert-directory): Use -h option in `directory-free-space-args' when using -h option in `dired-listing-switches'.

diff --git a/lisp/files.el b/lisp/files.el
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -5891,13 +5891,17 @@
 	      (save-excursion
 		(goto-char beg)
 		;; First find the line to put it on.
-		(when (re-search-forward "^ *\\(total\\)" nil t)
-		  (let ((available (get-free-disk-space ".")))
-		    (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))))))))))
+                ;(when (re-search-forward "^ *\\(total\\)" nil t)
+                (let* ((directory-free-space-args (if (string-match "h" dired-actual-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))))))))))
 
 (defun insert-directory-adj-pos (pos error-lines)
   "Convert `ls --dired' file name position value POS to a buffer position.

  reply	other threads:[~2010-03-24  7:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-24  6:52 bug#5762: 24.0.50; Show available disk space with -h option when using ls with -h option Thierry Volpiatto
2010-03-24  7:29 ` Thierry Volpiatto [this message]
2012-04-11 14:38   ` Lars Magne Ingebrigtsen
2012-04-11 16:33     ` Thierry Volpiatto
2012-04-11 16:47       ` Glenn Morris
2012-04-11 17:26         ` Thierry Volpiatto
2012-04-12 13:25           ` Lars Magne Ingebrigtsen
2012-04-11 20:32         ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874ok6rxd7.fsf@tux.homenetwork \
    --to=thierry.volpiatto@gmail.com \
    --cc=bug-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.