Re: "folder" variable not set correctly
"Alan D. Salewski" <[email protected]>
| Newsgroups | gmane.mail.mutt.user |
|---|---|
| Message-ID | <ZogJF9buHf1dP7mC@localhost> |
On 2024-06-21 09:39:43, Todd Hesla <[email protected]> spake thus: >This may have been addressed in past discussions, but I am having a problem with >the $folder variable not getting set correctly by a "set" command inside a >"folder-hook". The details are as follows. > >I have two Gmail accounts, and want to be able to switch back and forth between >them using the folder browser menu. Unfortunately not everything gets switched >over to the other account when I switch over. Specifically, the $folder >variable seems to not be getting reset, despite my having an appropriate "set" >command inside the "folder-hook" command. > >The relevant part of my "muttrc" is appended below. > >What happens is this. Initially, the "user1" account comes up, and the $folder >variable is correctly set for that account. Unfortunately however, when I >switch to the "user2" account (using the "browse-mailboxes" command), the >$folder variable remains set to the "user1" folder. I've played around with >the configuration in various ways, changing some of the "folder-hook"s to >"account-hook"s, and trying re-ordering the commands in various ways, but >cannot get mutt to correctly set the $folder variable for the "user2" account. > >How can I get this to work? > >-- >Todd Hesla >Minneapolis MN > > >- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ># Here's the muttrc file: > >set imap_authenticators=oauthbearer >set smtp_authenticators=oauthbearer > ># Set initial folder. ># >set spoolfile=imaps://[email protected]:993/INBOX > ># GMail #1. ># >mailboxes imaps://[email protected]:993 > >folder-hook imaps://[email protected]:993 'set smtp_url=smtp://[email protected]:587' > >folder-hook imaps://[email protected]:993 'set imap_oauth_refresh_command="~/bin/mutt_oauth2.user1.py ~/.mutt/user1.tokens"' >folder-hook imaps://[email protected]:993 'set smtp_oauth_refresh_command="~/bin/mutt_oauth2.user1.py ~/.mutt/user1.tokens"' > >folder-hook imaps://[email protected]:993 'set folder=imaps://[email protected]:993' >folder-hook imaps://[email protected]:993 'set spoolfile=imaps://[email protected]:993/INBOX' >folder-hook imaps://[email protected]:993 'set record="imaps://[email protected]:993/[Gmail]/Sent Mail"' >folder-hook imaps://[email protected]:993 'set postponed=imaps://[email protected]:993/[Gmail]/Drafts' > >folder-hook imaps://[email protected]:993 'set hostname=gmail.com' >folder-hook imaps://[email protected]:993 'set [email protected]' > ># GMail #2. ># >mailboxes imaps://[email protected]:993 > >folder-hook imaps://[email protected]:993 'set smtp_url=smtp://[email protected]:587' > >folder-hook imaps://[email protected]:993 'set imap_oauth_refresh_command="~/bin/mutt_oauth2.user2.py ~/.mutt/user2.tokens"' >folder-hook imaps://[email protected]:993 'set smtp_oauth_refresh_command="~/bin/mutt_oauth2.user2.py ~/.mutt/user2.tokens"' > >folder-hook imaps://[email protected]:993 'set folder=imaps://[email protected]:993' >folder-hook imaps://[email protected]:993 'set spoolfile=imaps://[email protected]:993/INBOX' >folder-hook imaps://[email protected]:993 'set record="imaps://[email protected]:993/[Gmail]/Sent Mail"' >folder-hook imaps://[email protected]:993 'set postponed=imaps://[email protected]:993/[Gmail]/Drafts' > >folder-hook imaps://[email protected]:993 'set hostname=gmail.com' >folder-hook imaps://[email protected]:993 'set [email protected]' Hi Todd, I tested a variation of the config you provided using two IMAP accounts (neither of them Gmail, though, but that shouldn't matter). The main difference from the config you posted is that where you had 'folder-hook' lines that change 'imap_oauth_refresh_command' and 'smtp_oauth_refresh_command': folder-hook imaps://[email protected]:993 'set imap_oauth_refresh_command="~/bin/mutt_oauth2.user1.py ~/.mutt/user1.tokens"' folder-hook imaps://[email protected]:993 'set smtp_oauth_refresh_command="~/bin/mutt_oauth2.user1.py ~/.mutt/user1.tokens"' the config I used had 'account-hook' likes that instead changed 'imap_user' and 'imap_pass': account-hook "${my_account1_imap_url_base}" 'set imap_user="${my_account1_username}"' account-hook "${my_account1_imap_url_base}" 'set imap_pass="${my_account1_app_pass}"' I haven't used the *_oauth_refresh_command settings, but because they are authentication-related, I suspect you may want to be setting them from an 'account-hook' rather than from a 'folder-hook'. -Al -- a l a n d. s a l e w s k i [email protected] [email protected] https://github.com/salewski