branch: elpa/hyperdrive commit 8bf9c94886d0912f8e52db909de64f8a877d3b97 Author: Joseph Turner <jos...@ushin.org> Commit: Joseph Turner <jos...@ushin.org>
Change: (h/dir--format-entry) Faces for download state --- hyperdrive-dir.el | 16 ++++++++++++---- hyperdrive-vars.el | 9 +++++++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/hyperdrive-dir.el b/hyperdrive-dir.el index 2dd6b622d8..09679b503a 100644 --- a/hyperdrive-dir.el +++ b/hyperdrive-dir.el @@ -160,16 +160,24 @@ To be used as the pretty-printer for `ewoc-create'." (defun h/dir--format-entry (entry) "Return ENTRY formatted as a string." (pcase-let* - (((cl-struct hyperdrive-entry size mtime) entry) + (((cl-struct hyperdrive-entry size mtime etc) entry) (size (and size (file-size-human-readable size))) (directoryp (h//entry-directory-p entry)) (face (if directoryp 'h/directory 'default)) (timestamp (if mtime (format-time-string h/timestamp-format mtime) - (propertize " " 'display '(space :width h/timestamp-width))))) + (propertize " " 'display '(space :width h/timestamp-width)))) + ((map block-length block-length-downloaded) etc)) (format "%6s %s %s" - (propertize (or size "") - 'face 'h/size) + (propertize + (or size "") + 'face (and block-length-downloaded block-length + (pcase block-length-downloaded + (0 'h/size-not-downloaded) + ((pred (= block-length)) 'h/size-fully-downloaded) + (_ 'h/size-partially-downloaded))) + 'help-echo (format "%s of %s blocks downloaded" + block-length-downloaded block-length)) (propertize timestamp 'face 'h/timestamp) (propertize (or (alist-get 'display-name (he/etc entry)) diff --git a/hyperdrive-vars.el b/hyperdrive-vars.el index 8102ffdb74..12daf19ac6 100644 --- a/hyperdrive-vars.el +++ b/hyperdrive-vars.el @@ -314,6 +314,15 @@ value (and should only be present once in the string). Used in (defface h/size '((t (:inherit font-lock-doc-face))) "File sizes.") +(defface h/size-fully-downloaded '((t (:inherit success))) + "File sizes for entries which have been fully downloaded.") + +(defface h/size-not-downloaded '((t (:inherit error))) + "File sizes for entries which have not been downloaded.") + +(defface h/size-partially-downloaded '((t (:inherit warning))) + "File sizes for entries which have been partially downloaded.") + (defface h/timestamp '((t (:inherit default))) "Entry timestamp.")