folder-hook fails to use the current mailbox folder if another instance of mutt runs in same terminal
I use folder-hook in .muttrc. E.g.:
folder-hook /home/$USER/Maildir/.user@domain1 'set alias_file=~/.mutt/us-domain1-aliases; \ source ~/.mutt/us-domain1-aliases; mailboxes =
echo /home/$USER/Maildir/.user@domain1*`;
set spoolfile = /home/$USER/Maildir/.user@domain1;
set from="Us Er us.er@dom.ain1"; set pgp_default_key="0xDEADBEAF12345678";
set envelope_from_address=us.er@dom.ain1'
folder-hook /home/$USER/Maildir/.user@domain2 'set alias_file=~/.mutt/us-domain2-aliases;
source ~/.mutt/us-domain2-aliases; mailboxes = echo /home/$USER/Maildir/.user@domain2*
;
set spoolfile = /home/$USER/Maildir/.user@domain2;
set from="Us Er us.er@dom.ain2"; set pgp_default_key="0xDEADBEAF12345679";
`
and I've just had a difficult nervous time, because I started mutt in a terminal where I already had another instance of mutt running in .user@domain2 folder.
I changed directory to .user@domain1, wrote an email and sent it, only to later discover that Mutt decided that the sender need to be set by domain2 not domain1 as the directory of the new instance should imply.
I believe the only reason that happened is because of the previously started instance of mutt, that I forgot to exit, which was running in .user@domain2 directory.
I believe this should be solved in the Mutt code, either Mutt knowing its own instance, or deciding not to start in a terminal where another instance of Mutt is already running.