doomemacs/modules/email/notmuch
Henrik Lissner 494d87d0b4 email/notmuch: update readme
Closes #3933

Co-authored-by: Will Vaughn <nackjicholson@users.noreply.github.com>
2021-03-05 22:17:47 -05:00
..
autoload.el
config.el
packages.el
README.org email/notmuch: update readme 2021-03-05 22:17:47 -05:00

email/notmuch

Description

This module turns Emacs into email client using notmuch.

Module Flags

  • +afew Enables integration with afew.

Prerequisites

This module requires:

  • Either [[https://github.com/gauteh/lieer][gmailieer]] (default), mbsync or offlineimap (to sync mail with)
  • [[https://notmuchmail.org/][notmuch]], to index and tag your downloaded messages.
  • afew, optionally to initially tag your downloaded messages.

TODO MacOS

Arch Linux

Run one of the following commands.

pacman -S isync notmuch #mbsync
pacman -S offlineimap notmuch

See: Arch Wiki - Notmuch

NixOS

environment.systemPackages = with pkgs; [
    notmuch
    # And one of the following
    gmailieer
    isync
    offlineimap
];

An example of setting up mbsync and notmuch with home-manager

TODO openSUSE

TODO Debian/Ubuntu

TODO Features

Configuration

Downloading your email

To download your email you need a sync backend. Out of the box, this module supports Gmailier (the default), mbsync, and offlineimap (ordered by speed). You may define a custom one as well. The guides below will walk you through setting them up with notmuch.

Later, once you've set up a sync backend and downloaded your email, you must index your email for the first time:

notmuch new

TODO Gmailier

offlineimap

To use offlineimap, change +notmuch-sync-backend:

;; add to ~/.doom.d/config.el
(setq +notmuch-sync-backend 'offlineimap)

Next, write a configuration file for offlineimap. Here is a comprehensive example and another minimal one.

As a real world example, here is my old config, where it is configured to download mail to \~/.mail. I used unix pass to securely store my login credentials.

Finally, download your email with offlineimap -o. This may take a while, especially if you have thousands of emails.

mbsync

To use mbsync, change +notmuch-sync-backend:

(setq +notmuch-sync-backend 'mbsync)

;; Use `mbsync-xdg' if your mbsync config lives in $XDG_CONFIG_HOME/isync:
(setq +notmuch-sync-backend 'mbsync-xdg)

The steps needed to set up notmuch with mbsync are similar to the ones for offlineimap.

Start with writing a \~/.mbsyncrc to store your configuration. An example for GMAIL can be found on the ArchWiki which will also explain how its integration with notmuch for auto synchronization. A non-GMAIL example is available as a gist here.

Finally, download your email with mbsync --all. This may take a while, but will be quicker than offlineimap.

Custom method

If you have a unique method for synchronizing your email, you can define your own backend:

(setq +notmuch-sync-backend 'custom
      ;; Set this to an arbitrary shell command
      +notmuch-sync-command "my-notmuch-sync-cmd")

Customize *notmuch-hello* buffer

It is possible to change the *notmuch-hello* buffer if you want to.

(after! notmuch
  (setq notmuch-show-log nil
        notmuch-hello-sections `(notmuch-hello-insert-saved-searches
                                 notmuch-hello-insert-alltags)
        ;; To hide headers while composing an email
        notmuch-message-headers-visible nil))

Changing the notmuch landing page

You may want to forego the *notmuch-hello* buffer by having M-x =notmuch or SPC o m take you straight to a search page.

When using SPC o m the +notmuch-home-function is called. By default it uses the notmuch function and so has the same familiar behavior of running a vanilla install of notmuch-emacs. But, by overwriting this function you can run a custom search as your landing page.

(setq +notmuch-home-function (lambda () (notmuch-search "tag:inbox")))

TODO Troubleshooting