Subject: bug#13191: 24.3.50; insert-directory: Always replace "total" with "total used in directory"

From: Christopher Schmidt <[email-masked]>
Date: Sat, 15 Dec 2012 11:34:37 +0000 (GMT)

severity: wishlist

In insert-directory there are these forms:

    (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))))))

I think "total" should always be replaced by "total used in directory"
even if Emacs is not able to get the free disk space.  This increases
consistency and avoids confusion by other packages which rely on
consistent output, such as dired-details,

Here is a patch.
--- lisp/ChangeLog
+++ lisp/ChangeLog
@@ -1,3 +1,8 @@
+2012-12-15  Christopher Schmidt  <[email-masked]>
+
+	* files.el (insert-directory): Always replace "total" with "total
+	used in directory" to avoid confusion.  (Bug#)
+
 2012-12-14  Glenn Morris  <[email-masked]>
 
 	* emacs-lisp/macroexp.el (macroexp--warn-and-return):
--- lisp/files.el
+++ lisp/files.el
@@ -6299,10 +6299,11 @@
 		(goto-char beg)
 		;; First find the line to put it on.
 		(when (re-search-forward "^ *\\(total\\)" nil t)
+		  ;; Replace "total" with "total used in directory" to
+		  ;; avoid confusion.
+		  (replace-match "total used in directory" nil nil nil 1)
 		  (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))))))))))

If this patch is applied, tramp (tramp-sh-handle-insert-directory)
should be modified to do the same.

        Christopher