diff options
author | jao <jao@gnu.org> | 2022-01-08 02:31:50 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2022-01-08 03:54:59 +0000 |
commit | 291b184b5e88a294620dd7c4a5537716b661942b (patch) | |
tree | cab349806e20b341a3164bb863106957829b7087 | |
parent | b4f72844281ca33161f758b4fbd44c048bfc51fc (diff) | |
download | elibs-291b184b5e88a294620dd7c4a5537716b661942b.tar.gz elibs-291b184b5e88a294620dd7c4a5537716b661942b.tar.bz2 |
notmuch: message counts in header line
-rw-r--r-- | lib/net/jao-notmuch.el | 32 | ||||
-rw-r--r-- | notmuch.org | 9 |
2 files changed, 23 insertions, 18 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 diff --git a/notmuch.org b/notmuch.org index 467b915..781a718 100644 --- a/notmuch.org +++ b/notmuch.org @@ -201,8 +201,7 @@ '(("\\(support\\|education\\)@bigml.com" . nil) (".*@bigml.com" . "bigml/sent +bigml +sent -new") (".*" . "jao/trove +jao +sent +trove -new"))) - (notmuch-maildir-use-notmuch-insert t) - (notmuch-message-headers '("Subject" "To" "Cc" "Date" "List-Id"))) + (notmuch-maildir-use-notmuch-insert t)) :config @@ -331,6 +330,7 @@ (use-package notmuch-show :init (setq gnus-blocked-images "." + notmuch-message-headers '("To" "Cc" "Date" "List-Id") notmuch-show-only-matching-messages t notmuch-show-part-button-default-action 'notmuch-show-view-part notmuch-wash-signature-lines-max 0 @@ -342,8 +342,8 @@ :config (advice-add 'notmuch-clean-address :filter-args #'jao-mail-clean-address) - (defun jao-notmuch-show-setup () (setq header-line-format nil)) - (add-hook 'notmuch-show-hook #'jao-notmuch-show-setup) + ;; (defun jao-notmuch-show-setup () (setq header-line-format nil)) + ;; (add-hook 'notmuch-show-hook #'jao-notmuch-show-setup) (jao-notmuch-show-prefer-html) :bind @@ -426,7 +426,6 @@ :bind (:map notmuch-tree-mode-map (("b" . jao-notmuch-browse-urls) - ("C" . jao-notmuch-echo-count) ("d" . jao-notmuch-tree-toggle-delete) ("D" . jao-notmuch-tree-toggle-delete-thread) ("h" . jao-notmuch-goto-message-buffer) |