Macro variable with current folder name?

José María Mateos chema at rinzewind.org
Sun Mar 12 00:54:17 UTC 2023


On Sat, Mar 11, 2023 at 07:30:13PM +0100, Dennis Preiser wrote:
>When I use the following macro inside the folder-hook (I don't have
>offlineimap)
>
>macro index,pager G "!/bin/echo $record\n"; \

Ok, found the issue. The problem is that the folder name contains '=' 
(as in =INBOX) and for folders also '/' (as in =mutt/). These characters 
need to be removed or offlineimap, understandably, doesn't understand 
what folder I'm talking about.

This is the end solution (which works for my folder structure, other 
people might need a different sanitizing function):

folder-hook . 'set my_record=$record; \
                set record=^; \
                macro index,pager G "!offlineimap -o -l /tmp/offlineimap.log -f $(echo $record | sed -e 's/[=\/]//g')\n" \
                     "Retrieve new IMAP messages for current folder"; \
                set record=$my_record'

Thanks a lot for your help.

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


More information about the Mutt-users mailing list