changeset 42239:1e736b882b4f

(insert-directory): Insert the amount of free disk space, like files.el's insert-directory does.
author Eli Zaretskii <eliz@gnu.org>
date Fri, 21 Dec 2001 15:21:27 +0000
parents e79842fc9855
children 8a60ab4595b4
files lisp/ls-lisp.el
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ls-lisp.el	Fri Dec 21 15:20:42 2001 +0000
+++ b/lisp/ls-lisp.el	Fri Dec 21 15:21:27 2001 +0000
@@ -200,7 +200,18 @@
 	  (if (memq ?B switches) (setq wildcard "[^~]\\'")))
 	(ls-lisp-insert-directory
 	 file switches (ls-lisp-time-index switches)
-	 wildcard full-directory-p)))))
+	 wildcard full-directory-p)
+	;; Try to insert the amount of free space.
+	(save-excursion
+	  (goto-char (point-min))
+	  ;; 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 "used")
+		(end-of-line)
+		(insert " available " available)))))))))
 
 (defun ls-lisp-insert-directory
   (file switches time-index wildcard full-directory-p)