From b2c3ae43cac9c31c24ca82000ba0d6999562a655 Mon Sep 17 00:00:00 2001 From: jao Date: Fri, 29 Apr 2022 02:52:56 +0100 Subject: mail nits --- gnus.org | 9 +++++---- init.org | 2 +- lib/net/jao-notmuch.el | 7 +++++-- notmuch.org | 30 ++++++++++++++++++++---------- 4 files changed, 31 insertions(+), 17 deletions(-) diff --git a/gnus.org b/gnus.org index eab7ab2..36ec6ff 100644 --- a/gnus.org +++ b/gnus.org @@ -126,7 +126,7 @@ (add-to-list 'gnus-search-expandable-keys "list") (cl-defmethod gnus-search-transform-expression ((engine gnus-search-notmuch) - (expr (head list))) + (expr (head list))) (format "List:%s" (gnus-search-transform-expression engine (cdr expr))))) (defun jao-gnus--notmuch-engine (prefix config) @@ -173,8 +173,9 @@ (setq mail-sources (when jao-gnus-use-nnml (cons '(file :path "/var/mail/jao") - (mapcar (lambda (d) `(maildir :path ,(concat d "/"))) - (directory-files "~/var/mail" t "[^\\.]")))) + (when (eq jao-afio-mail-function 'gnus) + (mapcar (lambda (d) `(maildir :path ,(concat d "/"))) + (directory-files "~/var/mail" t "[^\\.]"))))) gnus-message-archive-group nil nnml-get-new-mail t nnml-directory message-directory) @@ -182,7 +183,7 @@ (when jao-gnus-use-nnml (add-to-list 'gnus-secondary-select-methods - `(nnml "" ,(jao-gnus--notmuch-engine nnml-directory + `(nnml "" ,(jao-gnus--notmuch-engine "~/var/mail/gnus/" "notmuch.config")))) (defvar jao-gnus-nnml-group-params diff --git a/init.org b/init.org index 4a62ac0..dd5e15e 100644 --- a/init.org +++ b/init.org @@ -1746,7 +1746,7 @@ * Email #+begin_src emacs-lisp (setq jao-afio-mail-function 'notmuch) - (setq jao-afio-mail-function 'gnus) + ;; (setq jao-afio-mail-function 'gnus) (jao-load-org "email") #+end_src * PDFs and other docs diff --git a/lib/net/jao-notmuch.el b/lib/net/jao-notmuch.el index 72ca85b..53137be 100644 --- a/lib/net/jao-notmuch.el +++ b/lib/net/jao-notmuch.el @@ -243,8 +243,11 @@ (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))))))) + (n (- (window-width) 3 (string-width s) (string-width c))) + (s (if (< n 0) (substring s 0 (- n 4)) s)) + (n (if (< n 0) 5 (1+ n)))) + (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 4d255ff..ebbb0ff 100644 --- a/notmuch.org +++ b/notmuch.org @@ -95,13 +95,15 @@ `(,(jao-notmuch--qn "feeds" "prog" "fp" '("tag:prog" "not tag:\"/emacs/\""))))) - (defvar jao-notmuch-inbox-searches + (defvar jao-notmuch-bigml-searches `(,(jao-notmuch--q "bigml" "inbox" "bi") ,(jao-notmuch--q "bigml" "support" "bs") ,(jao-notmuch--q "bigml" "bugs" "bb") ,(jao-notmuch--q "bigml" "drivel" "bd") - ,(jao-notmuch--q "bigml" "lists" "bl") - ,(jao-notmuch--q "jao" "inbox" "ji") + ,(jao-notmuch--q "bigml" "lists" "bl"))) + + (defvar jao-notmuch-inbox-searches + `(,(jao-notmuch--q "jao" "inbox" "ji") ,(jao-notmuch--q "jao" "bills" "jb") ,(jao-notmuch--q "jao" "drivel" "jd") ,(jao-notmuch--q "jao" "mdk" "jm") @@ -119,6 +121,7 @@ (setq notmuch-saved-searches (append jao-notmuch-inbox-searches + jao-notmuch-bigml-searches jao-notmuch-feed-searches jao-notmuch-emacs-searches)) @@ -245,6 +248,9 @@ (defun jao-notmuch-hello-insert-inbox-searches () (jao-notmuch-hello--insert-searches jao-notmuch-inbox-searches "inbox")) + (defun jao-notmuch-hello-insert-bigml-searches () + (jao-notmuch-hello--insert-searches jao-notmuch-bigml-searches "bigml")) + (defun jao-notmuch-hello-insert-feeds-searches () (jao-notmuch-hello--insert-searches jao-notmuch-feed-searches "feeds")) @@ -270,14 +276,15 @@ (beginning-of-buffer) (widget-forward 1))) - (defun jao-notmuch-refresh-hello () - (interactive) + (defun jao-notmuch-refresh-hello (&optional agenda) + (interactive "P") (ignore-errors (when (and (string= "Mail" (jao-afio-current-frame)) (derived-mode-p 'notmuch-hello-mode)) (when (not (string-blank-p jao-notmuch-minibuffer-string)) (let ((notmuch-hello-auto-refresh nil)) (notmuch-hello))) - (jao-notmuch-hello-first)))) + (when agenda (jao-notmuch-refresh-agenda)) + (unless (widget-at) (jao-notmuch-hello-first))))) (defvar jao-notmuch-hello--sec-rx "^\\(\\[ [0-9]+\\|All tags:.+\\)") @@ -304,7 +311,8 @@ (use-package notmuch-hello :init (setq notmuch-column-control t - notmuch-hello-sections '(jao-notmuch-hello-insert-inbox-searches + notmuch-hello-sections '(jao-notmuch-hello-insert-bigml-searches + jao-notmuch-hello-insert-inbox-searches jao-notmuch-hello-insert-feeds-searches jao-notmuch-hello-insert-emacs-searches jao-notmuch-hello-insert-dynamic-searches @@ -375,7 +383,7 @@ notmuch-wash-citation-lines-prefix 10 notmuch-wash-citation-lines-suffix 20 notmuch-show-text/html-blocked-images "." - notmuch-show-header-line t) + notmuch-show-header-line " %s") :config @@ -436,7 +444,7 @@ `(("date" . "%12s ") ("authors" . "%-25s") (jao-notmuch-msg-ticks . ,jao-mails-regexp) - (jao-notmuch-tree-and-subject . "%>-80s") + (jao-notmuch-tree-and-subject . "%>-85s") (jao-notmuch-format-tags . " (%s)")) notmuch-unthreaded-result-format notmuch-search-result-format consult-notmuch-result-format @@ -464,12 +472,14 @@ (split-window-right 40) (other-window 1))) + (defvar jao-notmuch--visits 0) + (defun jao-notmuch-after-tree-quit (&optional both) (when (and (not (derived-mode-p 'notmuch-tree-mode 'notmuch-hello-mode)) (save-window-excursion (other-window -1) (derived-mode-p 'notmuch-hello-mode))) (delete-window) - (jao-notmuch-refresh-hello))) + (jao-notmuch-refresh-hello (zerop (mod (cl-incf jao-notmuch--visits) 10))))) (advice-add 'notmuch-tree :before #'jao-notmuch-before-tree) (advice-add 'notmuch-tree-quit :after #'jao-notmuch-after-tree-quit) -- cgit v1.2.3