doomemacs/modules/email/notmuch
Henrik Lissner 037b018cdd
feat: add .doommodule files
These optional dotfiles indicate the root of a module or module
group (:lang), and will later contain module metadata. They will also
serve as an alternative to packages.el and doctor.el, and will aide the
parts of the v3.0 module API concerned with resolving the current module
from a path (`doom-module-from-path`), which currently rely too heavily
on parsing path strings.

For now, however, they're simply placeholders.
2024-09-14 20:47:39 -04:00
..
.doommodule feat: add .doommodule files 2024-09-14 20:47:39 -04:00
autoload.el refactor(workspaces): +workspace/delete: rename to +workspace/kill 2024-07-05 18:05:15 -04:00
config.el refactor: deprecate featurep! for modulep! 2022-08-14 20:43:35 +02:00
packages.el bump: :email mu4e notmuch 2024-02-05 17:21:21 -05:00
README.org docs(*): replace all-the-icons with nerd-icons 2023-09-16 20:19:11 +02:00

:email notmuch

Description   unfold

This module turns Emacs into an email client using doom-package:notmuch.

Maintainers

This module needs a maintainer. Become a maintainer?

Module flags

+afew
Enable integration with afew.
+org
Enable doom-package:org-mime for writing HTML emails using org-mode.

Packages

TODO Hacks

󱌣 This module's hacks haven't been documented yet. Document them?

TODO Changelog

This module does not have a changelog yet.

Installation

Enable this module in your doom! block.

This module requires:

  • Either gmailieer (default), mbsync or offlineimap to sync mail with.
  • 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 Usage

󱌣 This module's usage documentation is incomplete. Complete it?

Keymap Command Description
<localleader> u +notmuch/update Download, sync, and index emails with notmuch
<localleader> c +notmuch/compose Compose new email

TODO Configuration

󱌣 This module's configuration documentation is incomplete. Complete it?

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

lieer

Lieer, formerly called Gmailieer, is the indexing tool used by default. To install lieer, see the installation docs.

offlineimap

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

;; add to $DOOMDIR/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 $HOME/.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 $HOME/.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:

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

Customize *notmuch-hello* buffer

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

;; add to $DOOMDIR/config.el
(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 <leader> o m take you straight to a search page.

When using <leader> 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")))

Writing HTML Emails

The org-mime package provides functionality for composing emails in org-mode and transforming them to HTML. This feature is enabled using the +org flag.

Example use cases:

  • To convert an email to an HTML email use M-x org-mime-htmlize.
  • To compose email using an org-mode editor buffer, use M-x org-mime-edit-mail-in-org-mode.

If you'd like to make configuration changes to org-mime, you may do so normally. By default the output of org-mime-htmlize includes section numbers, a byline, and a table of contents. That's probably more formal than the emails you're used to sending, so here's some example configuration that turns those features off:

;; add to $DOOMDIR/config.el
(after! org-mime
  (setq org-mime-export-options '(:section-numbers nil
                                  :with-author nil
                                  :with-toc nil)))

Troubleshooting

There are no known problems with this module. Report one?

Frequently asked questions

This module has no FAQs yet. Ask one?

TODO Appendix

󱌣 This module has no appendix yet. Write one?