]> git.eshelyaron.com Git - emacs.git/commitdiff
(dired-insert-directory): If dired-free-space-program
authorAndreas Schwab <schwab@suse.de>
Wed, 29 Mar 2000 20:02:10 +0000 (20:02 +0000)
committerAndreas Schwab <schwab@suse.de>
Wed, 29 Mar 2000 20:02:10 +0000 (20:02 +0000)
failed just delete its output.

lisp/dired.el

index e5f704689c697695950e7eefdee581501cda5d67..e9426d402880c05fae79fec3c95b4f7757ee4122 100644 (file)
@@ -681,18 +681,21 @@ If DIRNAME is already in a dired buffer, that buffer is used without refresh."
          (when (re-search-forward "total [0-9]+$" nil t)
            (insert "  free ")
            (let ((beg (point)))
-             (call-process dired-free-space-program nil t nil
-                           dired-free-space-args
-                           (expand-file-name dir-or-list))
-             (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))))))))
+             (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))))))))
     ;; Quote certain characters, unless ls quoted them for us.
     (if (not (string-match "b" dired-actual-switches))
        (save-excursion