GNU bug report logs - #36729
27.0.50; Unclear total in directory listing

Previous Next

Package: emacs;

Reported by: Mattias Engdegård <mattiase <at> acm.org>

Date: Fri, 19 Jul 2019 10:41:01 UTC

Severity: minor

Tags: patch, wontfix

Merged with 44273

Found in version 27.0.50

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 36729 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Mattias Engdegård <mattiase <at> acm.org>,
 36729 <at> debbugs.gnu.org
Subject: Re: bug#36729: 27.0.50; Unclear total in directory listing
Date: Fri, 19 Jul 2019 15:28:12 +0200
On Fri, 19 Jul 2019 15:16:02 +0300 Eli Zaretskii <eliz <at> gnu.org> wrote:

>> From: Mattias Engdegård <mattiase <at> 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."




This bug report was last modified 3 years and 260 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.