diff options
Diffstat (limited to 'custom/jao-custom-notmuch.el')
| -rw-r--r-- | custom/jao-custom-notmuch.el | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/custom/jao-custom-notmuch.el b/custom/jao-custom-notmuch.el index 96631fb..ee8872c 100644 --- a/custom/jao-custom-notmuch.el +++ b/custom/jao-custom-notmuch.el @@ -4,14 +4,6 @@ (defvar jao-notmuch-minibuffer-queries `((:name "" :query "tag:new and not tag:draft" :face jao-themes-f00) - (:name "B" :query "tag:new and tag:bigml and tag:inbox" :face default) - (:name "A" :query "tag:new and tag:alba" :face default) - (: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" :face default) - (:name "W" - :query "tag:new and tag:bigml and not tag:\"/support|bugs|inbox/\"" - :face default) (:name "I" :query "tag:new and tag:jao and tag:inbox" :face jao-themes-warning) (:name "W" :query "tag:new and tag:jao and tag:write" @@ -26,17 +18,30 @@ (:name "l" :query "tag:new and tag:local") (:name "F" :query "tag:new and tag:feeds and not tag:\"/emacs/\""))) +(defvar jao-notmuch-xbar-queries + `((:name "" :query "tag:new and not tag:draft" :face jao-themes-f00) + (:name "i" :query "tag:new and tag:/inbox|write|drivel/" + :face jao-themes-warning))) + +(defsubst jao-notmuch--qstr (c) + (format "%s%s" (plist-get c :name) (plist-get c :count))) + +(defun jao-notmuch-xbar () + (let ((cnts (notmuch-hello-query-counts jao-notmuch-xbar-queries))) + (jao-shell-exec (format "echo '%s | color=#8b3626 | size=11' >/tmp/xbar" + (mapconcat 'jao-notmuch--qstr cnts " "))))) + (defun jao-notmuch-notify () + (interactive) (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)) + (propertize (jao-notmuch--qstr c) 'face (or (plist-get c :face) 'jao-themes-dimm))) cnts " ")) + (jao-when-darwin (jao-notmuch-xbar)) (jao-minibuffer-refresh))) (when jao-notmuch-enabled @@ -87,13 +92,15 @@ (widget-insert (propertize title 'face 'jao-themes-f00)) (notmuch-hello-insert-buttons searches)))) -(defmacro jao-notmuch-def-searches (name searches) +(defmacro jao-notmuch-def-searches (name searches &optional no-save) (declare (indent 1)) (let ((name (and name (format "%s" name))) (id (intern (format "jao-notmuch-%s-searches" (or name (gensym)))))) `(progn (defvar ,id ,searches) (defun ,id () (jao-notmuch-hello--insert-searches ,id ,name)) - (setq notmuch-saved-searches (append notmuch-saved-searches ,id)) + ,@(unless no-save + `((setq notmuch-saved-searches + (append notmuch-saved-searches ,id)))) (add-to-list 'notmuch-hello-sections ',id t)))) (setq notmuch-hello-sections nil notmuch-saved-searches nil) @@ -142,7 +149,8 @@ '("philosophy" "math" "physics" "sci" "gr-qc" "quant-ph"))) (jao-notmuch-def-searches flags - (jao-notmuch-widen-searches notmuch-saved-searches " AND tag:flagged")) + (jao-notmuch-widen-searches notmuch-saved-searches " AND tag:flagged") + t) (jao-notmuch-def-searches nil `(,(jao-notmuch--q "bml" "flagged" "rb" '("tag:flagged" "tag:bigml")) @@ -190,7 +198,8 @@ '("new" "unread" "flagged" "signed" "sent" "attachment" "forwarded" "inbox" "encrypted" "gmane" "gnus" "feeds" "rss" "mce" "trove" "prog" "emacs")) -(setq notmuch-archive-tags '("+trove" "-new" "-drivel" "-words" "-inbox") +(setq notmuch-archive-tags + '("+trove" "-hacking" "-new" "-drivel" "-words" "-inbox") notmuch-show-mark-read-tags '("-new" "-unread") notmuch-tag-formats (let (;; (d `(:foreground ,(face-attribute 'jao-themes-dimm :foreground))) @@ -230,11 +239,7 @@ notmuch-always-prompt-for-sender t notmuch-draft-folder "drafts" notmuch-draft-quoted-tags '("part") - notmuch-fcc-dirs - '(("\\(support\\|education\\)@bigml.com" . nil) - ("mail@jao.io" . nil) - (".*@bigml.com" . "bigml -new -unread +sent +bigml") - (".*" . "jao -new -unread +sent +jao")) + notmuch-fcc-dirs '((".*" . "sent -new -unread +sent +jao")) notmuch-maildir-use-notmuch-insert t) :custom ((notmuch-address-internal-completion '(sent nil))) @@ -330,6 +335,7 @@ :bind (:map notmuch-hello-mode-map (("a" . jao-notmuch-refresh-agenda) + ("A" . jao-afio-open-mail) ("g" . jao-notmuch-refresh-hello) ("j" . jao-notmuch-jump-search) ("n" . jao-notmuch-hello-next) @@ -480,6 +486,7 @@ (defun jao-notmuch-before-tree (&rest _args) (when (string= (buffer-name) "*notmuch-hello*") (window-configuration-to-register ?G) + (when (< (frame-width) 230) (delete-other-windows)) (split-window-right 40) (other-window 1))) @@ -643,6 +650,9 @@ (with-eval-after-load "notmuch-hello" (define-key notmuch-hello-mode-map "f" #'jao-consult-notmuch-folder))) +;;; org +(when jao-notmuch-enabled (jao-notmuch-org-links)) + ;;; recoll (jao-when-linux (defun jao-notmuch-open-file (fname &optional _page) |
