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