Update mu4e config for new version

This commit is contained in:
Jeremy Dormitzer 2023-04-27 15:00:44 -04:00
parent 435b1cfb0e
commit 293281eaca

View File

@ -1,9 +1,9 @@
;; Email in Emacs via mu4e ;; Email in Emacs via mu4e
(use-package mu4e (use-package mu4e
;; mu4e is not actually built-in, but it is installed outside of normal Emacs package management :straight (:host github :repo "djcb/mu" :files ("mu4e/*"))
:straight (:type built-in)
:if (locate-library "mu4e") :if (locate-library "mu4e")
:commands (mu4e mu4e-update-mail-and-index) :commands (mu4e mu4e-update-mail-and-index)
:hook (after-init . (lambda () (mu4e t)))
:general :general
(normal mu4e-headers-mode-map "t" #'mu4e-headers-mark-thread) (normal mu4e-headers-mode-map "t" #'mu4e-headers-mark-thread)
(normal mu4e-view-mode-map "t" #'mu4e-view-mark-thread) (normal mu4e-view-mode-map "t" #'mu4e-view-mark-thread)
@ -25,17 +25,17 @@
("View in browser" . mu4e-action-view-in-browser)) ("View in browser" . mu4e-action-view-in-browser))
;; Bookmarked searches ;; Bookmarked searches
mu4e-bookmarks '((:name "Inbox" mu4e-bookmarks '((:name "Inbox"
:query "maildir:/jeremy-dormitzer-gmail-com/Inbox OR maildir:/jdormitzer-spotify-com/Inbox" :query "maildir:/jeremy-dormitzer-gmail-com/Inbox OR maildir:/jdormitzer-spotify-com/Inbox"
:key ?i) :key ?i)
(:name "Unread messages" (:name "Unread messages"
:query "flag:unread AND NOT flag:trashed" :query "flag:unread AND NOT flag:trashed"
:key ?u) :key ?u)
(:name "Today's messages" (:name "Today's messages"
:query "date:today..now" :query "date:today..now"
:key ?t) :key ?t)
(:name "Last 7 days" (:name "Last 7 days"
:query "date:7d..now" :query "date:7d..now"
:key ?p)) :key ?p))
;; Getting mail ;; Getting mail
mu4e-get-mail-command "mbsync -a" mu4e-get-mail-command "mbsync -a"
;; Sending mail ;; Sending mail
@ -49,31 +49,16 @@
;; HTML email rendering ;; HTML email rendering
shr-use-colors nil shr-use-colors nil
;; Make sure mu4e knows about my different accounts ;; Make sure mu4e knows about my different accounts
mu4e-context-policy 'ask mu4e-context-policy 'pick-first
mu4e-compose-context-policy 'ask mu4e-compose-context-policy 'ask
mu4e-contexts mu4e-contexts
`(,(make-mu4e-context `(,(make-mu4e-context
:name "Personal Gmail"
:match-func (lambda (msg)
(when msg
(string-match-p
"jeremy-dormitzer-gmail-com"
(mu4e-message-field msg :path))))
:vars '((user-mail-address . "jeremy.dormitzer@gmail.com")
(mu4e-compose-signature . nil)
(mu4e-sent-folder . "/jeremy-dormitzer-gmail-com/Sent")
(mu4e-drafts-folder . "/jeremy-dormitzer-gmail-com/Drafts")
(mu4e-refile-folder . "/jeremy-dormitzer-gmail-com/Archive")
(mu4e-trash-folder . "/jeremy-dormitzer-gmail-com/Trash")
(message-sendmail-extra-arguments
. ("-a" "jeremy-dormitzer-gmail-com"))))
,(make-mu4e-context
:name "Spotify Gmail" :name "Spotify Gmail"
:match-func (lambda (msg) :match-func (lambda (msg)
(when msg (when msg
(string-match-p (string-match-p
"jdormitzer-spotify-com" "jdormitzer-spotify-com"
(mu4e-message-field msg :path)))) (mu4e-message-field msg :path))))
:vars '((user-mail-address . "jdormitzer@spotify.com") :vars '((user-mail-address . "jdormitzer@spotify.com")
(mu4e-compose-signature . nil) (mu4e-compose-signature . nil)
(mu4e-sent-folder . "/jdormitzer-spotify-com/Sent") (mu4e-sent-folder . "/jdormitzer-spotify-com/Sent")
@ -81,7 +66,22 @@
(mu4e-refile-folder . "/jdormitzer-spotify-com/Archive") (mu4e-refile-folder . "/jdormitzer-spotify-com/Archive")
(mu4e-trash-folder . "/jdormitzer-spotify-com/Trash") (mu4e-trash-folder . "/jdormitzer-spotify-com/Trash")
(message-sendmail-extra-arguments (message-sendmail-extra-arguments
. ("-a" "jdormitzer-spotify-com")))))) . ("-a" "jdormitzer-spotify-com"))))
,(make-mu4e-context
:name "Personal Gmail"
:match-func (lambda (msg)
(when msg
(string-match-p
"jeremy-dormitzer-gmail-com"
(mu4e-message-field msg :path))))
:vars '((user-mail-address . "jeremy.dormitzer@gmail.com")
(mu4e-compose-signature . nil)
(mu4e-sent-folder . "/jeremy-dormitzer-gmail-com/Sent")
(mu4e-drafts-folder . "/jeremy-dormitzer-gmail-com/Drafts")
(mu4e-refile-folder . "/jeremy-dormitzer-gmail-com/Archive")
(mu4e-trash-folder . "/jeremy-dormitzer-gmail-com/Trash")
(message-sendmail-extra-arguments
. ("-a" "jeremy-dormitzer-gmail-com"))))))
;; Custom mark function to mark messages matching the current message ;; Custom mark function to mark messages matching the current message
(defun mu4e-mark-matching-from-pred (msg from) (defun mu4e-mark-matching-from-pred (msg from)
(mu4e-message-contact-field-matches msg :from from)) (mu4e-message-contact-field-matches msg :from from))
@ -109,7 +109,7 @@
(lambda (lambda
(msg date) (msg date)
(time-less-p date (time-less-p date
(mu4e-msg-field msg :date))) (mu4e-msg-field msg :date)))
(lambda nil (lambda nil
(mu4e-get-time-date "Match messages after: "))) (mu4e-get-time-date "Match messages after: ")))
("Bigger than" ("Bigger than"
@ -242,13 +242,13 @@ string."
(if (not (equal (assoc-mml-node 'type node) "text/plain")) (if (not (equal (assoc-mml-node 'type node) "text/plain"))
acc acc
`(part (type . "text/plain") `(part (type . "text/plain")
(contents . ,(concat (cdaddr acc) (contents . ,(concat (cdaddr acc)
(cdaddr node)))))) (cdaddr node))))))
parsed parsed
:initial-value '(part (type . "text/plain") :initial-value '(part (type . "text/plain")
(contents . "")))) (contents . ""))))
(html `(part (type . "text/html") (html `(part (type . "text/html")
(contents . ,(gfm->html (cdaddr plain))))) (contents . ,(gfm->html (cdaddr plain)))))
(inline (nreverse (inline (nreverse
(cl-reduce (cl-reduce
(lambda (acc node) (lambda (acc node)