** Cameron Simpson <c...@zip.com.au> [2015-09-26 12:58]:
> On 26Sep2015 08:00, Cameron Simpson <c...@zip.com.au> wrote:
> >The muttrc is read just once at startup. It looks like you want to source
> >your per-domain files on folder switch. I'd be inclined to prepend "set
> >imap_user = p...@domain1.com" to your muttrc.domain1.com file, and write
> >the hooks like this:
> >
> >account-hook imaps://em...@domain1.com@imap.localdomain.com 'source 
> >~/.mutt/muttrc.domain1.com'
> >account-hook imaps://em...@domain2.com@imap.localdomain.com 'source 
> >~/.mutt/muttrc.domain2.com'
> >
> >and so forth. That way the _entire_ domainX.com setup is sources on folder 
> >switch.
> 
> I've been doing some tests (and swanking up my muttrc config). And reading
> the Fine Manual:
> 
>  http://www.mutt.org/doc/devel/manual.html#account-hook
> 
> It seems that the account-hooks are only consulted when mutt needs to access
> a remote folder (IMAP, etc). It is consulted not just when you visit an IMAP
> folder but also whe mutt polls a remote folder, etc. So anything in an
> account-hook might be run at any time, depending on your config.
> 
> By contrast the folder-hooks are used reliably for every folder entry.
> 
> So I've now got the following in my setup (somewhat edited here):
> 
>  set my_cs='c...@zip.com.au'
>  set my_cs_iphone='email-which-delivers-to-my-phone@blah'
>  set my_cs_clipboard='email-which-delivers-a-shared-folder@glargh'
>  set my_local_mail="$HOME/mail"
> 
>  folder-hook . 'set my_account_email=$my_cs; set folder=$my_local_mail'
>  folder-hook 'imaps://my-phone-imap/' 'set my_account_email=$my_cs_iphone'
>  folder-hook 'imaps://the-clipboard-imap/' 'set 
> my_account_email=$my_cs_clipboard'
>  folder-hook . 'set status_format="$my_account_email [Msgs:%?M?%M/?%m%?n?  
> New:%n?%?o? Old:%o?%?d? Del:%d?%?F? Flag:%F?%?t? Tag:%t?%?p? Post:%p?%?b?  
> Inc:%b?%?l? %l?]---(%s/%S)-%>-(%P)"'
> 
>  account-hook . 'unset imap_user; unset imap_pass; unset tunnel'
>  account-hook 'imaps://my-phone-imap/' 'source "cs-mutt-imap-settings 
> cs-iphone-cc |"'
>  account-hook 'imaps://the-clipboard-imap/' 'source "cs-mutt-imap-settings 
> clipboard |"'
> 
> The folder-hooks run on every folder entry, including the last one which
> sets a per-folder $status_format. The account-* files set only usernames and
> passwords, sucked from my .fetchmailrc.
> 
> You might find it useful to move your status_format into folder-hooks and
> keep the account-hooks purely for passwords.
> 
> Cheers,
> Cameron Simpson <c...@zip.com.au>
** end quote [Cameron Simpson]

Looks interesting, I'll have to explore further. I've been tidying my config 
too. Initially removed some folder-hook lines at the bottom that seemed to 
duplicate everything that was in the source files for my account-hook lines (a 
legacy from earlier configs I think). Having looked at your previous email I 
experimented with moving the imap_user into the source'd file and it did allow 
the config to modify the status_format.

There were a few downsides to this:

Firstly, the tab completion of the accounts when changing directory vanished; I 
used to be able to start with im for imaps:// and tab complete from there.

Secondly, once all accounts were modified it stalled on sorting mail; this was 
fixed by putting an imap_user in for the default account.

Thirdly, once I manually type account details in (imaps://... etc.) and switch 
to a different account the performance nose dives and everything pauses before 
each action, even when I switch back to the main account performance is poor - 
likely due to the fact that using = hasn't switch to referring to the main 
account. I've also just noticed I've lost my signature.

Clearly this needs more work, and I'm learning quite a bit in the process. It 
is amazing how long you can get along using some software without fully 
understanding everything about it. I started using Mutt back in 2001 I think.

--
 Paul Tansom  |  Aptanet Ltd.  |  https://www.aptanet.com/  |  023 9238 0001
 Vice Chair, FSB Portsmouth & SE Hampshire Branch  |  http://www.fsb.org.uk/
=============================================================================
Registered in England | Company No: 4905028 | Registered Office: Ralls House,
Parklands Business Park, Forrest Road, Denmead, Waterlooville, Hants, PO7 6XP

Reply via email to