summaryrefslogtreecommitdiffhomepage
path: root/email.org
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-04-27 00:53:59 +0100
committerjao <jao@gnu.org>2021-04-27 00:53:59 +0100
commit6bd8abb3b3a34cfaf916a38230227ed92beaa31c (patch)
tree6f663318749aa2fab2dba49e5180106eb189ae75 /email.org
parent0dcd8d2b99aca514733408c9ea4769d5e87af42a (diff)
downloadelibs-6bd8abb3b3a34cfaf916a38230227ed92beaa31c.tar.gz
elibs-6bd8abb3b3a34cfaf916a38230227ed92beaa31c.tar.bz2
minibuffer email notifications using notmuch
Diffstat (limited to 'email.org')
-rw-r--r--email.org64
1 files changed, 40 insertions, 24 deletions
diff --git a/email.org b/email.org
index 2d270ad..5da8c15 100644
--- a/email.org
+++ b/email.org
@@ -212,29 +212,6 @@
(global-set-key [(f8)] 'jao-frm)
#+end_src
-* maildirs
- #+begin_src emacs-lisp
- (defun jao-list-mailboxes (base)
- (let ((dir (expand-file-name base "~/var/mail")))
- (cl-remove-if (lambda (x)
- (member x '("." ".." "sent" "inbox" "trash")))
- (directory-files dir))))
-
- (defvar jao-maildir-maildirs nil)
- (defvar jao-maildir-tracked-maildirs nil)
- (use-package jao-maildir
- :config
- (defun jao-maildir--ensure-counts ()
- (when gnus-newsgroup-name
- (when (string-match "^nnimap.*:\\(.+\\)" gnus-newsgroup-name)
- (let ((mbox (format "/home/jao/var/mail/%s"
- (match-string 1 gnus-newsgroup-name))))
- (jao-maildir-update-info-string mbox)))))
- (with-eval-after-load "gnus-sum"
- (add-hook 'gnus-exit-group-hook #'jao-maildir--ensure-counts)))
-
- (jao-maildir-setup jao-maildir-maildirs jao-maildir-tracked-maildirs -20)
- #+end_src
* bbdb
#+begin_src emacs-lisp
(use-package bbdb
@@ -437,6 +414,40 @@
#+end_src
+*** minibuffer notifications
+ #+begin_src emacs-lisp
+ (defvar jao-notmuch-minibuffer-string "")
+
+
+ (defvar jao-notmuch-minibuffer-queries
+ '((:name "" :query "tag:new" :face jao-themes-f00)
+ (:name "B" :query "tag:new and tag:bigml and tag:inbox")
+ (:name "b" :query "tag:new and tag:bigml and tag:bugs"
+ :face jao-themes-error)
+ (:name "S" :query "tag:new and tag:bigml and tag:support")
+ (:name "W" :query "tag:new and tag:bigml" :face jao-themes-dimm)
+ (:name "I" :query "tag:new and tag:jao and tag:inbox")
+ (:name "J" :query "tag:new and tag:jao" :face jao-themes-dimm)
+ (:name "E" :query "tag:new and tag:feeds and tag:emacs"
+ :face jao-themes-dimm)
+ (:name "F" :query "tag:new and tag:feeds and not tag:emacs"
+ :face jao-themes-dimm)))
+
+ (defun jao-notmuch-update-minibuffer ()
+ (let ((cnts (notmuch-hello-query-counts jao-notmuch-minibuffer-queries)))
+ (setq jao-notmuch-minibuffer-string
+ (mapconcat (lambda (c)
+ (propertize (format "%s%s"
+ (plist-get c :name)
+ (plist-get c :count))
+ 'face (or (plist-get c :face) 'default)))
+ cnts
+ " "))
+ (jao-minibuffer-refresh)))
+
+ (jao-minibuffer-add-variable 'jao-notmuch-minibuffer-string -20)
+
+ #+end_src
*** searches
#+begin_src emacs-lisp
(defun jao-notmuch--and (frags)
@@ -505,7 +516,9 @@
(beginning-of-buffer)
(widget-forward 2)))
- :hook (notmuch-hello-refresh . jao--refresh-agenda)
+ :hook ((notmuch-hello-refresh . jao--refresh-agenda)
+ (notmuch-hello-refresh . jao-notmuch-update-minibuffer))
+
:bind (:map notmuch-hello-mode-map
(("g" . jao-notmuch-refresh-hello)
("S" . consult-notmuch)
@@ -741,6 +754,9 @@
tag_deleted "bigml.support$" 7d
tag_deleted "jao.(drivel|lists|books|think)" 3d
tag_deleted "feeds.+" 3d
+
+ XDG_RUNTIME_DIR='/run/user/1000' \
+ /usr/local/bin/emacsclient -e '(jao-notmuch-update-minibuffer)' > /dev/null
#+end_src
*** expire shell script
#+begin_src bash :tangle ./bin/notmuch-expire.sh :tangle-mode (identity #o755)