From c8f678c4dd06e7d7ad18275f9ae5c8409e215ae9 Mon Sep 17 00:00:00 2001 From: noa@gaiwan.org Date: Sun, 23 Jun 2024 00:42:51 +0000 Subject: Reposition and update mail configuration --- config.org | 235 +++++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 165 insertions(+), 70 deletions(-) (limited to 'config.org') diff --git a/config.org b/config.org index a71f9af..4045818 100644 --- a/config.org +++ b/config.org @@ -810,7 +810,6 @@ Reading prose with long lines is a chore. Luckily there are several packages in (add-hook 'text-mode-hook #'visual-line-fill-column-mode) (add-hook 'eww-after-render-hook #'visual-line-fill-column-mode) (add-hook 'nov-post-html-render-hook #'visual-line-fill-column-mode) - (add-hook 'mu4e-view-mode-hook #'visual-line-fill-column-mode) #+end_src The fringes of a window can show useful icons relating to the text in the buffer. For example, when using org modern, blocks get a line in the left fringe to show their content more clearly, Because of this, i prefer for them to be right next to the buffer text. @@ -1358,75 +1357,6 @@ Undo is on C-/ and redo is on C-S-/. It's not standard, but these bindings are (setopt undo-no-redo t) #+end_src -** Email: mu4e -#+begin_src elisp -(setopt mu4e-headers-skip-duplicates t) -(setopt mu4e-view-show-images t) -(setopt mu4e-view-show-addresses t) -#+end_src - -In theory i like format flowed, but what i like even more is just not hard wrapping messages and dealing with hacks to get around that to begin with. If software supported soft wrapping at an arbitrary column, the world would be a better place. - -#+begin_src elisp -(setopt mu4e-compose-format-flowed nil) -(setopt mu4e-change-filenames-when-moving t) -(setopt mu4e-use-fancy-chars nil) -(setopt mu4e-confirm-quit nil) -(setopt mu4e-headers-leave-behavior 'apply) -(setopt mu4e-headers-precise-alignment t) -(setopt mu4e-headers-fields '((:flags . 6) - (:from . 32) - (:subject))) -(setopt mu4e-search-threads nil) -(setopt mu4e-hide-index-messages t) -(setopt mu4e-get-mail-command "mbsync -c ~/.config/mbsyncrc fastmail") -(setopt mu4e-maildir "~/mail") -(setopt mu4e-drafts-folder "/Drafts") -(setopt mu4e-sent-folder "/Sent") -(setopt mu4e-refile-folder "/Archive") -(setopt mu4e-trash-folder "/Trash") -(setopt mu4e-bookmarks '((:name "Inbox" :query "maildir:/Inbox" :key ?i) - (:name "Feeds" :query "maildir:/Feeds" :key ?f) - (:name "Paper trail" :query "\"maildir:/Paper trail\"" :key ?p))) -#+end_src - -function to move mails to trash - -#+begin_src elisp -(with-eval-after-load 'mu4e - (bind-key (kbd "d") #'noa/move-to-trash 'mu4e-headers-mode-map) - (bind-key (kbd "d") #'noa/move-to-trash 'mu4e-view-mode-map) - (fset 'noa/move-to-trash "mTrash")) -#+end_src - -The first string is for when fancy characters are disabled, and the second is for when they are enabled. But i set them all manually because some of the other characters are ugly in fancy mode, but i like my unicode thread icons. - -#+begin_src elisp -(setq mu4e-headers-thread-connection-prefix '("│ " . "│ ") - mu4e-headers-thread-last-child-prefix '("└ " . "└ ") - mu4e-headers-thread-blank-prefix '(" " . " ") - mu4e-headers-thread-root-prefix '("□ " . "□ ") - mu4e-headers-thread-child-prefix '("│ " . "│ ") - mu4e-headers-thread-orphan-prefix '("♢ " . "♢ ") - mu4e-headers-thread-duplicate-prefix '("≡ " . "≡ ") - mu4e-headers-thread-first-child-prefix '("⚬ " . "⚬ ") - mu4e-headers-thread-single-orphan-prefix '("♢ " . "♢ ")) -#+end_src - -Setting this to nil stops auto-fill from being automatically enabled in message buffers. - -#+begin_src elisp -(setopt message-fill-column nil) -#+end_src - -I set an email signature. I could put this outside of the configuration in a file referenced by message-signature-file, but for now i just keep it inline. - -#+begin_src elisp -(setopt message-signature "~noa (https://noa.pub) - • I try to reply to formal emails in three sentences or fewer; excuse my brevity. - • I queue replies and batch send them at intervals; excuse my untimeliness.") -#+end_src - ** More miscellaneous #+begin_src elisp @@ -1654,3 +1584,168 @@ The auth-source library allows packages to request password information. It has #+begin_src elisp (global-set-key (kbd "C-=") #'calc) #+end_src +* Email +I like to have my email offline. Of course my preference is also to have it inside of emacs for consistency with everything else. Currently i use mu4e as my mail user agent, which relies on an external tool. I also use two small command line programs to download and send mail. + +#+begin_src sh :tangle no + sudo apt install maildir-utils isync msmtp + #+end_src + +** Fetching mail with mbsync +Mbsync is downloaded with the isync package. The configuration is not complicated. + +I use fastmail to host my email. + +#+begin_src text :tangle no + IMAPAccount fastmail + Host imap.fastmail.com + User noa@gaiwan.org + #+end_src + +The ~passcmd~ is run to fetch my password. I should put this into pass, but this isn't an ordinary password. It's an app password, and needs to be updated on every new system. + +#+begin_src text :tangle no + PassCmd "cat ~/.config/mbsync-pass" +#+end_src + +#+begin_src text :tangle no + SSLType IMAPS + + IMAPStore fastmail-remote + Account fastmail + + MaildirStore fastmail-local + SubFolders Verbatim + Path "~/mail/" + Inbox "~/mail/Inbox" + + Channel fastmail + Far :fastmail-remote: + Near :fastmail-local: + Patterns * + Create Near + Expunge Near + SyncState * + CopyArrivalDate yes +#+end_src + +** Reading mail with mu4e + + #+begin_src elisp + (setopt mu4e-headers-skip-duplicates t) + (setopt mu4e-view-show-images t) + (setopt mu4e-view-show-addresses t) +#+end_src + +In theory i like format flowed, but what i like even more is just not hard wrapping messages and dealing with hacks to get around that to begin with. If software supported soft wrapping at an arbitrary column, the world would be a better place. + +#+begin_src elisp +(setopt mu4e-compose-format-flowed nil) +(setopt mu4e-change-filenames-when-moving t) +(setopt mu4e-use-fancy-chars nil) +(setopt mu4e-confirm-quit nil) +(setopt mu4e-headers-leave-behavior 'apply) +(setopt mu4e-headers-precise-alignment t) +(setopt mu4e-headers-fields '((:flags . 6) + (:from . 32) + (:subject))) +(setopt mu4e-search-threads nil) +(setopt mu4e-hide-index-messages t) +(setopt mu4e-get-mail-command "mbsync -c ~/.config/mbsyncrc fastmail") +(setopt mu4e-maildir "~/mail") +(setopt mu4e-drafts-folder "/Drafts") +(setopt mu4e-sent-folder "/Sent") +(setopt mu4e-refile-folder "/Archive") +(setopt mu4e-trash-folder "/Trash") +(setopt mu4e-bookmarks '((:name "Inbox" :query "maildir:/Inbox" :key ?i) + (:name "Feeds" :query "maildir:/Feeds" :key ?f) + (:name "Paper trail" :query "\"maildir:/Paper trail\"" :key ?p))) +#+end_src + +function to move mails to trash + +#+begin_src elisp +(with-eval-after-load 'mu4e + (bind-key (kbd "d") #'noa/move-to-trash 'mu4e-headers-mode-map) + (bind-key (kbd "d") #'noa/move-to-trash 'mu4e-view-mode-map) + (fset 'noa/move-to-trash "mTrash")) +#+end_src + +The first string is for when fancy characters are disabled, and the second is for when they are enabled. But i set them all manually because some of the other characters are ugly in fancy mode, but i like my unicode thread icons. + +#+begin_src elisp +(setq mu4e-headers-thread-connection-prefix '("│ " . "│ ") + mu4e-headers-thread-last-child-prefix '("└ " . "└ ") + mu4e-headers-thread-blank-prefix '(" " . " ") + mu4e-headers-thread-root-prefix '("□ " . "□ ") + mu4e-headers-thread-child-prefix '("│ " . "│ ") + mu4e-headers-thread-orphan-prefix '("♢ " . "♢ ") + mu4e-headers-thread-duplicate-prefix '("≡ " . "≡ ") + mu4e-headers-thread-first-child-prefix '("⚬ " . "⚬ ") + mu4e-headers-thread-single-orphan-prefix '("♢ " . "♢ ")) +#+end_src + +Setting this to nil stops auto-fill from being automatically enabled in message buffers. + +#+begin_src elisp +(setopt message-fill-column nil) +#+end_src + +It's nice to have a message signature. I want the signature to be loaded from a file, which is store in my configuration directory. + +#+begin_src elisp + (setopt message-signature t) + (setopt message-signature-file "~/.config/signature") +#+end_src + +The contents of the signature file is listed below. Currently i only have two bullet points, when i think three would look nicer, but i don't have three things to say. + +#+begin_src text :tangle ~/.config/signature + ~noa (https://noa.pub) + • I try to reply to formal emails in three sentences or fewer; excuse my brevity. + • I queue replies and batch send them at intervals; excuse my untimeliness. + #+end_src + +#+begin_src elisp +(add-hook 'mu4e-view-mode-hook #'visual-line-fill-column-mode) +#+end_src + +** Reading mail with rmail +I have experimented with lots of different methods of reading mail, both in and out of emacs. But i keep coming back to rmail, despite its many, many warts. + +#+begin_src elisp + (setopt rmail-primary-inbox-list + '("mbox://~/spool.mbox")) + (setopt rmail-file-name "~/rmail.mbox") + (setopt rmail-user-mail-address-regexp + (rx "noa@gaiwan.org")) + (setopt rmail-mime-prefer-html nil) + (setopt rmail-mime-attachment-dirs-alist '(("" "~/media"))) + (setopt rmail-displayed-headers + (rx bol (or "To" "Cc" "From" "Date" "Subject") ":")) + (setopt rmail-secondary-file-directory "~/archive.mbox") + (setopt rmail-secondary-file-regexp "\\.mbox\\'") + (setopt rmail-delete-after-output t) + (setopt rmail-default-file "~/") + (setopt mail-dont-reply-to-names rmail-user-mail-address-regexp) + + (add-hook 'rmail-mode-hook #'visual-line-fill-column-mode) + + (setopt rmail-display-summary t) + (setopt rmail-redisplay-redisplay-summary t) + (setopt rmail-summary-line-count-flag nil) + (setopt rmail-summary-window-size 12) +#+end_src + +** Sending mail with msmtp +#+begin_src elisp + (setopt message-send-mail-function 'message-send-mail-with-sendmail) + (setopt sendmail-program (executable-find "msmtpq")) + + (setopt message-sendmail-extra-arguments '("--read-envelope-from")) + (setopt message-sendmail(-envelope-from 'header) + (setopt message-kill-buffer-on-exit t) + (setopt message-sendmail-f-is-evil t) + (setopt message-forward-as-mime t) + (setopt message-interactive t) +#+end_src -- cgit 1.4.1-2-gfad0