Subject: bug#3911: get-free-disk-space when default-directory doesn't exist

From: Kevin Ryde <[email-masked]>
Date: Tue, 18 Aug 2009 10:23:08 +1000

Chong Yidong <[email-masked]> writes:
>
> You're right; it's probably better to fall back on / instead of ~.

I think the test for file-remote-p is covered by the first line of the
func so it's not needed in the dir condition bit, per below.

I still think "/" might as well be used unconditionally though.  The
reason I'm still banging on about that is that there's probably 3 or 4
other places in emacs which also don't care about the current directory
when spawning a program.  They would make use of the same idiom,
whatever it might best be.  (I arrived at this first when some of my own
code bombed in a non-existent default-directory.  I've seen it in other
people's code too.)

*** files.el	18 Aug 2009 08:51:19 +1000	1.1068
--- files.el	18 Aug 2009 10:12:22 +1000	
***************
*** 5400,5407 ****
  		     ;; 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
--- 5400,5406 ----
  		     ;; not exist (Bug#2631, Bug#3911).
  		     (let ((default-directory default-directory))
  		       (setq dir (expand-file-name dir))
! 		       (unless (and (file-directory-p default-directory)
  				    (file-readable-p default-directory))
  			 (setq default-directory "/"))
  		       (eq (call-process directory-free-space-program