aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schwab2002-12-08 13:20:42 +0000
committerAndreas Schwab2002-12-08 13:20:42 +0000
commit75bb5ca4dc5e3740ba1b387d3f4913c21b0421bc (patch)
tree4a88cf461964ec49aa319b3f1b0b018aeb89ecbf
parent2c4396c417713c355d9b9394d97ab235a8130d81 (diff)
downloademacs-75bb5ca4dc5e3740ba1b387d3f4913c21b0421bc.tar.gz
emacs-75bb5ca4dc5e3740ba1b387d3f4913c21b0421bc.zip
(insert-directory): Insert free space only when listing a full directory.
-rw-r--r--lisp/files.el23
1 files changed, 12 insertions, 11 deletions
diff --git a/lisp/files.el b/lisp/files.el
index b6bee3b09d4..eb4895781c9 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -4104,17 +4104,18 @@ If WILDCARD, it also runs the shell specified by `shell-file-name'."
4104 (beginning-of-line) 4104 (beginning-of-line)
4105 (delete-region (point) (progn (forward-line 2) (point))))) 4105 (delete-region (point) (progn (forward-line 2) (point)))))
4106 4106
4107 ;; Try to insert the amount of free space. 4107 (if full-directory-p
4108 (save-excursion 4108 ;; Try to insert the amount of free space.
4109 (goto-char beg) 4109 (save-excursion
4110 ;; First find the line to put it on. 4110 (goto-char beg)
4111 (when (re-search-forward "^ *\\(total\\)" nil t) 4111 ;; First find the line to put it on.
4112 (let ((available (get-free-disk-space "."))) 4112 (when (re-search-forward "^ *\\(total\\)" nil t)
4113 (when available 4113 (let ((available (get-free-disk-space ".")))
4114 ;; Replace "total" with "used", to avoid confusion. 4114 (when available
4115 (replace-match "total used in directory" nil nil nil 1) 4115 ;; Replace "total" with "used", to avoid confusion.
4116 (end-of-line) 4116 (replace-match "total used in directory" nil nil nil 1)
4117 (insert " available " available)))))))))) 4117 (end-of-line)
4118 (insert " available " available)))))))))))
4118 4119
4119(defun insert-directory-safely (file switches 4120(defun insert-directory-safely (file switches
4120 &optional wildcard full-directory-p) 4121 &optional wildcard full-directory-p)