[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#36729: 27.0.50; Unclear total in directory listing
From: |
Stephen Berman |
Subject: |
bug#36729: 27.0.50; Unclear total in directory listing |
Date: |
Fri, 19 Jul 2019 15:28:12 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
On Fri, 19 Jul 2019 15:16:02 +0300 Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Mattias Engdegård <mattiase@acm.org>
>> Date: Fri, 19 Jul 2019 12:15:58 +0200
>>
>> The first line of a directory listing reads
>>
>> total used in directory 71752 available 65.2 GiB
>>
>> where it is a mystery what the first number represents. Often it is 512-byte
>> blocks, which is confusing and not very useful, and cannot easily be
>> compared with the 'available' number (which is crystal clear).
>
> Feel free to suggest a clarification in the doc string of 'dired'.
An alternative is to do for "total used" what was done for "available".
On systems that use `ls' (at least the GNU version), users can do that
by setting the environment variable BLOCK_SIZE, but since the change to
the display of "available" was unconditional (if I'm not mistaken), we
could do the same for the display of "total used", e.g. as in the below
patch. (But since this won't work on systems that don't use GNU `ls',
either another solution just for them or a different general one would
be needed.)
Steve Berman
diff --git a/lisp/dired.el b/lisp/dired.el
index c455a5cde4..8a94080538 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -1271,7 +1271,9 @@ dired-insert-directory
If HDR is non-nil, insert a header line with the directory name."
(let ((opoint (point))
(process-environment (copy-sequence process-environment))
+ (block-size (getenv "BLOCK_SIZE"))
end)
+ (setenv "BLOCK_SIZE" "si")
(if (and
;; Don't try to invoke `ls' if we are on DOS/Windows where
;; ls-lisp emulation is used, except if they want to use `ls'
@@ -1385,7 +1387,10 @@ dired-insert-directory
(insert " wildcard " (or (cdr-safe
(insert-directory-wildcard-in-dir-p dir))
(file-name-nondirectory dir))
"\n")))
- (dired-insert-set-properties content-point (point)))))
+ (dired-insert-set-properties content-point (point)))
+ (if block-size
+ (setenv "BLOCK_SIZE" block-size)
+ (setenv-internal process-environment "BLOCK_SIZE" nil t))))
(defun dired-insert-set-properties (beg end)
"Add various text properties to the lines in the region."
- bug#36729: 27.0.50; Unclear total in directory listing, Mattias Engdegård, 2019/07/19
- bug#36729: 27.0.50; Unclear total in directory listing, Eli Zaretskii, 2019/07/19
- bug#36729: 27.0.50; Unclear total in directory listing,
Stephen Berman <=
- bug#36729: 27.0.50; Unclear total in directory listing, Mattias Engdegård, 2019/07/21
- bug#36729: 27.0.50; Unclear total in directory listing, Eli Zaretskii, 2019/07/21
- bug#36729: 27.0.50; Unclear total in directory listing, Mattias Engdegård, 2019/07/21
- bug#36729: 27.0.50; Unclear total in directory listing, Drew Adams, 2019/07/21
- bug#36729: 27.0.50; Unclear total in directory listing, Eli Zaretskii, 2019/07/21
- bug#36729: 27.0.50; Unclear total in directory listing, Drew Adams, 2019/07/21
- bug#36729: 27.0.50; Unclear total in directory listing, Eli Zaretskii, 2019/07/21
- bug#36729: 27.0.50; Unclear total in directory listing, Juri Linkov, 2019/07/26