Offlineimap only for current folder

Oleg A. Mamontov oleg at mamontov.net
Thu Jul 28 13:44:07 UTC 2022


Hi,

On Thu, Jul 28, 2022 at 09:29:34AM -0400, José María Mateos wrote:
>Hi all,
>
>I have offlineimap running on a cron job every 5 minutes, but from 
>time to time (for example, I've received a login code) I want to 
>refresh the current folder faster. For that, I have this macro:
>
>macro index,pager G "!offlineimap\n" "Retrieve new IMAP messages"
>
>It works well, but this refreshes all folders; I'd be great if it 
>worked only for the folder I'm currently in. Is there any "environment 
>variable" for the macro that I can use in this case?

I use the following approach for the same problem but with mbsync:
---
folder-hook . "source ~/.mutt/on-folder-change"
---

where ~/.mutt/on-folder-change has the below content:
---
set record = ^
set my_folder = `echo $record | sed 's|.*/||' | sed 's|\\.|/|g'`
macro index,pager <esc>o ":unset wait_key<enter><shell-escape>clear; printf '# syncing =$my_folder\\n\\n'; mbsync full:$my_folder<enter>:set wait_key<enter>" "sync current folder"
---

I know, it looks a bit creepy but works pretty well :)

>Thanks!
>
>-- 
>José María (Chema) Mateos || https://rinzewind.org

-- 
Cheers,
Oleg A. Mamontov

email: oleg at mamontov.net
phone: +7 (903) 798-1352


More information about the Mutt-users mailing list