branch: elpa/hyperdrive commit 80d68a03785a9d3b57f93a4f9237ef1cb5f914a2 Author: Joseph Turner <jos...@ushin.org> Commit: Joseph Turner <jos...@ushin.org>
Change: Replace -timestamp-width with -timestamp-format-string Also, use display space property to fill gaps. --- hyperdrive-dir.el | 6 ++++-- hyperdrive-history.el | 6 ++++-- hyperdrive-vars.el | 15 +++++++-------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/hyperdrive-dir.el b/hyperdrive-dir.el index d4e889327c..013ac73245 100644 --- a/hyperdrive-dir.el +++ b/hyperdrive-dir.el @@ -143,7 +143,7 @@ Columns are suffixed with up/down arrows according to 'mouse-face 'highlight) headers))) (concat prefix "\n" - (apply #'format (concat "%6s " hyperdrive-timestamp-format-string " %s") + (apply #'format (format "%%6s %%%ds %%s" hyperdrive-timestamp-width) (nreverse headers))))) (defun hyperdrive-dir-complete-sort () @@ -184,7 +184,9 @@ To be used as the pretty-printer for `ewoc-create'." 'default)) (timestamp (if mtime (format-time-string hyperdrive-timestamp-format mtime) - (format hyperdrive-timestamp-format-string " ")))) + (propertize " " + 'display + '(space :width hyperdrive-timestamp-width))))) (format "%6s %s %s" (propertize (or size "") 'face 'hyperdrive-size) diff --git a/hyperdrive-history.el b/hyperdrive-history.el index 27a04e2d38..74a08a5e2a 100644 --- a/hyperdrive-history.el +++ b/hyperdrive-history.el @@ -60,7 +60,9 @@ and whose cdr is a hyperdrive entry." (file-size-human-readable size))) (timestamp (if mtime (format-time-string hyperdrive-timestamp-format mtime) - (format hyperdrive-timestamp-format-string " ")))) + (propertize " " + 'display + '(space :width hyperdrive-timestamp-width))))) ;; FIXME: Use dynamic width of range column equal to 2N+1, where N ;; is the width of the hyperdrive's latest version (format "%7s %13s %6s %s" @@ -179,7 +181,7 @@ Universal prefix argument \\[universal-argument] forces (propertize "Exists?" 'face 'hyperdrive-column-header) (propertize "Version Range" 'face 'hyperdrive-column-header) (propertize "Size" 'face 'hyperdrive-column-header) - (format hyperdrive-timestamp-format-string + (format (format "%%%ds" hyperdrive-timestamp-width) (propertize "Last Modified" 'face 'hyperdrive-column-header))))) (queue) (ewoc)) (with-current-buffer (get-buffer-create diff --git a/hyperdrive-vars.el b/hyperdrive-vars.el index 3dd5e29173..f60aac7732 100644 --- a/hyperdrive-vars.el +++ b/hyperdrive-vars.el @@ -70,20 +70,19 @@ Defaults to `eww-download-directory'." :type '(file :must-match t)) -(defvar hyperdrive-timestamp-format-string) +(defvar hyperdrive-timestamp-width) (defcustom hyperdrive-timestamp-format "%x %X" "Format string used for timestamps. Passed to `format-time-string', which see." :type 'string :set (lambda (option value) (set-default option value) - (setf hyperdrive-timestamp-format-string - (format "%%%ds" - ;; FIXME: This value varies based on current - ;; time. (format-time-string "%-I") will - ;; be one or two characters long - ;; depending on the time of day - (string-width (format-time-string value)))))) + (setf hyperdrive-timestamp-width + ;; FIXME: This value varies based on current + ;; time. (format-time-string "%-I") will + ;; be one or two characters long + ;; depending on the time of day + (string-width (format-time-string value))))) (defcustom hyperdrive-directory-display-buffer-action '(display-buffer-same-window)