aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/files.el41
2 files changed, 29 insertions, 18 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 69626e2e455..026b05a7231 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12010-09-05 Chong Yidong <cyd@stupidchicken.com>
2
3 * files.el (get-free-disk-space): Search more robustly for
4 "available" column. Suggested by Ehud Karni
5 <ehud@unix.mvs.co.il>.
6
12010-09-05 Juanma Barranquero <lekktu@gmail.com> 72010-09-05 Juanma Barranquero <lekktu@gmail.com>
2 8
3 * international/uni-bidi.el: 9 * international/uni-bidi.el:
diff --git a/lisp/files.el b/lisp/files.el
index 73a0c5c9e24..41bd9bd9c25 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -5563,12 +5563,14 @@ preference to the program given by this variable."
5563 5563
5564(defun get-free-disk-space (dir) 5564(defun get-free-disk-space (dir)
5565 "Return the amount of free space on directory DIR's file system. 5565 "Return the amount of free space on directory DIR's file system.
5566The result is a string that gives the number of free 1KB blocks, 5566The return value is a string describing the amount of free
5567or nil if the system call or the program which retrieve the information 5567space (normally, the number of free 1KB blocks).
5568fail. It returns also nil when DIR is a remote directory. 5568
5569 5569This function calls `file-system-info' if it is available, or
5570This function calls `file-system-info' if it is available, or invokes the 5570invokes the program specified by `directory-free-space-program'
5571program specified by `directory-free-space-program' if that is non-nil." 5571and `directory-free-space-args'. If the system call or program
5572is unsuccessful, or if DIR is a remote directory, this function
5573returns nil."
5572 (unless (file-remote-p dir) 5574 (unless (file-remote-p dir)
5573 ;; Try to find the number of free blocks. Non-Posix systems don't 5575 ;; Try to find the number of free blocks. Non-Posix systems don't
5574 ;; always have df, but might have an equivalent system call. 5576 ;; always have df, but might have an equivalent system call.
@@ -5588,19 +5590,22 @@ program specified by `directory-free-space-program' if that is non-nil."
5588 directory-free-space-args 5590 directory-free-space-args
5589 dir) 5591 dir)
5590 0))) 5592 0)))
5591 ;; Usual format is a header line followed by a line of 5593 ;; Usual format is as follows:
5592 ;; numbers. 5594 ;; Filesystem ... Used Available Capacity ...
5595 ;; /dev/sda6 ...48106535 35481255 10669850 ...
5593 (goto-char (point-min)) 5596 (goto-char (point-min))
5594 (forward-line 1) 5597 (when (re-search-forward " +Avail[^ \n]*"
5595 (if (not (eobp)) 5598 (line-end-position) t)
5596 (progn 5599 (let ((beg (match-beginning 0))
5597 ;; Move to the end of the "available blocks" number. 5600 (end (match-end 0))
5598 (skip-chars-forward "^ \t") 5601 str)
5599 (forward-word 3) 5602 (forward-line 1)
5600 ;; Copy it into AVAILABLE. 5603 (setq str
5601 (let ((end (point))) 5604 (buffer-substring-no-properties
5602 (forward-word -1) 5605 (+ beg (point) (- (point-min)))
5603 (buffer-substring (point) end)))))))))) 5606 (+ end (point) (- (point-min)))))
5607 (when (string-match "\\` *\\([^ ]+\\)" str)
5608 (match-string 1 str))))))))))
5604 5609
5605;; The following expression replaces `dired-move-to-filename-regexp'. 5610;; The following expression replaces `dired-move-to-filename-regexp'.
5606(defvar directory-listing-before-filename-regexp 5611(defvar directory-listing-before-filename-regexp