Re: View-only of old Maildir files

ಚಿರಾಗ್ ನಟರಾಜ್ via Mut t-users <[email protected]> Fri, 26 Sep 2025 17:43:02 +0000
Newsgroups gmane.mail.mutt.user
Message-ID <aNbQncPn_v2iTVdX@chiraag-desktop>
12025/06/28 03:81.10 ನಲ್ಲಿ, [email protected] ಬರೆದರು:
> On Fri, Sep 26, 2025 at 12:15:42PM +1000, Philip Rhoades wrote:
> 
> > > Can you open one by hitting "c" and then typing "=NAME/" ?
> 
> > Ah! - that helped - I tried one of the dirs "=.00_caa" and that worked - so
> > it appears that it is a display problem, when I use "c" and then "?", I use
> > to see a complete list of all the subdirs - now all I see the contents of
> > the Maildir itself without any of the "dot" subdirs . .
> 
> How do you start mutt?
> 
> Unlike many, perhaps most, other MUAs, mutt's starting and main view
> is the list of emails in the starting mailbox / folder. *Not* a list
> of all mailboxes.
> 
> So when you just run "mutt" from the shell, mutt show the list of emails
> in the default mailbox that was compiled into it, usually something like
> /var/mail/philip. In your case it's likely that mailbox either doesn't
> exist or is empty, so you get a (mostly) blank screen. As specified.
> 
> As far as I know, it is not possible to change this default via .muttrc.
> What you can do is use a different command line:
> 
> - if you want to start with viewing a specific non-default mailbox, use
>   "mutt -f PATH_TO_MAILBOX". Once running, you can always use the "c"
>   command to switch to a different mailbox.
> 
> - if you want to see and browse the list of configured mailboxes, use
>   "mutt -y"
> 
> hth,
> 
> --
> Ian

Exactly. I have a whole system setup around this because I have a few different mailboxes that I only want to have to maintain in one place (that is, I shouldn't have to update the list of mailboxes in multiple places).

I setup a bash function that gets called as `run_mutt /path/to/RC/file`:

run_mutt()
{
    RC="$1"
    base=$(grep "^set folder=" ${RC} | sed 's/set folder=//g' | sed 's/"//g')
    mapfile -d ' ' -t MAILBOXES < <(grep ^mailboxes ${RC} | sed 's/mailboxes //g' | sed 's/"//g' | sed 's/+//g' | tr -d '\n')
    systemd-run --pty --user --wait --description="Mutt" firejail -- mutt -y -F "${RC}";
    for i in "${MAILBOXES[@]}"
    do
	important="${HOME}/.config/personal/important.$(basename "$i" | sed 's/+//g' | tr '[:upper:]' '[:lower:]')"
	systemd-run --user --wait --description="Update Important (${i})" --unit="update-$(basename "${important}").service" update-important.sh "${base/#\~/$HOME}/${i}/cur/" "${important}"
    done
    systemd-run --user --wait --description="Update notmuch database" --unit="notmuch-new.service" notmuch new
}

base is the base path to all of the maildirs and is set by finding the 'set folder' directive in the RC file (e.g. 'set folder="~/.local/mail"'). MAILBOXES is defined by finding and parsing the 'mailboxes' directive in the RC file (e.g. 'mailboxes "+MB1" "+MB2" "+MB3" "+MB4" "+MB5"'). I have a separate system that lets me flag important emails in Mutt and writes out their subjects etc into files upon exit so that I get those emails in my terminal (that's what the for loop does), but you can ignore that as well as the notmuch stuff (email indexer) if that's not relevant. All of this means that I can set the base folder and mailbox names once in my muttrc and this function picks out everything. Since I only have a few mailboxes (and the list is fairly static), it was easy enough to manually set it in my muttrc.

I believe you can use 'mailboxes = `command`' to set the mailboxes to the output of a shell command if you want as well (so you could write a shell script that automatically outputs the mailboxes in the required format - useful if the list of mailboxes keeps changing).

HTH!

- Chiraag
-- 
ಚಿರಾಗ್ ನಟರಾಜ್
Pronouns: he/him/his
publickey - [email protected] - 0xB0C8D720.asc (application/pgp-keys, 713 B)
-----BEGIN PGP PUBLIC KEY BLOCK-----
Comment: https://gopenpgp.org
Version: GopenPGP 2.8.2

xjMEX3EB/xYJKwYBBAHaRw8BAQdAP6U24AZA/0MONVORLNg2mG0TDfMH+Bff4wBf
sUn47kbNL21haWxpbmdsaXN0QGNoaXJhYWcubWUgPG1haWxpbmdsaXN0QGNoaXJh
YWcubWU+wo8EEBYKACAFAl9xAf8GCwkHCAMCBBUICgIEFgIBAAIZAQIbAwIeAQAh
CRCH19QDGejPyhYhBLDI1yBD7IRTpg4HpIfX1AMZ6M/KCngBAPe6pn3agW7xg5VX
aWQKT7vDrd9VqNBw+QosO9z6nj2oAQD9q5nffLnZIcHKUBhTrjXO34IFLfydimXj
hyVCXXpoC844BF9xAf8SCisGAQQBl1UBBQEBB0CGSL3dvsXCO9QSMN3tmUgGLTVE
k7xbsYRe3tWzI3rJLQMBCAfCeAQYFggACQUCX3EB/wIbDAAhCRCH19QDGejPyhYh
BLDI1yBD7IRTpg4HpIfX1AMZ6M/KjsQA/A/O8waaj+WnSvXf4ZTbBOMbajLyH7ZX
jthti9xSJDBTAP9vUpsSz2eIisWeIB1NVTtVJ2VKbRRb6vOQF9ICJBwCDQ==
=hG9L
-----END PGP PUBLIC KEY BLOCK-----
signature.asc (application/pgp-signature, 322 B)
-----BEGIN PGP SIGNATURE-----
Version: ProtonMail

wqsEARYIAF0FgmjW0KQJkIfX1AMZ6M/KNRQAAAAAABwAEHNhbHRAbm90YXRp
b25zLm9wZW5wZ3Bqcy5vcmcR8wYUyrLY27NcTiWIjVqxFiEEsMjXIEPshFOm
Dgekh9fUAxnoz8oAAJ6kAP9Nm8HMVmzvhrqzbEH1WClkQYp0n3gXCvh2emzY
M8Pr6QD/dOu9BKqXhD18Mr8DPAPoAiVDX1plLqIQsXVfx5ec7Qo=
=vqF0
-----END PGP SIGNATURE-----