bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Kevin Ryde
Subject: bug#2631: get-free-disk-space when default-directory doesn't exist
Date: Sat, 28 Mar 2009 10:17:47 +1100
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.2 (gnu/linux)

reopen 2631
retitle 2631 get-free-disk-space when home dir also doesn't exist
tags 2631 +patch
thanks

If both default-directory and home directory both don't exist
get-free-disk-space still gets an error

    (progn
      (setq default-directory "/no/such/dir")
      (setenv "HOME" "/another/no/such/dir")
      (get-free-disk-space "/"))
    => (file-error "Setting current directory" "no such file or directory" 
"/another/no/such/dir/")

Although plenty of things probably depend on a home dir I don't think
get-free-disk-space needs to be one of them.

Change below is like what's also in the following funcs, I believe for
the same purpose, ie. just to make sure call-process will be happy, when
the program run doesn't care about the current directory.

    Man-init-defvars,
    mail-source-movemail
    message-send-mail-with-sendmail
    sendmail-send-it
    gamegrid-add-score-with-update-game-score-1


*** files.el    28 Mar 2009 09:50:47 +1100      1.1041
--- files.el    28 Mar 2009 09:56:48 +1100      
***************
*** 5336,5352 ****
        (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 "~/"))))
!                      (eq (call-process directory-free-space-program
!                                        nil t nil
!                                        directory-free-space-args
!                                        dir)
!                          0)))
            ;; Usual format is a header line followed by a line of
            ;; numbers.
            (goto-char (point-min))
--- 5336,5349 ----
        (save-match-data
        (with-temp-buffer
          (when (and directory-free-space-program
!                    (progn
!                      (setq dir (expand-file-name dir)) ;; in case relative
!                      (let ((default-directory "/"))
!                        (eq (call-process directory-free-space-program
!                                          nil t nil
!                                          directory-free-space-args
!                                          dir)
!                            0))))
            ;; Usual format is a header line followed by a line of
            ;; numbers.
            (goto-char (point-min))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]