Has anyone tried to search through emails' contents in notmuch in a "multi-occur like fashion", that is in a buffer that lists occurrences of a searched keyword and let's you visit their buffers (email messages)?

From my simple tests it looked like notmuch indexes contents of emails, as well as its headers, so I assume that this should be possible?

If anyone is aware of any other project that has this feature (mu4e, neomutt) please let me know.

1 Answer 1


I've ended up doing it in two discrete steps:

  1. open all buffers from the current (tree) search (may take a few seconds):
(defun notmuch-tree-show-all-messages ()
        (goto-char (point-min))
            (while (and (not (eobp)) (not (get-buffer (notmuch-tree-get-message-id))))
              (forward-line 1)))
  1. multi-occur only in the opened notmuch messages:
(defun my-multi-occur-in-notmuch-message-matching-buffers (regexp &optional allbufs)
  "search only in notmuch messages"
  (interactive (occur-read-primary-args))
  (multi-occur-in-matching-buffers "notmuch" regexp (not allbufs)))


May be worth noting that just for the purpose of full-text email search, I'm testing recoll now instead, which indexes all emails ahead of time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.