comparison lisp/dired.el @ 26026:ed3c9dd47f31

(dired-insert-directory): Insert the amount of free space after the total size. (dired-free-space-program, dired-free-space-args): New variables.
author Gerd Moellmann <gerd@gnu.org>
date Thu, 14 Oct 1999 21:51:12 +0000
parents 86273069818a
children 64f5595ba1fb
comparison
equal deleted inserted replaced
26025:1fc4552789ee 26026:ed3c9dd47f31
148 ;;;###autoload 148 ;;;###autoload
149 (defcustom dired-copy-preserve-time t 149 (defcustom dired-copy-preserve-time t
150 "*If non-nil, Dired preserves the last-modified time in a file copy. 150 "*If non-nil, Dired preserves the last-modified time in a file copy.
151 \(This works on only some systems.)" 151 \(This works on only some systems.)"
152 :type 'boolean 152 :type 'boolean
153 :group 'dired)
154
155 (defcustom dired-free-space-program "df"
156 "*Program to get the amount of free space on a file system.
157 We assume the output has the format of `df'.
158 The value of this variable must be just a command name or file name;
159 if you want to specify options, use `dired-free-space-args'.
160
161 A value of nil disables this feature."
162 :type '(choice (string :tag "Program") (const :tag "None" nil))
163 :group 'dired)
164
165 (defcustom dired-free-space-args "-Pk"
166 "*Options to use when running `dired-free-space-program'."
167 :type 'string
153 :group 'dired) 168 :group 'dired)
154 169
155 ;;; Hook variables 170 ;;; Hook variables
156 171
157 (defvar dired-load-hook nil 172 (defvar dired-load-hook nil
656 (mapcar 671 (mapcar
657 (function (lambda (x) (insert-directory x switches wildcard full-p))) 672 (function (lambda (x) (insert-directory x switches wildcard full-p)))
658 (cdr dir-or-list)) 673 (cdr dir-or-list))
659 ;; Expand the file name here because it may have been abbreviated 674 ;; Expand the file name here because it may have been abbreviated
660 ;; in dired-noselect. 675 ;; in dired-noselect.
661 (insert-directory (expand-file-name dir-or-list) switches wildcard full-p)) 676 (insert-directory (expand-file-name dir-or-list) switches wildcard full-p)
677 (when (and full-p dired-free-space-program)
678 (save-excursion
679 (goto-char (point-min))
680 (when (re-search-forward "total [0-9]+$" nil t)
681 (insert " free ")
682 (let ((beg (point)))
683 (call-process dired-free-space-program nil t nil
684 dired-free-space-args
685 (expand-file-name dir-or-list))
686 (goto-char beg)
687 (forward-line 1)
688 (skip-chars-forward "^ \t")
689 (forward-word 2)
690 (skip-chars-forward " \t")
691 (delete-region beg (point))
692 (forward-word 1)
693 (delete-region (point)
694 (progn (forward-line 1) (point))))))))
662 ;; Quote certain characters, unless ls quoted them for us. 695 ;; Quote certain characters, unless ls quoted them for us.
663 (if (not (string-match "b" dired-actual-switches)) 696 (if (not (string-match "b" dired-actual-switches))
664 (save-excursion 697 (save-excursion
665 (setq end (point-marker)) 698 (setq end (point-marker))
666 (goto-char opoint) 699 (goto-char opoint)