Created
February 26, 2011 13:57
-
-
Save hyagni/845216 to your computer and use it in GitHub Desktop.
make get-free-disk-space human readable (especially for dired)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defadvice get-free-disk-space (after get-free-disk-gb activate) | |
"Return free disk space with GByte order" | |
(let ((kb (string-to-number ad-return-value))) ; this is reserved variable | |
(if (> kb 1024) | |
(progn (setq kb (/ kb 1024)) | |
(if (> kb 1024) | |
(setq ad-return-value (format "%.0f GB" (/ kb 1024))) | |
(setq ad-return-value (format "%.0f MB" kb)))) | |
(setq ad-return-value (format "%.0f kB" kb)) | |
))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment