diff -c -w "files-CVS-2008-02-29.el" "files-patched-2008-03-02c.el"
*** files-CVS-2008-02-29.el	Fri Feb 29 14:59:08 2008
--- files-patched-2008-03-02c.el	Sun Mar  2 11:02:58 2008
***************
*** 5284,5302 ****
  		      (if val
  			  (put-text-property pos (point)
  					     'dired-filename t)))))))
! 
! 	  (if full-directory-p
! 	      ;; Try to insert the amount of free space.
  	      (save-excursion
  		(goto-char beg)
! 		;; 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 "total used in directory" nil nil nil 1)
  		      (end-of-line)
! 		      (insert " available " available)))))))))))
  
  (defun insert-directory-adj-pos (pos error-lines)
    "Convert `ls --dired' file name position value POS to a buffer position.
--- 5284,5346 ----
  		      (if val
  			  (put-text-property pos (point)
  					     'dired-filename t)))))))
! 	  (when full-directory-p
              (save-excursion
                (goto-char beg)
!               (while (re-search-forward "^ *\\(total\\)" nil t)
!                 (beginning-of-line)
!                 (insert "files " (number-to-string (save-match-data
!                                                      (count-dired-files)))
!                         "/" (number-to-string
!                              (- (length (directory-files default-directory
!                                                          nil nil t)) 2))
!                         " ")
!                 (goto-char beg)
!                 (re-search-forward "^files [0-9]+/[0-9]+ \\(total\\)" nil t)
!                 (replace-match "space used" nil nil nil 1)
!                 (let ((available (and (fboundp 'get-free-disk-space)
!                                       (get-free-disk-space "."))))
                    (when available
                      (end-of-line)
!                     (insert " available " available)))
!                 (put-text-property (progn (beginning-of-line) (point))
!                                    (progn (end-of-line) (point))
!                                    'help-echo "Files shown, total files in \
! dir, Kbytes used in dir, Kbytes available on disk")))))))))
! 
! (defun count-dired-files ()
!   "Returns the number of files in the current Dired directory listing.
! This includes directory entries, as well as files, but it excludes `.'
! and `..'."
!   ;; Should we skip `#' files also, as in `dired-trivial-filenames'? Dunno.
!   (save-excursion
!     (re-search-backward "^$" nil 'to-bob)
!     (re-search-forward dired-move-to-filename-regexp nil t)
!     (let* ((beg (line-beginning-position))
!            (end (save-excursion (re-search-forward "^$" nil t)))
!            (dots-p (save-excursion      ; Is `..' present?
!                      (goto-char beg)
!                      (re-search-forward
!                       (concat directory-listing-before-filename-regexp
!                               "\\.\\./?$")
!                       end t))))
!       (if dots-p (- (count-lines beg end) 2) (count-lines beg end)))))
! 
! (add-hook 'dired-after-readin-hook 'update-dired-files-count)
! (defun update-dired-files-count ()
!   "Update file count in Dired header for each directory listed."
!   (let ((num-files (number-to-string (count-dired-files))))
!     (save-excursion
!       (goto-char (point-min))
!       (while (re-search-forward "^  files \\([0-9]+\\)/\\([0-9]+\\)" nil t)
!         (let ((buffer-read-only nil))
!           (replace-match (number-to-string (save-match-data (count-dired-files)))
!                          nil nil nil 1)
!           (replace-match (number-to-string
!                           (- (length (directory-files default-directory
!                                                       nil nil t)) 2))
!                          nil nil nil 2))
!         (set-buffer-modified-p nil)))))
  
  (defun insert-directory-adj-pos (pos error-lines)
    "Convert `ls --dired' file name position value POS to a buffer position.

Diff finished at Sun Mar 02 11:03:47
