email: start mu4e in background

Instead of autoloading one function...
This commit is contained in:
Max Schlueter 2024-04-12 10:44:53 +02:00
parent 655b40956b
commit 1de6abe136

View File

@ -1,15 +1,19 @@
;;; email.el -*- lexical-binding: t; -*-
(after! mu4e
;; Recommended msmtp config from doom module documentation
(setq sendmail-program (executable-find "msmtp")
;; Start mu4e in the background
;; https://github.com/djcb/mu/issues/2282
(require 'mu4e)
(mu4e 'background)
;; Recommended msmtp config from doom module documentation
(setq sendmail-program (executable-find "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)
;; `set-email-account!' doesn't accept a custom match-func
(setq mu4e-contexts
;; `set-email-account!' doesn't accept a custom match-func
(setq mu4e-contexts
(list
;; (make-mu4e-context
;; :name "upcycling"
@ -43,7 +47,7 @@
("maxsc@fsfe.org"))
))))
(setq mu4e-attachment-dir "~/Downloads"
(setq mu4e-attachment-dir "~/Downloads"
mu4e-sent-folder "/mailbox/Sent"
mu4e-drafts-folder "/mailbox/Drafts"
mu4e-trash-folder "/mailbox/Trash"
@ -75,16 +79,16 @@
:hide-unread t
:key ?t)))
;; Render buttons to verify&decrypt messages
(setq mm-decrypt-option 'always
;; Render buttons to verify&decrypt messages
(setq mm-decrypt-option 'always
mm-verify-option 'always
gnus-buttonized-mime-types '("multipart/encrypted" "multipart/signed")
mml-secure-openpgp-encrypt-to-self t)
;; Move message to the trash folder but do not set the trash flag
;; https://github.com/djcb/mu/issues/1136#issuecomment-1066303788
(setf (alist-get 'trash mu4e-marks)
(list :char '("d" . "")
;; Move message to the trash folder but do not set the trash flag
;; https://github.com/djcb/mu/issues/1136#issuecomment-1066303788
(setf (alist-get 'trash mu4e-marks)
(list :char '("d" . "")
:prompt "dtrash"
:dyn-target (lambda (target msg)
(mu4e-get-trash-folder msg))
@ -94,7 +98,7 @@
;; IMAP-deleted:
(mu4e--server-move docid (mu4e--mark-check-target target) "+S-u-N"))))
(add-to-list 'mu4e-marks
(add-to-list 'mu4e-marks
'(spam
:char "S"
:prompt "Spam"
@ -102,14 +106,14 @@
:action (lambda (docid msg target)
(mu4e--server-move docid mu4e-spam-folder "+S-u-N"))))
(defun my:mu4e-mark-for-spam()
(defun my:mu4e-mark-for-spam()
"Mark as read and move to spam."
(interactive)
(mu4e-headers-mark-and-next 'spam))
(map! :map mu4e-headers-mode-map :n "S" #'my:mu4e-mark-for-spam)
(map! :map mu4e-headers-mode-map :n "S" #'my:mu4e-mark-for-spam)
(add-to-list 'mu4e-view-mime-part-actions
(add-to-list 'mu4e-view-mime-part-actions
'(:name "calendar"
:handler (lambda (file)
(shell-command
@ -117,11 +121,10 @@
(khalel-import-events))
:receives temp))
;; Sign sent email automatically
;; (add-hook 'message-send-hook 'mml-secure-message-sign-smime)
;; Sign sent email automatically
;; (add-hook 'message-send-hook 'mml-secure-message-sign-smime)
(require 'khalel-icalendar)
)
(require 'khalel-icalendar)
;; (defun max/mu4e-view-import-attachment-calendar (msg attnum)
;; (let* ((att (mu4e~view-get-attach msg attnum))
@ -139,9 +142,6 @@
;; (add-to-list 'mu4e-view-attachment-actions
;; '("cImport in calendar" . max/mu4e-view-import-attachment-calendar) t)
;; Autoload this command so that the mbsync service can update the index
(autoload #'mu4e-update-index "mu4e" nil t)
(defun max/=mu4e ()
"Start email client and view all inboxes."
(interactive)