notmuch is easy

  1. emacs
  2. email


I don’t have an email workflow, I just use it for tracking news or receiving notifications. I’ve been using mbsync & mu4e for almost 2 years, never got to learn any of the “advanced” features, only read & archive.

I also subscribed to the emacs-devel mail list, which basically made the Zoho mail web UI (or any other web mail UI) unusable. I don’t chase all the threads too often, but I just feel happy to see emacs development is so active, xD.


After messing around my own emacs config for quite some time, I’m now settled with doom emacs, it provides a nice-looking mu4e integration, that’s where I start to use it. I’m not entirely happy with it, I had to write long queries to filter out the mailing list emails in the bookmarks setting, but as I said I’m not a heavy email user, so I just live with it.


I know about notmuch a long time ago, even before I tried to use mu4e, I remember this cuz its logo in the notmuch-hello buffer is so memorably, but obviously, I didn’t stick to it for long. I’m just walking through some old emacs news as usual yesterday, and opened this link and then this video by Protesilaos Stavrou.

After I finished the video (well, while I’m finishing it), I started trying it out, the ability to search quickly with tags and add tags on the fly while reading emails attracted me. Luckily I already have all my emails on my maildir with mbsync.

So I enabled the :email notmuch and disable :email mu4e in doom. I can feel immediately that this module is not well maintained like the mu4e one, e.g., it opens up a *notmuch* workspace, but the *mu4e-hello* buffer is just a popup to the left, and the workspace remains when I closed the buffer.

The dashboard is just as I remembered with the balance logo, so far the experience is just like the last time I tried, until I learned the real magic, initial tagging.

The one on notmuch’s website is helpful but not as clear as in Prot’s video, anyway I basically copied his hook script from his video and did some manual tagging like tag all email in the archive folder with archive, and now I’m getting a much cleaner email view, and way easier to configure as well.

#!/usr/bin/env bash
notmuch tag -unread -new -- tag:replied
notmuch tag +inbox +unread -new -- tag:new

notmuch tag -new -unread +sent -- '(from:"** not to:"**)'

notmuch tag -inbox +list +emacs-devel -- from:[email protected] or to:[email protected] or subject:[emacs-devel]
(after! notmuch
  (set-popup-rule! "^\\*notmuch" :ignore t)

  (setq notmuch-saved-searches
        '((:name "inbox" :query "tag:inbox not tag:trash" :key "i")
          (:name "todo" :query "tag:todo" :key "t")
          (:name "flagged" :query "tag:flagged" :key "f")
          (:name "sent" :query "tag:sent" :key "s")
          (:name "drafts" :query "tag:draft" :key "d")))

  (setq +notmuch-mail-folder "~/Maildir"
        +notmuch-sync-backend 'mbsync))

doom :email notmuch

As I mentioned, the notmuch module in doom emacs is not quite as good as the mu4e one, but I’m planning to improve it myself a little bit, port some of the features from the mu4e module, like the dedicated workspace thing:

(defvar +notmuch--old-wconf nil)

(add-hook 'notmuch-hello-mode-hook #'+notmuch-init-h)

(defun +notmuch-init-h ()
  (add-hook 'kill-buffer-hook #'+notmuch-kill-notmuch-h nil t))

(defun +notmuch-kill-notmuch-h ()
  ;; (prolusion-mail-hide)
   ((and (modulep! :ui workspaces) (+workspace-exists-p +notmuch-workspace-name))
    (+workspace/delete +notmuch-workspace-name))

    (set-window-configuration +notmuch--old-wconf)
    (setq +notmuch--old-wconf nil))))

I’m happy I took 30min to watch the video, email never felt so easy to me, maybe I can have an email workflow now, let’s see.