From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.bugs Subject: bug#36729: 27.0.50; Unclear total in directory listing Date: Fri, 19 Jul 2019 15:28:12 +0200 Message-ID: <87sgr2887n.fsf@gmx.net> References: <048FD91B-CDA0-4444-8F6F-C5B2F5C595CD@acm.org> <83k1ceusn1.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="142909"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= , 36729@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jul 19 15:29:08 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hoSwd-000b53-Qn for geb-bug-gnu-emacs@m.gmane.org; Fri, 19 Jul 2019 15:29:07 +0200 Original-Received: from localhost ([::1]:45302 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hoSwc-0007Ts-Rn for geb-bug-gnu-emacs@m.gmane.org; Fri, 19 Jul 2019 09:29:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36003) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hoSwZ-0007Ta-R9 for bug-gnu-emacs@gnu.org; Fri, 19 Jul 2019 09:29:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hoSwY-0002Xj-Pn for bug-gnu-emacs@gnu.org; Fri, 19 Jul 2019 09:29:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46572) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hoSwY-0002XW-MB for bug-gnu-emacs@gnu.org; Fri, 19 Jul 2019 09:29:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hoSwY-0000Uf-Gx for bug-gnu-emacs@gnu.org; Fri, 19 Jul 2019 09:29:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stephen Berman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 19 Jul 2019 13:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36729 X-GNU-PR-Package: emacs Original-Received: via spool by 36729-submit@debbugs.gnu.org id=B36729.15635429191865 (code B ref 36729); Fri, 19 Jul 2019 13:29:02 +0000 Original-Received: (at 36729) by debbugs.gnu.org; 19 Jul 2019 13:28:39 +0000 Original-Received: from localhost ([127.0.0.1]:55393 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hoSwB-0000U0-8c for submit@debbugs.gnu.org; Fri, 19 Jul 2019 09:28:39 -0400 Original-Received: from mout.gmx.net ([212.227.17.20]:37829) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hoSw6-0000Tk-4i for 36729@debbugs.gnu.org; Fri, 19 Jul 2019 09:28:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1563542896; bh=u6AsWpYQGEwDmTdTXmFrHunB3RFoQXjAI8NAnt+o1BE=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=SKTtlIdOhJh/mT2cNvaVtqF7vH699gPalXWI/FdvmUlaEIFe+U8xgpO4APtfqW1VQ YsOLaGhmypO9eptcrfklxL3VH3DQWSZOfT1C/3jL7tTM9L+S7zLSlyKO13QKt6IxyQ p5HM/fREIbbPhMBtwQ2mmn1NCdMyhLqpL6Q7Nyvs= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from strobe-lfs84 ([178.6.96.182]) by mail.gmx.com (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MCbEp-1hfybb16fb-009jJy; Fri, 19 Jul 2019 15:28:16 +0200 In-Reply-To: <83k1ceusn1.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 19 Jul 2019 15:16:02 +0300") X-Provags-ID: V03:K1:5kbTUpwaYLSuHgdiWD82bHSf2tW4MGH343oDYm+31o/gKNaJM3W DORh7OlN95B2J3H9T/mV9v0bhzRCj9OnkRKBEsdvLj+rOs8Sy3Emtv5HnYlYGuURRmUxgxs V7U4dQzydGRElu7+ToRmC551ZpjSH+oeusWFPsyXbqoZ9nrZ1VbGr8fi+ASfm3N2qrM4NhO r1Qamdf4swscLwJtmZWgA== X-UI-Out-Filterresults: notjunk:1;V03:K0:ttDhJZVg7KE=:3fTlutXgH/M4Yt/Haah45T rrjwuaep347bFFmZkDECIYFcmpEJT57gBW2Vi2sgM1A06BkXwwWDvyMPtaQnvZ2ZDbE0g4NbM +899SNx0rHRu93WQLCWPkl09FxNEjLinqp+RNQ7gxA7J5bpqMs3xidSVhrVNs0sxWI8ixGOM8 viEcleXlaKQfmwWPdr5TfyhsMzoFxW/juJD+gP0B+ko0g6d2AVoM6oWfHYilJwMtHCR5hnblO nvncCGrgWCVx/VEE/7rXxd+6VIGHgt207qa0BdtSwF4LVIZ2HBMv5ASsY+w0cFRVHDChMd9M/ f184r0D0L7KjgKfFcp+AOle/zGDeJTX6HaSxTFGdBK+0d0OvoNBNBzXemStmWkbc76mscHB54 dDiSzeB81EQdWNH0RwI0fW2KQzz3nw2m5nH0c8iq3J+QANtuT4F1M1LG+0428//OyrZ8L3Pvn C5dWhVuz8MslEWwBgo8f510hM8pydxVTDcPHsguTsdnxsw7RZPtaXZdG1J7kXzUPihCINa3En W+iSkIXFkfDaZ8VTwDgQRxTwibiQPAr+P/vR+a3G9p/rXZqGan1I8BXdc2KqLv+01gWqjUBT6 levkTxsgq1e/0VeiCVifnhS2AuBpIJQ3SWD2gL8bwcUu14zlIPoSegjVty15+K/853Wu2xAEf cwnA0WugVfU/B8QwAF/K7m1Axw5vNw0+DlUTFOi8uwIioKFGxEzZtCYD82F521SBwBh52At/C /PQPJbYVt3Mm7Z9bvlTMMEn2sd96KYCss4CnU7avER+zs5ZFVs+7gSlQ42VHnNURVOW/ehnM X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:163407 Archived-At: On Fri, 19 Jul 2019 15:16:02 +0300 Eli Zaretskii wrote: >> From: Mattias Engdeg=C3=A5rd >> Date: Fri, 19 Jul 2019 12:15:58 +0200 >>=20 >> The first line of a directory listing reads >>=20 >> total used in directory 71752 available 65.2 GiB >>=20 >> 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)))) =20 (defun dired-insert-set-properties (beg end) "Add various text properties to the lines in the region."