231 lines
8.5 KiB
EmacsLisp
231 lines
8.5 KiB
EmacsLisp
;; mu4e
|
|
(setf mu4e-mu-version "1.12.8")
|
|
|
|
(set-email-account! "admin@studyoftime.org"
|
|
'((mu4e-sent-folder . "/admin@studyoftime.org/Sent")
|
|
(mu4e-drafts-folder . "/admin@studyoftime.org/Drafts")
|
|
(mu4e-trash-folder . "/admin@studyoftime.org/Trash")
|
|
(mu4e-refile-folder . "/admin@studyoftime.org/Archive")
|
|
(mu4e-spam-folder . "/admin@studyoftime.org/Spam")
|
|
(smtpmail-smtp-user . "admin@studyoftime.org")
|
|
(user-mail-address . "admin@studyoftime.org") ;; only needed for mu < 1.4
|
|
(smtpmail-default-smtp-server . "smtp.dreamhost.com")
|
|
(smtpmail-smtp-server . "smtp.dreamhost.com")
|
|
(smtpmail-local-domain . "dreamhost.com"))
|
|
t)
|
|
|
|
;; last account listed is default
|
|
(set-email-account! "matt@emenel.ca"
|
|
'((mu4e-sent-folder . "/matt@emenel.ca/Sent")
|
|
(mu4e-drafts-folder . "/matt@emenel.ca/Drafts")
|
|
(mu4e-trash-folder . "/matt@emenel.ca/Trash")
|
|
(mu4e-refile-folder . "/matt@emenel.ca/Archive")
|
|
(mu4e-spam-folder . "/matt@emenel.ca/Spam")
|
|
(smtpmail-smtp-user . "matt@emenel.ca")
|
|
(user-mail-address . "matt@emenel.ca") ;; only needed for mu < 1.4
|
|
(smtpmail-default-smtp-server . "smtp.fastmail.com")
|
|
(smtpmail-smtp-server . "smtp.fastmail.com")
|
|
(smtpmail-local-domain . "fastmail.com"))
|
|
t)
|
|
|
|
(defun message-insert-signature-at-point ()
|
|
"Insert signature at point."
|
|
(interactive)
|
|
(setq message-signature "Matt Nish-Lapidus\nhttps://emenel.ca")
|
|
(save-restriction
|
|
(narrow-to-region (point) (point))
|
|
(message-insert-signature)
|
|
(newline))
|
|
(setq message-signature nil))
|
|
|
|
(defun mu4e-view-save-all-attachments (&optional arg)
|
|
"Save all MIME parts from currsent mu4e gnus view buffer."
|
|
;; Copied from mu4e-view-save-attachments
|
|
(interactive "P")
|
|
(cl-assert (and (eq major-mode 'mu4e-view-mode)
|
|
(derived-mode-p 'gnus-article-mode)))
|
|
(let* ((msg (mu4e-message-at-point))
|
|
(id (cleanse-subject (mu4e-message-field msg :subject)))
|
|
(attachdir (concat bulk-saved-attachments-dir "/" id))
|
|
(parts (mu4e--view-gather-mime-parts))
|
|
(handles '())
|
|
(files '())
|
|
dir)
|
|
(mkdir attachdir t)
|
|
(dolist (part parts)
|
|
(let ((fname (or
|
|
(cdr (assoc 'filename (assoc "attachment" (cdr part))))
|
|
(seq-find #'stringp
|
|
(mapcar (lambda (item) (cdr (assoc 'name item)))
|
|
(seq-filter 'listp (cdr part)))))))
|
|
(when fname
|
|
(push `(,fname . ,(cdr part)) handles)
|
|
(push fname files))))
|
|
(if files
|
|
(progn
|
|
(setq dir
|
|
(if arg (read-directory-name "Save to directory: ")
|
|
attachdir))
|
|
(cl-loop for (f . h) in handles
|
|
when (member f files)
|
|
do (mm-save-part-to-file h
|
|
(sje-next-free
|
|
(expand-file-name f dir)))))
|
|
(mu4e-message "No attached files found"))))
|
|
|
|
|
|
(use-package! consult-mu
|
|
:defer-incrementally mu4e
|
|
:custom
|
|
(consult-mu-maxnum 200)
|
|
;;show preview when pressing any keys
|
|
(consult-mu-preview-key 'any)
|
|
(consult-mu-mark-previewed-as-read nil)
|
|
;;mark email as read when selected.
|
|
;; (consult-mu-mark-viewed-as-read t)
|
|
(consult-mu-use-wide-reply t)
|
|
|
|
(consult-mu-headers-template (lambda () (concat "%f" (number-to-string (floor (* (frame-width) 0.15))) "%s" (number-to-string (floor (* (frame-width) 0.5))) "%d13" "%g" "%x")))
|
|
(consult-mu-action #'consult-mu--view-action)
|
|
|
|
:config
|
|
(setq consult-mu-saved-searches-dynamics '("#flag:unread"))
|
|
(setq consult-mu-saved-searches-async '("#flag:unread"))
|
|
;; require embark actions for marking, replying, forwarding, etc. directly from minibuffer
|
|
(require 'consult-mu-embark)
|
|
;; require extra module for composing (e.g. for interactive attachment) as well as embark actions
|
|
(require 'consult-mu-compose)
|
|
(require 'consult-mu-compose-embark)
|
|
;; require extra module for searching contacts and runing embark actions on contacts
|
|
(require 'consult-mu-contacts)
|
|
(require 'consult-mu-contacts-embark)
|
|
;; change the prefiew key for compose so you don't open a preview of every file when selecting files to attach
|
|
(setq consult-mu-compose-preview-key "M-o")
|
|
;; pick a key to bind to consult-mu-compose-attach in embark-file-map
|
|
(setq consult-mu-embark-attach-file-key "C-a")
|
|
(setq consult-mu-contacts-ignore-list '("^.*no.*reply.*"))
|
|
(setq consult-mu-contacts-ignore-case-fold-search t)
|
|
(consult-mu-compose-embark-bind-attach-file-key)
|
|
;; choose if you want to use dired for attaching files (choice of 'always, 'in-dired, or nil)
|
|
(setq consult-mu-compose-use-dired-attachment 'in-dired))
|
|
|
|
(use-package! mu4e
|
|
:defer-incrementally t
|
|
:config
|
|
|
|
;; Run mu4e in the background to sync mail periodically
|
|
;; (mu4e t)
|
|
|
|
(setq mm-discouraged-alternatives '("text/html" "text/richtext"))
|
|
|
|
(setq mu4e-update-interval 60
|
|
mu4e-headers-auto-update t)
|
|
|
|
(setq
|
|
mu4e-index-cleanup t
|
|
mu4e-index-lazy-check nil
|
|
mu4e-show-images t
|
|
message-kill-buffer-on-exit t
|
|
mu4e-enable-async-operations t)
|
|
|
|
(setq message-citation-line-format "On %e %B %Y at %R %Z, %f wrote:\n")
|
|
(setq message-citation-line-function 'message-insert-formatted-citation-line)
|
|
|
|
(setq mu4e-context-policy 'pick-first)
|
|
|
|
(add-hook 'mu4e-thread-mode-hook #'mu4e-thread-fold-all)
|
|
|
|
(set-popup-rule! "*mu4e overview*" :side 'left :size '0.25)
|
|
|
|
;; Use gnus article view
|
|
;; (setq mu4e-view-use-gnus t)
|
|
|
|
;; (gnus-icalendar-setup)
|
|
;; Optional
|
|
;; (setq mu4e-icalendar-trash-after-reply t)
|
|
|
|
(setq mu4e-bookmarks nil)
|
|
|
|
(setq sendmail-program "/etc/profiles/per-user/emenel/bin/msmtp"
|
|
send-mail-function 'smtpmail-send-it
|
|
message-sendmail-f-is-evil t
|
|
message-sendmail-extra-arguments '("--read-envelope-from")
|
|
message-send-mail-function 'message-send-mail-with-sendmail)
|
|
|
|
(setq mu4e-compose-format-flowed t)
|
|
|
|
(setq message-signature nil)
|
|
|
|
(add-hook! 'mu4e-compose-mode-hook
|
|
(use-hard-newlines -1)
|
|
;; (message-add-header "CC:")
|
|
(message-goto-body)
|
|
(message-insert-signature-at-point)
|
|
(message-goto-body))
|
|
|
|
(mu4e-bookmark-define
|
|
(concat "maildir:/matt@emenel.ca/Drafts"
|
|
" or maildir:/admin@studyoftime.org/Drafts")
|
|
"All Drafts"
|
|
?d)
|
|
|
|
(mu4e-bookmark-define
|
|
(concat "maildir:/matt@emenel.ca/Inbox"
|
|
" or maildir:/admin@studyoftime.org/Inbox"
|
|
" or maildir:/matt@emenel.ca/Archive"
|
|
" or maildir:/admin@studyoftime.org/Archive")
|
|
"All Mail"
|
|
?a)
|
|
|
|
(mu4e-bookmark-define
|
|
(concat "flag:unread"
|
|
" and not maildir:/matt@emenel.ca/Spam"
|
|
" and not maildir:/matt@emenel.ca/Trash"
|
|
" and not maildir:/admin@studyoftime.org/Spam"
|
|
" and not maildir:/admin@studyoftime.org/Trash")
|
|
"All Unread"
|
|
?U)
|
|
|
|
(mu4e-bookmark-define
|
|
(concat "flag:flagged"
|
|
" and not maildir:/matt@emenel.ca/Spam"
|
|
" and not maildir:/matt@emenel.ca/Trash"
|
|
" and not maildir:/admin@studyoftime.org/Spam"
|
|
" and not maildir:/admin@studyoftime.org/Trash")
|
|
"All Flagged"
|
|
?f)
|
|
|
|
(mu4e-bookmark-define
|
|
(concat "flag:unread"
|
|
" and not maildir:/matt@emenel.ca/Spam"
|
|
" and not maildir:/matt@emenel.ca/Trash"
|
|
" and not maildir:/matt@emenel.ca/Archive"
|
|
" and not maildir:/admin@studyoftime.org/Spam"
|
|
" and not maildir:/admin@studyoftime.org/Trash"
|
|
" and not maildir:/admin@studyoftime.org/Archive")
|
|
"Inboxes Unread"
|
|
?u)
|
|
|
|
(mu4e-bookmark-define
|
|
(concat "maildir:/matt@emenel.ca/Inbox"
|
|
" or maildir:/admin@studyoftime.org/Inbox")
|
|
"All Inboxes"
|
|
?i)
|
|
|
|
(setq mu4e-maildir-shortcuts
|
|
'((:maildir "/matt@emenel.ca/Inbox" :key ?1 :name "Inbox/matt@emenel.ca")
|
|
(:maildir "/matt@emenel.ca/Drafts" :key ?2 :name "Drafts/matt@emenel.ca")
|
|
(:maildir "/matt@emenel.ca/Sent" :key ?3 :name "Sent/matt@emenel.ca")
|
|
(:maildir "/matt@emenel.ca/Spam" :key ?4 :name "Spam/matt@emenel.ca")
|
|
(:maildir "/admin@studyoftime.org/Inbox" :key ?5 :name "Inbox/admin@studyoftime.org")
|
|
(:maildir "/admin@studyoftime.org/Drafts" :key ?6 :name "Drafts/admin@studyoftime.org")
|
|
(:maildir "/admin@studyoftime.org/Sent" :key ?7 :name "Sent/admin@studyoftime.org")
|
|
(:maildir "/admin@studyoftime.org/Spam" :key ?8 :name "Spam/admin@studyoftime.org")))
|
|
|
|
(setq mu4e-alert-email-notification-types '(count))
|
|
|
|
;; FIXME: workaround for issue with doom mu4e not expanding ~
|
|
;; (setq mu4e-get-mail-command "mbsync -a")
|
|
|
|
(add-hook! mu4e-compose-mode
|
|
(ws-butler-mode -1)))
|