diff options
Diffstat (limited to 'lib/net')
| -rw-r--r-- | lib/net/jao-notmuch.el | 32 | 
1 files changed, 19 insertions, 13 deletions
| diff --git a/lib/net/jao-notmuch.el b/lib/net/jao-notmuch.el index 320dac7..ea8dc2a 100644 --- a/lib/net/jao-notmuch.el +++ b/lib/net/jao-notmuch.el @@ -265,18 +265,29 @@          (forward-line 1)))      (when cnt (list total match cnt)))) -(defvar jao-notmuch-tree-buffer-name-format "%Q [%N / %M / %T] %n / %m / %t") - -(defun jao-notmuch-tree--format-name (query total match new ttotal tmatch tnew) -  (format-spec jao-notmuch-tree-buffer-name-format -               `((?Q . ,query) (?T . ,total) (?N . ,new) (?M . ,match) +(defvar jao-notmuch-tree-buffer-name-format "%Q") +(defvar jao-notmuch-header-line-format "[%N / %M / %T] %n / %m / %t  -  %S") + +(defun jao-notmuch-tree--format-name (sb query total match new ttotal tmatch tnew) +  (format-spec (if sb +                   jao-notmuch-header-line-format +                 jao-notmuch-tree-buffer-name-format) +               `((?S . ,sb) (?Q . ,query) (?T . ,total) (?N . ,new) (?M . ,match)                   (?t . ,ttotal) (?n . ,tnew) (?m . ,tmatch)))) -(defun jao-notmuch--tree-update-buffer-name () +(defun jao-notmuch--update-header-line (q nc) +  (let ((s (thread-last (notmuch-show-get-subject) +                        (notmuch-show-strip-re) +                        (notmuch-sanitize)))) +    (setq-local header-line-format +                (apply 'jao-notmuch-tree--format-name s q nc)))) + +(defun jao-notmuch--tree-update-buffer-name (&optional mb)    (when-let* ((n (jao-notmuch--unread-counts))                (nc (append n (jao-notmuch--unread-counts t)))                (q (jao-notmuch--query-name))) -    (prog1 (rename-buffer (apply #'jao-notmuch-tree--format-name q nc)) +    (prog1 (rename-buffer (apply #'jao-notmuch-tree--format-name nil q nc)) +      (when mb (with-current-buffer mb (jao-notmuch--update-header-line q nc)))        (when (fboundp 'jao-minibuffer-refresh) (jao-minibuffer-refresh)))))  (defun jao-notmuch-tree--find-update-buffer-name (&rest _args) @@ -285,16 +296,11 @@                  (with-current-buffer b                    (and (derived-mode-p 'notmuch-tree-mode)                         (eq notmuch-tree-message-buffer mb) -                       (jao-notmuch--tree-update-buffer-name)))) +                       (jao-notmuch--tree-update-buffer-name mb))))                (buffer-list))))  (add-hook 'notmuch-after-tag-hook #'jao-notmuch-tree--find-update-buffer-name) -(defun jao-notmuch-echo-count () -  "Show the number of unread messages left in this tree view." -  (interactive) -  (message (jao-notmuch--tree-update-buffer-name))) -  ;;;; Outline mode for tree view | 
