branch: externals/disk-usage
commit ea2bcd27fd3f4e9eef7028e0ddb6093dde370903
Author: Pierre Neidhardt <[email protected]>
Commit: Pierre Neidhardt <[email protected]>
Set du-command dynamically for BSD/macOS and make command settings
customizable
---
disk-usage.el | 19 +++++++++++++++----
readme.org | 2 ++
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/disk-usage.el b/disk-usage.el
index 63b7fd9..1888a67 100644
--- a/disk-usage.el
+++ b/disk-usage.el
@@ -26,6 +26,9 @@
;;; Commentary:
;;
+;; Warning: BSD and macOS users need `gdu`, the "GNU du" from the "GNU
+;; coreutils".
+;;
;; Disk Usage is a file system analyzer: it offers a tabulated view of file
;; listings sorted by size. Directory sizes are computed recursively. The
results
;; are cached for speed.
@@ -35,7 +38,7 @@
;; `disk-usage-dired-at-point' to open a `dired' buffer for the current
;; directory.
;;
-;; Instead of displaying only the current folder, ~disk-usage~ can also display
+;; Instead of displaying only the current folder, `disk-usage' can also display
;; files in all subfolders recursively with `disk-usage-toggle-recursive'.
;;
;; Marked files can be trashed with `disk-usage-delete-marked-files'. When
@@ -75,9 +78,17 @@
"Whether to kill the current `disk-usage' buffer before moving directory."
:type 'boolean)
-(defvar disk-usage--du-command "du")
-(defvar disk-usage--du-args "-sb")
-(defvar disk-usage--find-command "find")
+(defcustom disk-usage--du-command (if (member system-type '(gnu gnu/linux
gnu/kfreebsd))
+ "du"
+ "gdu")
+ "Non-GNU users need GNU's `du' for the `-b' flag. See
`disk-usage--du-args'."
+ :type 'string)
+(defcustom disk-usage--du-args "-sb"
+ "Non-GNU users need GNU's `du' for the `-b' flag. See
`disk-usage--du-command'."
+ :type 'string)
+(defcustom disk-usage--find-command "find"
+ "The `find' executable. This is required for recursive listings."
+ :type 'string)
(defcustom disk-usage--directory-size-function
(if (executable-find disk-usage--du-command)
diff --git a/readme.org b/readme.org
index 596cb11..e1ad843 100644
--- a/readme.org
+++ b/readme.org
@@ -22,6 +22,8 @@ Load the package with
: (require 'disk-usage)
+Warning: BSD and macOS users need `gdu`, the "GNU du" from the "GNU coreutils".
+
* Features
Run ~disk-usage~ or ~disk-usage-here~ to display a listing. See
~describe-mode~