summaryrefslogtreecommitdiffhomepage
path: root/email.org
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-06-12 02:38:18 +0100
committerjao <jao@gnu.org>2021-06-12 02:38:18 +0100
commitf9574199ab23403bcebf6c26ecd9de7f5c42da02 (patch)
treee2f9c6dd88d606162cc91f520a3c06fcdafde03e /email.org
parentfda1607760a996cb6fa3cbd860312bc3d43fb7f4 (diff)
downloadelibs-f9574199ab23403bcebf6c26ecd9de7f5c42da02.tar.gz
elibs-f9574199ab23403bcebf6c26ecd9de7f5c42da02.tar.bz2
mail things
Diffstat (limited to 'email.org')
-rw-r--r--email.org63
1 files changed, 44 insertions, 19 deletions
diff --git a/email.org b/email.org
index 2f62ca6..3b044a6 100644
--- a/email.org
+++ b/email.org
@@ -1,4 +1,5 @@
-#+property: header-args :lexical t :tangle yes :comments yes :results silent :shebang ";; -*- lexical-binding: t; -*-"
+#+property: header-args:emacs-lisp :lexical t :tangle yes :comments yes :results silent :shebang ";; -*- lexical-binding: t; -*-"
+#+property: header-args:bash :comments yes :shebang "#!/bin/bash" :tangle-mode (identity #o755)
#+title: email handling (message mode, bbdb, notmuch)
#+auto_tangle: t
@@ -251,7 +252,7 @@
#+begin_src emacs-lisp
(defun jao-list-mailboxes (base)
(let ((dir (expand-file-name base "~/var/mail")))
- (seq-difference (directory-files dir) '("." ".." "sent" "trash" "spam"))))
+ (seq-difference (directory-files dir) '("." ".." "trash" "spam"))))
#+end_src
* consult narrowing
#+begin_src emacs-lisp
@@ -411,8 +412,8 @@
notmuch-show-mark-read-tags '("-new" "-unread")
notmuch-archive-tags '("+trove" "-new")
notmuch-fcc-dirs
- '((".*@bigml.com" . "bigml/inbox +bigml +sent -new")
- (".*" . "jao/inbox +jao +sent -new"))
+ '((".*@bigml.com" . "bigml/sent +bigml +sent -new")
+ (".*" . "jao/sent +jao +sent -new"))
notmuch-maildir-use-notmuch-insert t
notmuch-message-headers '("Subject" "To" "Cc" "Date" "List-Id")
notmuch-wash-signature-lines-max 0
@@ -506,15 +507,15 @@
(defun jao-notmuch-toggle-mime-parts ()
(interactive)
(when (jao-notmuch-goto-message-buffer)
- (goto-char (point-min))
- (let ((notmuch-show-text/html-blocked-images nil)
- (shr-inhibit-images nil)
- (shr-blocked-images nil))
- (save-excursion
- (when (re-search-forward "\\[ multipart/alternative \\]" nil t)
- (while (forward-button 1 nil nil t)
- (notmuch-show-toggle-part-invisibility)))))
- (jao-notmuch-goto-index-buffer)))
+ (goto-char (point-min))
+ (let ((notmuch-show-text/html-blocked-images nil)
+ (shr-inhibit-images nil)
+ (shr-blocked-images nil))
+ (save-excursion
+ (when (re-search-forward "\\[ multipart/alternative \\]" nil t)
+ (while (forward-button 1 nil nil t)
+ (notmuch-show-toggle-part-invisibility)))))
+ (jao-notmuch-goto-index-buffer)))
(defun jao-notmuch-toggle-images ()
(interactive)
@@ -570,6 +571,10 @@
undelete
nil))
+ (defun jao-notmuch-tree-spam ()
+ (interactive)
+ (jao-notmuch-tree--tag-and-next '("+spam" "-new" "-unread") nil nil))
+
(defun jao-notmuch-tree-delete-thread ()
(interactive)
(jao-notmuch-tree--tag-and-next '("+deleted" "-new" "-unread") nil t))
@@ -629,13 +634,13 @@
("K" . jao-notmuch-tag-jump-and-next)
("k" . jao-notmuch-tree-read-thread)
("n" . jao-notmuch-tree-next)
+ ("s" . jao-notmuch-tree-spam)
("RET" . jao-notmuch-tree-show-or-scroll)
("SPC" . jao-notmuch-tree-scroll-or-next))
:map notmuch-show-mode-map
(("h" . jao-notmuch-goto-index-buffer))
:map notmuch-common-keymap
(("B" . jao-notmuch-browse-urls))))
-
#+end_src
*** hydras
#+begin_src emacs-lisp
@@ -770,7 +775,7 @@
:description description)))))))
#+end_src
*** tag shell script
- #+begin_src bash :shebang "#!/bin/bash" :tangle ./bin/notmuch-tags.sh :tangle-mode (identity #o755)
+ #+begin_src bash :tangle ./bin/notmuch-tags.sh
notmuch new > $HOME/var/log/notmuch.log 2>&1
function tag_folder {
@@ -791,6 +796,8 @@
tag_directory jao
tag_directory feeds
+ notmuch tag -new -unread -- tag:spam
+
nbml="tag:new AND tag:bigml AND"
notmuch tag +bug -lists -drivel \
@@ -813,7 +820,7 @@
tag_list feeds Lobsters +programming -lists
#+end_src
*** move shell script
- #+begin_src bash :shebang "#!/bin/bash" :tangle ./bin/notmuch-move.sh :tangle-mode (identity #o755)
+ #+begin_src bash :tangle ./bin/notmuch-move.sh
# Move a message file while removing its UID-part
function safe_move { s=${1##*/}; s=${s%%,*}; mv -f $1 $2/$s; }
function move_spam {
@@ -828,7 +835,7 @@
notmuch new >/dev/null
#+end_src
*** expiry shell script
- #+begin_src bash :shebang "#!/bin/bash" :tangle ./bin/notmuch-expire.sh :tangle-mode (identity #o755)
+ #+begin_src bash :tangle ./bin/notmuch-expire.sh
spared_tags="tag:\"/^(trove|new|flagged|unread|draft|gmane)$/\""
function tag_deleted {
@@ -840,15 +847,33 @@
tag_deleted "tag:bigml AND tag:support" 7d
tag_deleted "tag:jao and tag:\"/^(drivel|lists|books|think|local)$/\"" 3d
tag_deleted "tag:feeds" 3d
- tag_deleted "tag:spam and folder:/spam/" 3d
+ tag_deleted "tag:\"/^(spam|trash)$/\" and folder:\"/(spam|trash)$/\"" 3d
notmuch new > $HOME/var/log/notmuch-expire.log 2>&1
notmuch compact >> $HOME/var/log/notmuch-expire.log 2>&1
#+end_src
*** delete shell script
- #+begin_src bash :shebang "#!/bin/bash" :tangle ./bin/notmuch-delete.sh :tangle-mode (identity #o755)
+ #+begin_src bash :tangle ./bin/notmuch-delete.sh
notmuch search --output=files --format=text0 tag:deleted | xargs -r0 rm
notmuch new > $HOME/var/log/notmuch-delete.log 2>&1
notmuch compact >> $HOME/var/log/notmuch-delete.log 2>&1
#+end_src
+*** cron fetcher
+ #+begin_src bash :tangle ./bin/mail.sh
+ minute=$(date +%_M)
+ hour=$(date +%k)
+
+ mbs=/usr/local/bin/mbsync
+ $mbs jao > $HOME/var/log/mbsync.jao.log
+ $mbs bml > $HOME/var/log/mbsync.bml.log
+
+ $HOME/bin/notmuch-tags.sh
+ $HOME/bin/notmuch-move.sh
+
+ [[ $minute -gt 5 ]] || $HOME/bin/notmuch-expire.sh
+ [[ $(($hour % 12)) -eq 0 && $minute -lt 5 ]] && $HOME/bin/notmuch-delete.sh
+
+ XDG_RUNTIME_DIR='/run/user/1000' \
+ /usr/local/bin/emacsclient -e '(jao-notmuch-notify)' > /dev/null
+ #+end_src