From 1914d946d62de4ab7bab1434bcea09087d61bb5a Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Wed, 1 Dec 2021 23:27:09 +0100 Subject: Change how Dired displays available space * doc/emacs/dired.texi (Misc Dired Features): Document it (bug#23812). * lisp/dired.el (dired-free-space): New user option. (dired-insert-directory): Use it from here. (dired--insert-disk-space): New function that uses the user option. * lisp/files.el (insert-directory): Don't transform "total" here. * lisp/ls-lisp.el (ls-lisp--insert-directory): Or here. Instead just leave the "total " bit alone, and let Dired transform it. * test/lisp/files-tests.el (files-tests): Move "available" tests to dired-tests. * test/lisp/dired-tests.el (data-dir): Moved here. --- lisp/ls-lisp.el | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'lisp/ls-lisp.el') diff --git a/lisp/ls-lisp.el b/lisp/ls-lisp.el index eea8089daa7..25d196392ab 100644 --- a/lisp/ls-lisp.el +++ b/lisp/ls-lisp.el @@ -337,18 +337,7 @@ are also supported; unsupported long options are silently ignored." (ls-lisp-insert-directory file switches (ls-lisp-time-index switches) nil full-directory-p)) - (signal (car err) (cdr err))))) - ;; 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 orig-file))) - (when available - ;; Replace "total" with "total used", to avoid confusion. - (replace-match "total used in directory") - (end-of-line) - (insert " available " available))))))))) + (signal (car err) (cdr err))))))))) (advice-add 'insert-directory :around #'ls-lisp--insert-directory) (defun ls-lisp-insert-directory -- cgit v1.2.3