/[emacs]/emacs/lisp/dired.el
ViewVC logotype

Diff of /emacs/lisp/dired.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.215 by rms, Mon Dec 17 01:58:05 2001 UTC revision 1.216 by rms, Tue Dec 18 19:35:20 2001 UTC
# Line 157  The target is used in the prompt for fil Line 157  The target is used in the prompt for fil
157    :type 'boolean    :type 'boolean
158    :group 'dired)    :group 'dired)
159    
 (defcustom dired-free-space-program "df"  
   "*Program to get the amount of free space on a file system.  
 We assume the output has the format of `df'.  
 The value of this variable must be just a command name or file name;  
 if you want to specify options, use `dired-free-space-args'.  
   
 A value of nil disables this feature."  
   :type '(choice (string :tag "Program") (const :tag "None" nil))  
   :group 'dired)  
   
 (defcustom dired-free-space-args "-Pk"  
   "*Options to use when running `dired-free-space-program'."  
   :type 'string  
   :group 'dired)  
   
160  ;;; Hook variables  ;;; Hook variables
161    
162  (defvar dired-load-hook nil  (defvar dired-load-hook nil
# Line 685  If DIRNAME is already in a dired buffer, Line 670  If DIRNAME is already in a dired buffer,
670           (cdr dir-or-list))           (cdr dir-or-list))
671        ;; Expand the file name here because it may have been abbreviated        ;; Expand the file name here because it may have been abbreviated
672        ;; in dired-noselect.        ;; in dired-noselect.
673        (insert-directory (expand-file-name dir-or-list) switches wildcard full-p)        (insert-directory (expand-file-name dir-or-list) switches wildcard full-p))
       (when (and full-p dired-free-space-program)  
         (save-excursion  
           (goto-char (point-min))  
           (when (re-search-forward "total [0-9]+$" nil t)  
             (insert "  free ")  
             ;; Non-Posix systems don't always have dired-free-space-program,  
             ;; but might have an equivalent system call.  
             (if (fboundp 'file-system-info)  
                 (let ((beg (point))  
                       (fsinfo (file-system-info dir-or-list)))  
                   (if fsinfo  
                       (insert  
                        (format "%.0f" (/ (nth 2 fsinfo) 1024)))  
                     ;; file-system-info failed; delete " free ".  
                     (delete-region (- beg 7) beg)))  
               (let ((beg (point)))  
                 (condition-case nil  
                     (if (zerop (call-process dired-free-space-program nil t nil  
                                              dired-free-space-args  
                                              (expand-file-name dir-or-list)))  
                         (progn  
                           (goto-char beg)  
                           (forward-line 1)  
                           (skip-chars-forward "^ \t")  
                           (forward-word 2)  
                           (skip-chars-forward " \t")  
                           (delete-region beg (point))  
                           (forward-word 1)  
                           (delete-region (point)  
                                          (progn (forward-line 1) (point))))  
              ;; The dired-free-space-program failed; delete its output  
                       (delete-region (- beg 7) (point)))  
                   (error (delete-region (- beg 7) (point))))))))))  
674      ;; Quote certain characters, unless ls quoted them for us.      ;; Quote certain characters, unless ls quoted them for us.
675      (if (not (string-match "b" dired-actual-switches))      (if (not (string-match "b" dired-actual-switches))
676          (save-excursion          (save-excursion

Legend:
Removed from v.1.215  
changed lines
  Added in v.1.216

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26