summaryrefslogtreecommitdiff
path: root/lisp/ls-lisp.el
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2001-12-21 15:22:06 +0000
committerEli Zaretskii <eliz@gnu.org>2001-12-21 15:22:06 +0000
commit7f1b5edca1545d4d3331e6abc3a76d091f84a301 (patch)
tree854b22136e76286882b3350f1c2b641af3db47d9 /lisp/ls-lisp.el
parent01b26b907083382000c3d0b9dd30f75d48e2e16b (diff)
downloademacs-7f1b5edca1545d4d3331e6abc3a76d091f84a301.tar.gz
(insert-directory): Insert the amount of free disk
space, like files.el's insert-directory does.
Diffstat (limited to 'lisp/ls-lisp.el')
-rw-r--r--lisp/ls-lisp.el13
1 files changed, 12 insertions, 1 deletions
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)