Search and limit from command line

Jens John lists at 2ion.de
Sat Mar 20 19:42:46 UTC 2021


On Sat, 20 Mar 2021, at 20:24, Julius Hamilton wrote:
> Thanks very much.
> I'm a beginner to this, so I'd appreciate being able to ask a few
> questions about setting this up.
> It asked for the path to my email archive. I had a folder on my desktop
> called Mail, but it's empty, and not connected to Mutt. I always just
> launch Mutt "live", and it connects to my gmail server, when I want to
> check my email.
> Do I need to somehow integrate Mutt with that archive folder for notmuch
> to work? How do I do that? Or should I give it somehow a different 
> path, into my Gmail?

These are the exact right questions to ask.

>From notmuch's website:

> Notmuch is not much of an email program. It doesn't receive messages (no POP or IMAP support). It doesn't send messages (no mail composer, no network code at all). And for what it does do (email search) that work is provided by an external library, Xapian. So if Notmuch provides no user interface and Xapian does all the heavy lifting, then what's left here? Not much.

So, notmuch can only read local email, and it needs to read the email completely in order to index everything; just mutt's IMAP header cache is not enough. You need to donwload all email for notmuch to read. This might even be good as an extra backup.

There are two ways I can think of:

(a) The way I am using. I do not use mutt's IMAP support; I use mbsync [1] to download all email from all my accounts, to ~/mail. I just use mutt to read the many mailboxes that are in ~/mail. After downloading the email, I can run `notmuch new` on ~/mail and index all new mail for search. mbsync supports two-way sync: it pulls the remote IMAP account to a local mailbox, but also supports pushing your local changes back to the remote, including moves, copies, flags and deletions - this means that while you might not be using IMAP in real time, there would still  be a way to retain the flexibility of IMAP.

(b) Just keep using mutt as-is, but always download an extra copy of all remote email using mbsync. For example, I run a systemd timer every 15minutes in the background which downloads all email and updates notmuch. This way, you do not need to ever worry about the sync. But then you're free to just use notmuch on the command line, or make some macros to use notmuch from within mutt like I posted earlier.

--
[1] https://isync.sourceforge.io/mbsync.html


More information about the Mutt-users mailing list