Skip to content

Instantly share code, notes, and snippets.

@hyagni
Created February 26, 2011 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hyagni/845216 to your computer and use it in GitHub Desktop.
Save hyagni/845216 to your computer and use it in GitHub Desktop.
make get-free-disk-space human readable (especially for dired)
(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