1

I have Mutt set up to switch to different accounts using a macro which works fine, but when I switch the Sidebar simply appends the folders of the account I'm switching over to below the folders of the mailbox I was in.

I wish the Sidebar just to display the folders of the account I'm currently in.

I use imap_check_subscribed to automatically get a list of the folders of the mailbox. I have attempted the 'refresh' command within the macro of the account switching in the hope this will re-draw the sidebar to just show my current folders but it does not work.

Strangely, using the C keybind to display the list of folders, it just list the ones of the mailbox I am in ... which is exactly what I want the sidebar to display only.

A hint - I'm not sure if the 'folder-hook' I have is at fault. Commenting these lines out in .muttrc has no effect whatsoever on the working of the account switch. I can't see where I'm going wrong with it though.

The .muttrc :

# ACCOUNT 1
source "~/.mutt/accounts/ACCOUNT1/accountinfo"
folder-hook $folder source '~/.mutt/accounts/ACCOUNT2/accountinfo'
# ACCOUNT 2
source "~/.mutt/accounts/ACCOUNT2/accountinfo"
folder-hook [email protected]/ source 'source ~/.mutt/accounts/ACCOUNT2/accountinfo'
# ACCOUNT 3
source "~/.mutt/accounts/ACCOUNT3/accountinfo"
folder-hook [email protected]/ source ~/.mutt/accounts/ACCOUNT3/accountinfo'


set sidebar_visible = yes
set sidebar_short_path = yes
bind index,pager B sidebar-toggle-visible

# Assign key to switch between accounts
macro index <f2> '<sync-mailbox><enter-command>source ~/.mutt/accounts/ACCOUNT1/accountinfo<enter><change-folder>!<enter><refresh>'
macro index <f3> '<sync-mailbox><enter-command>source ~/.mutt/accounts/ACCOUNT2/accountinfo<enter><change-folder>!<enter><refresh>'
macro index <f4> '<sync-mailbox><enter-command>source ~/.mutt/accounts/ACCOUNT3/accountinfo<enter><change-folder>!<enter><refresh>'

macro index 'c' '<change-folder>?<change-dir><home>^K=<enter>'

# LOOK AND UI SETUP
source ~/.mutt/colours
source ~/.mutt/behaviour

Example of account file:

# RECEIVE OPTIONS 
set imap_user = [email protected]
set imap_pass = xxx
set folder = imaps://[email protected]@imap.gmail.com/
set spoolfile = +INBOX
set postponed = +Drafts
set record = +Sent


# SEND OPTIONS
set smtp_url = smtps://smtp://[email protected]@smtp.gmail.com
set smtp_pass = xxx
set realname = 'xxx xxx'
set from = [email protected]
set hostname = "gmail.com"


# OTHER
set header_cache = "~/.mutt/accounts/xxx/cache"
account-hook $folder "set [email protected] imap_pass=xxx"
set imap_check_subscribed = yes

And behaviour file:

# Check mail every 30 mins
set mail_check = 1800

# View HTML messages using w3m (defined in ~/.mailcap)
auto_view text/html

# Keybindings
bind pager j next-line
bind pager k previous-line

I'm new to the game but been finding my way mostly OK until now... any help much appreciated.

1 Answer 1

2

Add unmailboxes * to the beginning of each account config file

Mutt docs:

The “unmailboxes” command is used to remove a token from the list of folders which receive mail. Use “unmailboxes *” to remove all tokens.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .