summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--attic/notmuch.org (renamed from notmuch.org)37
-rw-r--r--email.org106
-rw-r--r--gnus.org1
3 files changed, 99 insertions, 45 deletions
diff --git a/notmuch.org b/attic/notmuch.org
index 4cbc14f..59d9a06 100644
--- a/notmuch.org
+++ b/attic/notmuch.org
@@ -402,43 +402,6 @@
("U" . notmuch-unthreaded)
("z" . notmuch-search))))
#+end_src
-*** org mode integration
- Stolen and adapted from [[https://gist.github.com/fedxa/fac592424473f1b70ea489cc64e08911][Fedor Bezrukov]].
- #+begin_src emacs-lisp
- (with-eval-after-load "org"
- (with-eval-after-load "notmuch"
- (org-link-set-parameters "notmuch"
- :follow 'org-notmuch-open
- :store 'org-notmuch-store-link)
-
- (defun org-notmuch-open (id)
- "Visit the notmuch message or thread with id ID."
- (notmuch-show id))
-
- (defun org-notmuch-store-link ()
- "Store a link to a notmuch mail message."
- (case major-mode
- ((notmuch-show-mode notmuch-tree-mode)
- ;; Store link to the current message
- (let* ((id (notmuch-show-get-message-id))
- (link (concat "notmuch:" id))
- (description (format "Mail: %s"
- (notmuch-show-get-subject))))
- (org-store-link-props
- :type "notmuch"
- :link link
- :description description)))
- (notmuch-search-mode
- ;; Store link to the thread on the current line
- (let* ((id (notmuch-search-find-thread-id))
- (link (concat "notmuch:" id))
- (description (format "Mail: %s"
- (notmuch-search-find-subject))))
- (org-store-link-props
- :type "notmuch"
- :link link
- :description description)))))))
- #+end_src
*** expire shell script
#+begin_src bash :tangle ./bin/notmuch-expire.sh :tangle-mode (identity #o755)
notmuch search --output=files --format=text0 tag:deleted | xargs -r0 rm
diff --git a/email.org b/email.org
index 7dd6388..745fb07 100644
--- a/email.org
+++ b/email.org
@@ -266,13 +266,100 @@
(gnus-demon-scan-news)))))
#+end_src
* notmuch
-*** Local path
+*** package
#+begin_src emacs-lisp
- (jao-load-path "notmuch")
- (when (eq jao-afio-mail-function 'notmuch)
- (jao-load-org "notmuch"))
+ (use-package notmuch
+ :ensure t
+ :init
+ (setq notmuch-hello-sections '(notmuch-hello-insert-saved-searches
+ notmuch-hello-insert-alltags
+ notmuch-hello-insert-header)
+ notmuch-hello-thousands-separator ","
+ notmuch-show-all-tags-list t
+ notmuch-show-logo nil
+ notmuch-show-empty-saved-searches nil
+ notmuch-show-mark-read-tags '("-new" "-unread")
+ notmuch-archive-tags '("+trove" "-new" "-unread" "-flagged")
+ notmuch-fcc-dirs
+ '((".*@bigml.com" . "trove/bigml +bigml +sent -new")
+ (".*" . "trove/jao +jao +sent -new"))
+ notmuch-maildir-use-notmuch-insert t)
+ :bind (:map notmuch-hello-mode-map (("S" . consult-notmuch)
+ ("SPC" . widget-button-press))))
#+end_src
-*** Tag shell script
+*** searches
+ #+begin_src emacs-lisp
+ (setq notmuch-search-result-format
+ '(("date" . "%12s ")
+ ("count" . "%-7s ")
+ ("authors" . "%-35s")
+ ("subject" . "%-100s")
+ ("tags" . "(%s)")))
+
+ (defun jao-notmuch--q (d0 d1 &optional k qs)
+ (let ((q (or (when qs (mapconcat #'identity qs " AND "))
+ (format "folder:%s/%s and tag:unread" d0 d1))))
+ (list :name (concat d0 (when d1 "/") d1)
+ :key k :query q
+ :sort-order 'oldest-first)))
+
+ (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<)))))
+
+ (setq notmuch-saved-searches
+ `(,(jao-notmuch--q "bigml" "inbox" "bi")
+ ,@(jao-notmuch--mboxes-search "bigml" "inbox" "deploys")
+ ,(jao-notmuch--q "jao" "inbox" "ji")
+ ,@(jao-notmuch--mboxes-search "jao" "inbox")
+ ,@(jao-notmuch--mboxes-search "feeds")
+ ,(jao-notmuch--q "bml/today" nil "tb" '("tag:bigml" "date:1d.."))
+ ,(jao-notmuch--q "jao/today" nil "tj" '("tag:jao" "date:1d.."))
+ ,(jao-notmuch--q "flagged" nil "r" '("tag:flagged"))
+ ,(jao-notmuch--q "new" nil "n" '("tag:new"))
+ ,(jao-notmuch--q "draft" nil "d" '("tag:draft"))))
+ #+end_src
+*** org mode integration
+ Stolen and adapted from [[https://gist.github.com/fedxa/fac592424473f1b70ea489cc64e08911][Fedor Bezrukov]].
+ #+begin_src emacs-lisp
+ (with-eval-after-load "org"
+ (with-eval-after-load "notmuch"
+ (org-link-set-parameters "notmuch"
+ :follow 'org-notmuch-open
+ :store 'org-notmuch-store-link)
+
+ (defun org-notmuch-open (id)
+ "Visit the notmuch message or thread with id ID."
+ (notmuch-show id))
+
+ (defun org-notmuch-store-link ()
+ "Store a link to a notmuch mail message."
+ (case major-mode
+ ((notmuch-show-mode notmuch-tree-mode)
+ ;; Store link to the current message
+ (let* ((id (notmuch-show-get-message-id))
+ (link (concat "notmuch:" id))
+ (description (format "Mail: %s"
+ (notmuch-show-get-subject))))
+ (org-store-link-props
+ :type "notmuch"
+ :link link
+ :description description)))
+ (notmuch-search-mode
+ ;; Store link to the thread on the current line
+ (let* ((id (notmuch-search-find-thread-id))
+ (link (concat "notmuch:" id))
+ (description (format "Mail: %s"
+ (notmuch-search-find-subject))))
+ (org-store-link-props
+ :type "notmuch"
+ :link link
+ :description description)))))))
+ #+end_src
+*** tag shell script
#+begin_src bash :tangle ./bin/notmuch-tags.sh :tangle-mode (identity #o755)
notmuch new > $HOME/var/log/notmuch.log 2>&1
@@ -304,7 +391,10 @@
tag_deleted "feeds.+" 3d
notmuch tag +deleted +trash -new -unread -- "folder:trash and tag:new"
-
- # XDG_RUNTIME_DIR='/run/user/1000' \
- # /usr/local/bin/emacsclient -e '(jao-notmuch-update-minibuffer)' > /dev/null
+ #+end_src
+*** delete tagged shell script
+ #+begin_src bash :tangle ./bin/notmuch-expire.sh :tangle-mode (identity #o755)
+ 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
diff --git a/gnus.org b/gnus.org
index 4bca3f3..4e13dd1 100644
--- a/gnus.org
+++ b/gnus.org
@@ -359,6 +359,7 @@
(gnus-server-exit)
(message "Restarting all servers... done"))
+ (define-key gnus-group-mode-map "z" #'notmuch)
(define-key gnus-group-mode-map "Z" #'jao-gnus-restart-servers)
(define-key gnus-group-mode-map "Gg" #'consult-notmuch)
(define-key gnus-group-mode-map "GG" #'jao-consult-notmuch-folder)