NOTMUCH-MUTT(1)

πŸ’– NOTMUCH-MUTT πŸ’–

okay bestie, so this is notmuch-mutt from the User Contributed Perl Documentation section of the manual, and it is literally the little glue goblin that makes your notmuch and your Mutt hold hands. sit down, hydrate, let's go 🫢


✨ NAME ✨

notmuch-mutt β€” notmuch (of a) helper for Mutt 🌸


✨ SYNOPSIS ✨

notmuch-mutt [OPTION]... search [SEARCH-TERM]...
notmuch-mutt [OPTION]... thread < MAIL
notmuch-mutt [OPTION]... tag [TAGS]... < MAIL

✨ DESCRIPTION ✨

so notmuch-mutt is a frontend to the notmuch mail indexer, and its whole job is populating a maildir with your search results. that's it. that's the vibe. it takes your queries and turns them into an actual folder you can wander around in πŸ’…


✨ OPTIONS ✨

  • -o DIR, --output-dir DIR β€” stash your search results as (symlink) messages under the maildir called DIR. > ⚠️ beware bestie: DIR is gonna get overwritten. like, gone. (Default: ~/.cache/notmuch/mutt/results/) πŸ’€
  • -p, --prompt β€” instead of pulling search terms off the command line, it prompts you for them. (only works for "search" btw, don't try it anywhere else πŸ™ˆ)
  • -r, --remove-dups β€” yeets emails with duplicate message-ids out of your search results. (it does this by passing --duplicate=1 to the notmuch search command.) > ⚠️ heads up: this can hide search results if an email accidentally or maliciously uses the same message-id as a different email. so like, useful, but also a little unhinged. 😭
  • -h, --help β€” shows you the usage info and dips. iconic. ✨

🌈 INTEGRATION WITH MUTT 🌈

you can use notmuch-mutt to integrate notmuch with the Mutt mail user agent (shocking, I know, given the name πŸŽ€). to make that happen you gotta define macros in your Mutt config. that file is usually one of: ~/.muttrc, /etc/Muttrc, or a config snippet hanging out under /etc/Muttrc.d/. so pick your fighter and paste these in:

macro index <F8> \
"<enter-command>set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key<enter>\
<shell-escape>notmuch-mutt -r --prompt search<enter>\
<change-folder-readonly>`echo ${XDG_CACHE_HOME:-$HOME/.cache}/notmuch/mutt/results`<enter>\
<enter-command>set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key<enter>" \
      "notmuch: search mail"

macro index <F9> \
"<enter-command>set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key<enter>\
<pipe-message>notmuch-mutt -r thread<enter>\
<change-folder-readonly>`echo ${XDG_CACHE_HOME:-$HOME/.cache}/notmuch/mutt/results`<enter>\
<enter-command>set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key<enter>" \
      "notmuch: reconstruct thread"

macro index <F6> \
"<enter-command>set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key<enter>\
<pipe-message>notmuch-mutt tag -- -inbox<enter>\
<enter-command>set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key<enter>" \
      "notmuch: remove message from inbox"

let me break down what each of these lil guys does, because the way they ate πŸ’…:

  • the first macro, the one that fires on <F8>, prompts you for notmuch search terms and then jumps you to a temporary maildir showing off your search results. main character energy fr fr.
  • the second macro, <F9>, reconstructs the thread that corresponds to your current mail and shows it as search results. thread glow-up ✨
  • the third macro, <F6>, removes the tag "inbox" from the current message. and because you can just change that "-inbox" bit, you can customise this macro to add or remove whatever tags fit your notmuch work-flow. bespoke. πŸ‘‘

and to keep your notmuch index current you should periodically run "notmuch new". depending on your local mail setup you might wanna do that via cron, or as a hook triggered by mail retrieval, etc. whatever fits your setup, no judgement πŸ¦‹


✨ SEE ALSO ✨

mutt(1), notmuch(1) 🌸


✨ AUTHOR ✨

  • Copyright: (C) 2011-2012 Stefano Zacchiroli <zack@upsilon.cc> πŸ’œ
  • License: GNU General Public License (GPL), version 3 or higher πŸ“œ

okay that's the whole page bestie, you're officially fluent πŸ’– this was perl v5.42.0, dated 2026-01-31, and it's the NOTMUCH-MUTT(1) page from the User Contributed Perl Documentation β€” mwah, go search something iconic πŸŽ€πŸ‘‘βœ¨

πŸ“¦ where this page comes from