summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-06-05 16:21:22 +0100
committerjao <jao@gnu.org>2021-06-05 16:21:22 +0100
commitd69ddfcedd879111af577ecedb1ad7e6b57a64a2 (patch)
tree40f246ae70cd865af2c965a3fbee6a261d703aa1
parent3b3faca3394fcac2613bccfdc84e4509a262630f (diff)
downloadelibs-d69ddfcedd879111af577ecedb1ad7e6b57a64a2.tar.gz
elibs-d69ddfcedd879111af577ecedb1ad7e6b57a64a2.tar.bz2
shuffling code around
-rw-r--r--email.org154
1 files changed, 78 insertions, 76 deletions
diff --git a/email.org b/email.org
index e1897e9..1795daf 100644
--- a/email.org
+++ b/email.org
@@ -273,6 +273,84 @@
(gnus-demon-scan-news)))))
#+end_src
* notmuch
+*** 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 "N" :query "tag:new and tag:gmane" :face jao-themes-dimm)
+ (:name "F" :query "tag:new and tag:feeds and not tag:emacs"
+ :face jao-themes-dimm)))
+
+ (defun jao-notmuch-notify ()
+ (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 (plist-get c :face)))
+ cnts
+ " "))
+ (jao-minibuffer-refresh)))
+
+ (when (eq jao-afio-mail-function 'notmuch)
+ (jao-minibuffer-add-variable 'jao-notmuch-minibuffer-string -20))
+ #+end_src
+*** searches
+ #+begin_src emacs-lisp
+ (setq notmuch-tree-result-format
+ '(("date" . "%12s ")
+ ("authors" . "%-35s")
+ ((("tree" . "%s ")("subject" . "%s")) . " %-100s")
+ ("tags" . " (%s)"))
+ notmuch-search-result-format
+ '(("date" . "%12s ")
+ ("count" . "%-7s ")
+ ("authors" . "%-35s")
+ ("subject" . "%-100s")
+ ("tags" . "(%s)"))
+ notmuch-unthreaded-result-format notmuch-tree-result-format)
+
+ (defun jao-notmuch--q (d0 d1 &optional k qs st)
+ (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 :search-type (or st 'tree)
+ :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 "gmane/emacs" nil "e"
+ '("tag:gmane" "tag:new" "List:emacs"))
+ ,(jao-notmuch--q "gmane" nil "g" '("tag:gmane" "tag:new"))
+ ,(jao-notmuch--q "bml/today" nil "tb" '("tag:bigml" "date:1d..") t)
+ ,(jao-notmuch--q "jao/today" nil "tj" '("tag:jao" "date:1d..") t)
+ ,(jao-notmuch--q "flagged" nil "r" '("tag:flagged") t)
+ ,(jao-notmuch--q "new" nil "n" '("tag:new"))
+ ,(jao-notmuch--q "draft" nil "d" '("tag:draft"))))
+ #+end_src
*** package
#+begin_src emacs-lisp
(use-package notmuch
@@ -340,48 +418,6 @@
:map notmuch-common-keymap
(("E" . jao-notmuch-open-enclosure))))
#+end_src
-*** searches
- #+begin_src emacs-lisp
- (setq notmuch-tree-result-format
- '(("date" . "%12s ")
- ("authors" . "%-35s")
- ((("tree" . "%s ")("subject" . "%s")) . " %-100s")
- ("tags" . " (%s)"))
- notmuch-search-result-format
- '(("date" . "%12s ")
- ("count" . "%-7s ")
- ("authors" . "%-35s")
- ("subject" . "%-100s")
- ("tags" . "(%s)"))
- notmuch-unthreaded-result-format notmuch-tree-result-format)
-
- (defun jao-notmuch--q (d0 d1 &optional k qs st)
- (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 :search-type (or st 'tree)
- :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 "gmane" nil "g" '("tag:gmane" "tag:new"))
- ,(jao-notmuch--q "bml/today" nil "tb" '("tag:bigml" "date:1d..") t)
- ,(jao-notmuch--q "jao/today" nil "tj" '("tag:jao" "date:1d..") t)
- ,(jao-notmuch--q "flagged" nil "r" '("tag:flagged") t)
- ,(jao-notmuch--q "new" nil "n" '("tag:new"))
- ,(jao-notmuch--q "draft" nil "d" '("tag:draft"))))
- #+end_src
*** tree view
#+begin_src emacs-lisp
(defvar-local jao-notmuch--tree-buffer nil)
@@ -535,40 +571,6 @@
(define-key message-mode-map (kbd "C-c C-d")
#'notmuch-draft-postpone)))
#+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 "N" :query "tag:new and tag:gmane" :face jao-themes-dimm)
- (:name "F" :query "tag:new and tag:feeds and not tag:emacs"
- :face jao-themes-dimm)))
-
- (defun jao-notmuch-notify ()
- (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 (plist-get c :face)))
- cnts
- " "))
- (jao-minibuffer-refresh)))
-
- (when (eq jao-afio-mail-function 'notmuch)
- (jao-minibuffer-add-variable 'jao-notmuch-minibuffer-string -20))
- #+end_src
*** consult
#+begin_src emacs-lisp
(use-package consult-notmuch