From 5d9c88fac8f341d483c1abb2e9918821a7780b21 Mon Sep 17 00:00:00 2001 From: 10sr <8.slashes@gmail.com> Date: Fri, 25 Oct 2019 13:42:48 +0900 Subject: [PATCH] Fix du --- emacs.el | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/emacs.el b/emacs.el index 48d59f5..454f9f2 100644 --- a/emacs.el +++ b/emacs.el @@ -1845,14 +1845,19 @@ ARG is num to show, or defaults to 7." (defun dired-get-file-info () "Print information of current line file." (interactive) - (let ((f (shell-quote-argument (dired-get-filename t)))) - (if (file-directory-p f) + (let* ((file (dired-get-filename t)) + (quoted (shell-quote-argument file))) + (if (file-directory-p file) (progn (message "Calculating disk usage...") - (shell-command (concat "du -hsD " - f))) + (let ((du (or (executable-find "gdu") + (executable-find "du") + (error "du not found")))) + (shell-command (concat du + " -hsD " + quoted)))) (shell-command (concat "file " - f))))) + quoted))))) (defun my-dired-scroll-up () "Scroll up."