]> git.eshelyaron.com Git - emacs.git/commitdiff
* files.el (get-free-disk-space): Change fallback default
authorChong Yidong <cyd@stupidchicken.com>
Sun, 16 Aug 2009 00:31:28 +0000 (00:31 +0000)
committerChong Yidong <cyd@stupidchicken.com>
Sun, 16 Aug 2009 00:31:28 +0000 (00:31 +0000)
directory to /.  Expand DIR argument before switching to fallback.
Suggested by Kevin Ryde (Bug#2631, Bug#3911).

lisp/ChangeLog
lisp/files.el

index 6c339b6d4b1e58f96d910de5bd8d50c126ebea64..6961e82c6d2d07ba1c001b18ec9ce9c113167359 100644 (file)
@@ -1,3 +1,9 @@
+2009-08-16  Chong Yidong  <cyd@stupidchicken.com>
+
+       * files.el (get-free-disk-space): Change fallback default
+       directory to /.  Expand DIR argument before switching to fallback.
+       Suggested by Kevin Ryde (Bug#2631, Bug#3911).
+
 2009-08-15  Chong Yidong  <cyd@stupidchicken.com>
 
        * files.el (load-library): Doc fix.
index 966036a15e47f6cba964bd89fcd140a084007690..6f8ff69caef6fef581128eb86b408ab262fa41ef 100644 (file)
@@ -5386,7 +5386,7 @@ fail.  It returns also nil when DIR is a remote directory.
 
 This function calls `file-system-info' if it is available, or invokes the
 program specified by `directory-free-space-program' if that is non-nil."
-  (when (not (file-remote-p dir))
+  (unless (file-remote-p dir)
     ;; Try to find the number of free blocks.  Non-Posix systems don't
     ;; always have df, but might have an equivalent system call.
     (if (fboundp 'file-system-info)
@@ -5396,12 +5396,14 @@ program specified by `directory-free-space-program' if that is non-nil."
       (save-match-data
        (with-temp-buffer
          (when (and directory-free-space-program
-                    (let ((default-directory
-                            (if (and (not (file-remote-p default-directory))
-                                     (file-directory-p default-directory)
-                                     (file-readable-p default-directory))
-                                default-directory
-                              (expand-file-name "~/"))))
+                    ;; Avoid failure if the default directory does
+                    ;; not exist (Bug#2631, Bug#3911).
+                    (let ((default-directory default-directory))
+                      (setq dir (expand-file-name dir))
+                      (unless (and (not (file-remote-p default-directory))
+                                   (file-directory-p default-directory)
+                                   (file-readable-p default-directory))
+                        (setq default-directory "/"))
                       (eq (call-process directory-free-space-program
                                         nil t nil
                                         directory-free-space-args