diff options
author | jao <jao@gnu.org> | 2021-04-20 04:38:35 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2021-04-20 04:38:35 +0100 |
commit | 81e017821c7e96b1cbc91f7cae4f001a530d2e36 (patch) | |
tree | 9867cc72926658dda22ca4800f48486d784e9ab1 | |
parent | 24cf5f411877a5340ab2bd1be51f711256ed44bd (diff) | |
download | elibs-81e017821c7e96b1cbc91f7cae4f001a530d2e36.tar.gz elibs-81e017821c7e96b1cbc91f7cae4f001a530d2e36.tar.bz2 |
fully functional notmuch
-rw-r--r-- | email.org | 81 |
1 files changed, 43 insertions, 38 deletions
@@ -197,12 +197,20 @@ * notmuch *** hello page #+begin_src emacs-lisp - (defun jao-notmuch--mboxes-search (box) - (mapcar (lambda (m) - `(:name ,(format "%s:%s" box m) - :search-type tree - :query ,(format "folder:%s/%s and tag:unread" box m))) - (jao-list-mailboxes box))) + (defun jao-notmuch--and (frags) + (when frags (mapconcat #'identity frags " AND "))) + + (defun jao-notmuch--q (d0 d1 &optional k qs) + (list :name (concat d0 (when d1 "/") d1) :search-type 'tree :key k + :query (or (jao-notmuch--and qs) + (format "folder:%s/%s and tag:unread" d0 d1)))) + + (defun jao-notmuch--mboxes-search (box &rest excluded) + (let ((ms (seq-difference (jao-list-mailboxes box) excluded)) + (bp (substring box 0 1))) + (mapcar `(lambda (m) + (jao-notmuch--q ,box (car m) (concat ,bp (cdr m)))) + (shorten-strings (sort ms #'string<))))) (defun jao--refresh-agenda () (save-window-excursion (org-agenda-list))) @@ -210,22 +218,14 @@ (add-hook 'notmuch-hello-refresh-hook #'jao--refresh-agenda)) (setq notmuch-saved-searches - `((:name "jao" :key "j" - :query "folder:jao/inbox" - :search-type tree - :count-query "folder:jao/inbox and tag:unread") - (:name "bigml" :key "b" - :count-query "folder:bigml/inbox and tag:unread" - :search-type tree - :query "folder:bigml/inbox") - ,@(jao-notmuch--mboxes-search "bigml") - ,@(jao-notmuch--mboxes-search "jao") + `(,(jao-notmuch--q "jao" "inbox" "ji") + ,(jao-notmuch--q "bigml" "inbox" "bi") + ,@(jao-notmuch--mboxes-search "bigml" "inbox" "deploys") + ,@(jao-notmuch--mboxes-search "jao" "inbox") ,@(jao-notmuch--mboxes-search "feeds") - (:name "feeds" :query "tag:new and tag:feeds and not tag:emacs" - :key "f" :search-type tree) - (:name "today" :key "t" :search-type tree - :query "tag:/support|inbox|bugs|bills|hacking/ and date:1d..") - (:name "new" :query "tag:new" :key "n" :search-type tree)) + ,(jao-notmuch--q "toread" nil "r" '("tag:toread")) + ,(jao-notmuch--q "bml/today" nil "tb" '("tag:bigml" "date:1d..")) + ,(jao-notmuch--q "jao/today" nil "tj" '("tag:jao" "date:1d.."))) notmuch-hello-sections '(notmuch-hello-insert-saved-searches notmuch-hello-insert-alltags notmuch-hello-insert-recent-searches @@ -315,14 +315,15 @@ "Reply-To" "X-Mailer" "User-Agent" "X-User-Agent") notmuch-message-headers jao-notmuch-message-headers - notmuch-show-mark-read-tags '("-new" "-unread") - notmuch-archive-tags '("+archive" "-new" "-unread") + notmuch-show-mark-read-tags '("-new" "-unread" "-toread") + notmuch-archive-tags '("+trove" "-new" "-unread" "-inbox") notmuch-tagging-keys '(("a" notmuch-archive-tags "Archive") ("d" notmuch-show-mark-read-tags "Mark read") ("u" ("+new" "+unread") "Mark unred read") ("f" ("+flagged") "Flag") - ("x" ("+expired" "-new" "-flagged" "-unread") "Expired")) + ("r" ("+toread") "Read later") + ("x" ("+deleted" "-new" "-flagged" "-unread") "Deleted")) notmuch-show-all-multipart/alternative-parts nil notmuch-show-indent-messages-width 2 notmuch-show-imenu-indent t @@ -340,11 +341,13 @@ ("subject" . "%-95s") ("tags" . "(%s)")) notmuch-unthreaded-result-format notmuch-tree-result-format + notmuch-wash-signature-lines-max 0 notmuch-wash-wrap-lines-length 80 notmuch-wash-citation-lines-prefix 10 notmuch-wash-citation-lines-suffix 20) :config - (setq mm-text-html-renderer 'shr) + + ;; (setq mm-text-html-renderer 'shr) (defun jao-mail-clean-address (fun address) (let ((address (if (string-match ".+ updates on arXiv.org: \\(.+\\)" @@ -363,14 +366,16 @@ notmuch-common-keymap (("T" . jao-notmuch-tree-tag) ("E" . jao-notmuch-open-enclosure) ("B" . jao-notmuch-browse-urls) - ("M-g" . jao-notmuch-follow-link)) + ("M-g" . jao-notmuch-follow-link) + ("k" . jao-notmuch-tag-jump) + ("j" . jao-notmuch-jump)) + :map notmuch-message-mode-map + (("C-c C-d" . notmuch-draft-postpone)) :map notmuch-show-mode-map (("h" . jao-notmuch-goto-index-buffer) - ("k" . jao-notmuch-tag-jump) ("C-c C-c" . jao-notmuch-goto-message-in-gnus)) :map notmuch-hello-mode-map - (("j" . jao-notmuch-jump) - ("S" . consult-notmuch)) + (("S" . consult-notmuch)) :map notmuch-tree-mode-map (("h" . jao-notmuch-goto-message-buffer) ("k" . jao-notmuch-tag-jump)))) @@ -416,10 +421,10 @@ #+begin_src bash :tangle ./bin/notmuch-tags.sh :tangle-mode (identity #o755) notmuch new > $HOME/var/log/notmuch.log 2>&1 - function tag_expired { - notmuch tag +expired -- \ + function tag_deleted { + notmuch tag +deleted -- \ "'folder:\"$1\"'" \ - AND date:..${2:-3d} AND NOT "tag:/flagged|unread|new/" + AND date:..${2:-3d} AND NOT "tag:/trove|flagged|unread|new/" } function tag_folder { @@ -436,15 +441,15 @@ tag_directory jao tag_directory feeds - tag_expired "/bigml.(drivel|lists|deploys|bugs)/" 3d - tag_expired "/bigml.reports/" 1d - tag_expired "/jao.(drivel|lists|books|think)/" 3d - tag_expired "/feeds.+/" 3d - tag_expired "/bigml.inbox$/" 1y + tag_deleted "/bigml.(drivel|lists|deploys|bugs)/" 3d + tag_deleted "/bigml.reports/" 1d + tag_deleted "/jao.(drivel|lists|books|think)/" 3d + tag_deleted "/feeds.+/" 3d + tag_deleted "/bigml.inbox$/" 1y #+end_src *** expire shell script #+begin_src bash :tangle ./bin/notmuch-expire.sh :tangle-mode (identity #o755) - notmuch search --output=files --format=text0 tag:expired | xargs -r0 rm + notmuch search --output=files --format=text0 tag:deleted | xargs -r0 rm notmuch new > $HOME/var/log/notmuch-expire.log 2>&1 notmuch compact >> $HOME/var/log/notmuch-expire.log 2>&1 #+end_src |