From a0c179f036e923007dda13f19a92c8c025e7badc Mon Sep 17 00:00:00 2001 From: jao Date: Sun, 27 Feb 2022 20:25:35 +0000 Subject: notmuch tweaks and right justified counts --- lib/net/jao-notmuch.el | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'lib/net') diff --git a/lib/net/jao-notmuch.el b/lib/net/jao-notmuch.el index f057a55..72ca85b 100644 --- a/lib/net/jao-notmuch.el +++ b/lib/net/jao-notmuch.el @@ -226,11 +226,11 @@ (forward-line 1))) (when cnt (list total match cnt)))) -(defvar jao-notmuch-header-line-format "%S - %Q [%N / %M / %T] %n / %m / %t") +(defvar jao-notmuch-header-line-format "%Q [%N / %M / %T] %n / %m / %t") -(defun jao-notmuch--format-counts (sb query total match new ttotal tmatch tnew) +(defun jao-notmuch--format-counts (query total match new ttotal tmatch tnew) (format-spec jao-notmuch-header-line-format - `((?S . ,sb) (?Q . ,query) (?T . ,total) (?N . ,new) (?M . ,match) + `((?Q . ,query) (?T . ,total) (?N . ,new) (?M . ,match) (?t . ,ttotal) (?n . ,tnew) (?m . ,tmatch)))) (defun jao-notmuch--update-header-line (mb) @@ -239,11 +239,12 @@ (q (buffer-name))) (with-current-buffer mb (when (derived-mode-p 'notmuch-show-mode) - (let ((s (thread-last (notmuch-show-get-subject) - (notmuch-show-strip-re) - (notmuch-sanitize)))) - (setq-local header-line-format - (apply 'jao-notmuch--format-counts s q nc))))))) + (let* ((s (thread-last (notmuch-show-get-subject) + (notmuch-show-strip-re) + (notmuch-sanitize))) + (c (apply 'jao-notmuch--format-counts q nc)) + (n (max 1 (- (window-width) (string-width s) (string-width c))))) + (setq-local header-line-format (concat s (make-string n ? ) c))))))) (defun jao-notmuch-tree--find-update-header-line (&rest _args) (when-let ((mb (if (derived-mode-p 'notmuch-show-mode) -- cgit v1.2.3