emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/disk-usage 3ffaf8e 14/48: Fix header display


From: Stefan Monnier
Subject: [elpa] externals/disk-usage 3ffaf8e 14/48: Fix header display
Date: Tue, 19 Feb 2019 07:59:59 -0500 (EST)

branch: externals/disk-usage
commit 3ffaf8e47f2ba3bb1fb0486a1907638ffa229ba9
Author: Pierre Neidhardt <address@hidden>
Commit: Pierre Neidhardt <address@hidden>

    Fix header display
---
 disk-usage.el | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/disk-usage.el b/disk-usage.el
index b2d1ee3..e7bfbbf 100644
--- a/disk-usage.el
+++ b/disk-usage.el
@@ -143,16 +143,19 @@ This is slow but does not require any external process."
                        disk-usage--du-args path))
        (buffer-string))))))
 
-(defun disk-usage--set-format (total-size)
+(defun disk-usage--set-format (&optional total-size)
   (setq tabulated-list-format
         `[("Size"
            ,(if (eq disk-usage--format-size #'file-size-human-readable)
                 8
               12)
            ,disk-usage--sort . (:right-align t))
-          (,(format "Files totalling %sB (%s) in '%s'"
-                    total-size
-                    (file-size-human-readable total-size)
+          (,(format "Files %sin '%s'"
+                    (if total-size
+                        (format "totalling %sB (%s) "
+                                total-size
+                                (file-size-human-readable total-size))
+                      "")
                     default-directory)
            0 t)]))
 
@@ -161,6 +164,7 @@ This is slow but does not require any external process."
   ;; TODO: Set tabulated-list-entries to a function?
   (let ((listing (disk-usage--list directory)))
     (disk-usage--set-format (disk-usage--total listing))
+    (tabulated-list-init-header)
     (setq tabulated-list-entries
           (mapcar (lambda (e)
                     (list e (vector (number-to-string (aref e 0))
@@ -259,8 +263,7 @@ beings."
   ;; TODO: Option to display extra attributes and default column to sort.
   (setq tabulated-list-sort-key (cons "Size" 'flip))
   (setq tabulated-list-printer #'disk-usage--print-entry)
-  (add-hook 'tabulated-list-revert-hook 'disk-usage--refresh nil t)
-  (tabulated-list-init-header))
+  (add-hook 'tabulated-list-revert-hook 'disk-usage--refresh nil t))
 
 ;;;###autoload
 (defun disk-usage (&optional directory)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]