From 902f0683a0e1ee58aa9a36175000a852a1a670a1 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Sun, 10 Apr 2022 00:52:40 +0200 Subject: [PATCH 1/2] Adapt email to NixOS setup --- config.org | 30 +++++++++++++++++++----------- init.el | 2 +- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/config.org b/config.org index 8646387..246433b 100644 --- a/config.org +++ b/config.org @@ -40,6 +40,7 @@ - [[#magit-delta][magit-delta]] - [[#email][Email]] - [[#account-configuration][Account configuration]] + - [[#sending-mail][Sending mail]] - [[#disable-org-msg-by-default][Disable =org-msg= by default]] - [[#message-quoting-style][Message quoting style]] - [[#use-gnus-view-for-mu4e][Use Gnus view for =mu4e=]] @@ -489,14 +490,11 @@ documentation). Setup my main email account. #+begin_src emacs-lisp -(set-email-account! "alarsyo.net" - '((mu4e-sent-folder . "/alarsyo.net/Sent") - (mu4e-drafts-folder . "/alarsyo.net/Drafts") - (mu4e-refile-folder . "/alarsyo.net/Archive") - (mu4e-trash-folder . "/alarsyo.net/Trash") - (smtpmail-smtp-server . "smtp.migadu.com") - (smtpmail-smtp-service . 465) - (smtpmail-stream-type . ssl) +(set-email-account! "alarsyo" + '((mu4e-sent-folder . "/alarsyo/Sent") + (mu4e-drafts-folder . "/alarsyo/Drafts") + (mu4e-refile-folder . "/alarsyo/Archive") + (mu4e-trash-folder . "/alarsyo/Trash") (user-mail-address . "antoine@alarsyo.net") (user-full-name . "Antoine Martin") (mu4e-compose-signature . "Antoine Martin")) @@ -506,15 +504,25 @@ Setup my main email account. '((mu4e-sent-folder . "/lrde/Sent") (mu4e-drafts-folder . "/lrde/Drafts") (mu4e-trash-folder . "/lrde/Trash") - (smtpmail-smtp-server . "smtp.lrde.epita.fr") - (smtpmail-smtp-service . 587) - (smtpmail-stream-type . starttls) (user-mail-address . "amartin@lrde.epita.fr") (user-full-name . "Antoine Martin") (mu4e-compose-signature . "Antoine Martin")) nil) #+end_src +** Sending mail + +I use =msmtp= as a SMTP forwarder + +#+begin_src emacs-lisp +(after! mu4e + (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)) +#+end_src + ** Disable =org-msg= by default Doom adds a hook, making it impossible to disable. This allows us to toggle it diff --git a/init.el b/init.el index fb3b333..c799730 100644 --- a/init.el +++ b/init.el @@ -172,7 +172,7 @@ yaml ; JSON, but readable :email - ;;(mu4e) + (mu4e) ;;notmuch ;;(wanderlust +gmail) From 2aa01445b03d1a39c18d022266763b7ceadbbed3 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Sun, 10 Apr 2022 00:54:53 +0200 Subject: [PATCH 2/2] mu4e tweaks --- config.org | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/config.org b/config.org index 246433b..97a2cab 100644 --- a/config.org +++ b/config.org @@ -41,10 +41,11 @@ - [[#email][Email]] - [[#account-configuration][Account configuration]] - [[#sending-mail][Sending mail]] + - [[#reading-plain-text][Reading plain text]] - [[#disable-org-msg-by-default][Disable =org-msg= by default]] - [[#message-quoting-style][Message quoting style]] - - [[#use-gnus-view-for-mu4e][Use Gnus view for =mu4e=]] - [[#disable-formatflowed][Disable format=flowed]] + - [[#dont-permanently-delete-when-trashing-mails][Don't permanently delete when trashing mails]] - [[#add-git-apply-path-to-mu4e-actions][Add git-apply-path to mu4e actions]] * Misc @@ -523,6 +524,17 @@ I use =msmtp= as a SMTP forwarder message-send-mail-function #'message-send-mail-with-sendmail)) #+end_src +** Reading plain text + +Ask the =gnus-view= (default viewer used by =mu4e=) to avoid HTML whenever +possible. + +#+begin_src emacs-lisp +(after! mu4e + (add-to-list 'mm-discouraged-alternatives "text/html") + (add-to-list 'mm-discouraged-alternatives "text/richtext")) +#+end_src + ** Disable =org-msg= by default Doom adds a hook, making it impossible to disable. This allows us to toggle it @@ -558,13 +570,6 @@ Has to be duplicated because =mu4e= doesn't use ~message-cite-style~'s values. message-citation-line-format "%f writes:")) #+end_src -** Use Gnus view for =mu4e= - -#+begin_src emacs-lisp -(after! mu4e - (setq mu4e-view-use-gnus t)) -#+end_src - ** Disable format=flowed #+begin_src emacs-lisp @@ -572,10 +577,35 @@ Has to be duplicated because =mu4e= doesn't use ~message-cite-style~'s values. (setq mu4e-compose-format-flowed nil)) #+end_src +** Don't permanently delete when trashing mails + +By default =mu4e= sets the =trashed= flag on emails trashed using the =d= +keybinding. This just replaces the action to just move the message to the trash +instead. + +See https://github.com/djcb/mu/issues/1136#issuecomment-1066303788, the code +will have to be adapted soon. + +#+begin_src emacs-lisp +(after! mu4e + (setf (alist-get 'trash mu4e-marks) + (list :char '("d" . "▼") + :prompt "dtrash" + :dyn-target (lambda (target msg) + (mu4e-get-trash-folder msg)) + :action (lambda (docid msg target) + (mu4e~proc-move + docid (mu4e~mark-check-target target) "-N"))))) +#+end_src + ** Add git-apply-path to mu4e actions #+begin_src emacs-lisp (after! mu4e + ;; TODO: upstream this, Doom emacs adds a view in browser action but it seems + ;; to be present by default now. + (setq mu4e-view-actions + (remove '("View in browser" . mu4e-action-view-in-browser) mu4e-view-actions)) (add-to-list 'mu4e-view-actions '("GitApply" . mu4e-action-git-apply-patch) t) (add-to-list 'mu4e-view-actions