summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-01-08 02:31:50 +0000
committerjao <jao@gnu.org>2022-01-08 03:54:59 +0000
commit291b184b5e88a294620dd7c4a5537716b661942b (patch)
treecab349806e20b341a3164bb863106957829b7087 /lib
parentb4f72844281ca33161f758b4fbd44c048bfc51fc (diff)
downloadelibs-291b184b5e88a294620dd7c4a5537716b661942b.tar.gz
elibs-291b184b5e88a294620dd7c4a5537716b661942b.tar.bz2
notmuch: message counts in header line
Diffstat (limited to 'lib')
-rw-r--r--lib/net/jao-notmuch.el32
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