From: Chong Yidong Date: Sun, 16 Aug 2009 00:31:28 +0000 (+0000) Subject: * files.el (get-free-disk-space): Change fallback default X-Git-Tag: emacs-pretest-23.1.90~1840 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e1bdde781814f254e61ed54478bcef087009429b;p=emacs.git * 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). --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6c339b6d4b1..6961e82c6d2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2009-08-16 Chong Yidong + + * 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 * files.el (load-library): Doc fix. diff --git a/lisp/files.el b/lisp/files.el index 966036a15e4..6f8ff69caef 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -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