From 7f1b5edca1545d4d3331e6abc3a76d091f84a301 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 21 Dec 2001 15:22:06 +0000 Subject: [PATCH] (insert-directory): Insert the amount of free disk space, like files.el's insert-directory does. --- lisp/ChangeLog | 12 ++++++++++++ lisp/ls-lisp.el | 13 ++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7fd55a56901..ec18c63df3c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,15 @@ +2001-12-21 Eli Zaretskii + + * ls-lisp.el (insert-directory): Insert the amount of free disk + space, like files.el's insert-directory does. + + * files.el (directory-free-space-program): Mention + file-system-info in the doc string. + (get-free-disk-space): New function; code moved from + insert-directory. + (insert-directory): Call get-free-disk-space to get the amount of + free space. + 2001-12-21 Richard M. Stallman * emacs-lisp/easy-mmode.el (define-minor-mode): diff --git a/lisp/ls-lisp.el b/lisp/ls-lisp.el index 9f2eb5be2a3..53057dab07f 100644 --- a/lisp/ls-lisp.el +++ b/lisp/ls-lisp.el @@ -200,7 +200,18 @@ that work are: A a c i r S s t u U X g G B C R and F partly." (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) -- 2.39.2