refactor(mu4e): replace +mu4e-backend w/ +offlineimap/+mbsync flags
`+mu4e-backend` is now deprecated and will be removed in v3.0.
This commit is contained in:
parent
f3ad08c4cd
commit
48a6b30f48
2 changed files with 32 additions and 32 deletions
|
@ -37,6 +37,10 @@ This module makes Emacs an email client, using [[https://www.djcbsoftware.nl/cod
|
|||
- +gmail ::
|
||||
Enable gmail-specific configuration for mail ~To~ or ~From~ a gmail address,
|
||||
or a maildir with ~gmail~ in the name.
|
||||
- +mbsync ::
|
||||
Use [[https://isync.sourceforge.io/][mbsync]] to synchronize with mu.
|
||||
- +offlineimap ::
|
||||
Use [[https://www.offlineimap.org/about/][offlineimap]] to synchronize with mu.
|
||||
- +org ::
|
||||
Use [[doom-package:org-msg]] for composing email in Org, then sending a multipart text (ASCII
|
||||
export) and HTML message.
|
||||
|
@ -124,34 +128,30 @@ programs.emacs = {
|
|||
#+end_quote
|
||||
|
||||
** offlineimap
|
||||
This module uses =mbsync= by default. To use =offlineimap=, change
|
||||
~+mu4e-backend~:
|
||||
#+begin_src emacs-lisp
|
||||
(setq +mu4e-backend 'offlineimap)
|
||||
#+end_src
|
||||
Enable this module with the =+offlineimap= flag, then [[https://www.offlineimap.org/doc/quick_start.html][write a configuration file]]
|
||||
for =offlineimap= ([[https://github.com/OfflineIMAP/offlineimap/blob/master/offlineimap.conf][a sample config file can be found in offlineimap's repo]]).
|
||||
|
||||
Next, you need to write a configuration file for =offlineimap=. Mine can be
|
||||
found [[https://github.com/hlissner/dotfiles/blob/be0dce5dae8f3cbafaac0cc44269d84b4a742c46/shell/mu/][in my dotfiles repository]]. It is configured to download mail to
|
||||
~\~/.mail~. I use [[https://www.passwordstore.org/][unix pass]] to securely store my login credentials. You can find
|
||||
a *very* detailed configuration [[https://github.com/OfflineIMAP/offlineimap/blob/master/offlineimap.conf][here]].
|
||||
Next, download your email with ~$ offlineimap -o~. This may take a while,
|
||||
depending on how many emails need downloading.
|
||||
|
||||
Next you can download your email with ~$ offlineimap -o~. This may take a while,
|
||||
especially if you have thousands of mails.
|
||||
|
||||
You can now proceed with the [[#mu-and-mu4e][mu and mu4e]] section.
|
||||
Then proceed to the "mu and mu4e" section below.
|
||||
|
||||
** mbsync
|
||||
The steps needed to set up =mu4e= with =mbsync= are very similar to the ones for
|
||||
[[#offlineimap][offlineimap]].
|
||||
After this module has been enabled with the =+mbsync= flag, the steps to set up
|
||||
=mbsync= are similar to the ones for offlineimap:
|
||||
|
||||
Start with writing a =~/.mbsyncrc=. An example for Gmail can be found on
|
||||
[[http://pragmaticemacs.com/emacs/migrating-from-offlineimap-to-mbsync-for-mu4e/][pragmaticemacs.com]]. A non-Gmail example is available as a gist [[https://gist.github.com/agraul/60977cc497c3aec44e10591f94f49ef0][here]]. The [[http://isync.sourceforge.net/mbsync.html][manual
|
||||
page]] contains all needed information to set up your own.
|
||||
Start with writing a =~/.mbsyncrc=. Here are some examples:
|
||||
|
||||
Next you can download your email with ~$ mbsync --all~. This may take a while,
|
||||
but should be quicker than =offlineimap= ;).
|
||||
- [[https://pragmaticemacs.wordpress.com/2016/03/22/migrating-from-offlineimap-to-mbsync-for-mu4e/][For Gmail accounts]],
|
||||
- [[https://rakhim.org/fastmail-setup-with-emacs-mu4e-and-mbsync-on-macos/][For Fastmail accounts]],
|
||||
- [[https://gist.github.com/agraul/60977cc497c3aec44e10591f94f49ef0][A more generic example for other services]].
|
||||
|
||||
You can now proceed with the [[#mu-and-mu4e][mu and mu4e]] section.
|
||||
The [[http://isync.sourceforge.net/mbsync.html][manual page]] contains all needed information to set up your own.
|
||||
|
||||
Next, download your email with ~$ mbsync --all~. This may take a while, but
|
||||
should be quicker than =offlineimap= ;).
|
||||
|
||||
Then proceed to the "mu and mu4e" section below.
|
||||
|
||||
*** Faster syncing
|
||||
It's possible to use IMAP IDLE to be quickly notified of updates, then use a
|
||||
|
@ -161,11 +161,9 @@ If this is of interest, this approach can be seen [[https://tecosaur.github.io/e
|
|||
[[https://gitlab.com/shackra/goimapnotify][goimapnotify]] is used for this.
|
||||
|
||||
** Fetching your mail in other ways
|
||||
You also have the possiblity to invoke an arbitary shell command to fetch your
|
||||
mail by disabling this module's backend selection and setting the value of the
|
||||
~mu4e-get-mail-command~ to the command you want to execute:
|
||||
Mu4e can be configured to call an arbitary shell command to fetch your email. To
|
||||
use it, set [[var:mu4e-get-mail-command]]:
|
||||
#+begin_src emacs-lisp
|
||||
(setq +mu4e-backend nil)
|
||||
(after! mu4e
|
||||
(setq mu4e-get-mail-command "your_command"))
|
||||
#+end_src
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
(defvar +mu4e-backend 'mbsync
|
||||
"Which backend to use. Can either be offlineimap, mbsync or nil (manual).")
|
||||
(make-obsolete-variable '+mu4e-backend "Use the :email mu4e module's +mbsync or +offlineimap flags instead" "3.0.0")
|
||||
|
||||
(defvar +mu4e-personal-addresses 'nil
|
||||
"Alternative to mu4e-personal-addresses that can be set for each account (mu4e context).")
|
||||
|
@ -23,6 +24,14 @@
|
|||
(lambda (&rest _)
|
||||
(expand-file-name ".attachments" (mu4e-root-maildir))))
|
||||
:config
|
||||
(cond ((or (modulep! +mbsync)
|
||||
(eq +mu4e-backend 'mbsync))
|
||||
(setq mu4e-get-mail-command "mbsync -a"
|
||||
mu4e-change-filenames-when-moving t))
|
||||
((or (modulep! +offlineimap)
|
||||
(eq +mu4e-backend 'offlineimap))
|
||||
(setq mu4e-get-mail-command "offlineimap -o -q")))
|
||||
|
||||
(when (version< mu4e-mu-version "1.8")
|
||||
;; Define aliases to maintain backwards compatibility. The list of suffixes
|
||||
;; were obtained by comparing mu4e~ and mu4e-- functions in `obarray'.
|
||||
|
@ -67,13 +76,6 @@ is non-nil."
|
|||
mu4e-view-image-max-width 800
|
||||
mu4e-view-use-gnus t))
|
||||
|
||||
(pcase +mu4e-backend
|
||||
(`mbsync
|
||||
(setq mu4e-get-mail-command "mbsync -a"
|
||||
mu4e-change-filenames-when-moving t))
|
||||
(`offlineimap
|
||||
(setq mu4e-get-mail-command "offlineimap -o -q")))
|
||||
|
||||
(setq mu4e-update-interval nil
|
||||
mu4e-notification-support t
|
||||
mu4e-sent-messages-behavior 'sent
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue