diff options
-rw-r--r-- | lib/net/jao-notmuch.el | 17 | ||||
-rw-r--r-- | notmuch.org | 39 |
2 files changed, 30 insertions, 26 deletions
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) diff --git a/notmuch.org b/notmuch.org index e2a4052..236c9a3 100644 --- a/notmuch.org +++ b/notmuch.org @@ -20,7 +20,7 @@ (:name "J" :query "tag:new and tag:jao and not tag:\"/local|hacking|draft|inbox/\"" :face default) - (:name "H" :query "tag:new and tag:jao and tag:hacking") + (:name "H" :query "tag:new and tag:hacking and not tag:\"/emacs/\"") (:name "E" :query "tag:new and tag:\"/emacs/\"") (:name "l" :query "tag:new and tag:local") (:name "F" :query "tag:new and tag:feeds and not tag:\"/emacs/\""))) @@ -123,18 +123,19 @@ jao-notmuch-emacs-searches)) (defvar jao-notmuch-dynamic-searches - `(,(jao-notmuch--q "jao" "draft" "d" '("tag:draft")) - ,(jao-notmuch--q "bml" "today" "tb" '("tag:bigml" "date:24h..")) + `(,(jao-notmuch--q "bml" "today" "tb" '("tag:bigml" "date:24h..")) + ,(jao-notmuch--q "bml" "flagged" "rb" '("tag:flagged" "tag:bigml")) ,(jao-notmuch--q "jao" "today" "tj" '("tag:jao" "date:24h.." "not tag:\"/(feeds|spam|local)/\"")) - ,(jao-notmuch--q "bml" "flagged" "rb" '("tag:flagged" "tag:bigml")) - ,(jao-notmuch--q "bml" "todo" "btt" '("tag:todo" "tag:bigml")) ,(jao-notmuch--q "jao" "flagged" "rj" '("tag:flagged" "tag:jao")) - ,(jao-notmuch--q "jao" "todo" "jt" '("tag:todo" "not tag:bigml")) - ,(jao-notmuch--q "feeds" "flagged" "rf" '("tag:flagged" "tag:feeds")) - ,(jao-notmuch--q "new" nil "nn" '("tag:new" "not tag:draft")) - ,(jao-notmuch--q "unread" nil "nu" '("tag:unread")))) + ,(jao-notmuch--q "jao" "drafts" "d" '("tag:draft")) + ,(jao-notmuch--q "feeds" "flagged" "rf" '("tag:flagged" "tag:feeds")))) + + (defvar jao-notmuch-new-searches + `(,(jao-notmuch--q "new" nil "nn" '("tag:new" "not tag:draft")) + ,(jao-notmuch--q "unread" nil "nu" '("tag:unread")) + (:query "*" :name "messages"))) (defun jao-notmuch-tree-widen-search () (interactive) @@ -203,8 +204,8 @@ notmuch-address-internal-completion '(received nil) notmuch-fcc-dirs '(("\\(support\\|education\\)@bigml.com" . nil) - (".*@bigml.com" . "bigml/sent +bigml +sent -new") - (".*" . "jao/trove +jao +sent +trove -new")) + (".*@bigml.com" . "bigml +bigml +sent -new -unread") + (".*" . "jao +jao +sent +trove -new -unread")) notmuch-maildir-use-notmuch-insert t) :config @@ -229,10 +230,12 @@ #+begin_src emacs-lisp (defun jao-notmuch-hello--insert-searches (searches title) (when-let (searches (notmuch-hello-query-counts searches)) - (let* ((cnt (seq-reduce (lambda (c q) (+ c (or (plist-get q :count) 0))) - searches - 0)) - (title (format "[ %d %s ]\n\n" cnt title))) + (let* ((cnt (when title + (seq-reduce (lambda (c q) + (+ c (or (plist-get q :count) 0))) + searches + 0))) + (title (if title (format "[ %d %s ]\n\n" cnt title) "\n"))) (widget-insert (propertize title 'face 'jao-themes-f00)) (let ((notmuch-column-control 1.0) (start (point))) @@ -249,7 +252,8 @@ (jao-notmuch-hello--insert-searches jao-notmuch-emacs-searches "emacs")) (defun jao-notmuch-hello-insert-dynamic-searches () - (jao-notmuch-hello--insert-searches jao-notmuch-dynamic-searches "dynamic")) + (jao-notmuch-hello--insert-searches jao-notmuch-dynamic-searches "dynamic") + (jao-notmuch-hello--insert-searches jao-notmuch-new-searches nil)) (defun jao-notmuch-refresh-agenda () (interactive) @@ -304,8 +308,7 @@ jao-notmuch-hello-insert-feeds-searches jao-notmuch-hello-insert-emacs-searches jao-notmuch-hello-insert-dynamic-searches - notmuch-hello-insert-alltags - notmuch-hello-insert-header) + notmuch-hello-insert-alltags) notmuch-hello-hide-tags nil notmuch-hello-thousands-separator "," notmuch-hello-auto-refresh t |