Macro to apply on current mailbox

Angel M Alganza ama at ugr.es
Mon Feb 15 23:44:42 UTC 2021


On Mon, Feb 15, 2021 at 07:13:05PM +0100, Genética wrote:
>On Mon, Feb 15, 2021 at 09:43:39AM -0800, Kevin J. McCarthy wrote:
>>On Mon, Feb 15, 2021 at 10:35:25AM +0100, Angel M Alganza wrote:
>>>	# Need to upgrade to > 1.8.0 (setenv)
>>>	folder-hook . 'set my_folder=$folder;set folder="XXX";set visual=^'
>>>	folder-hook . 'setenv MYSYNCFOLDER $visual'
>>>	folder-hook . 'set folder=$my_folder'
>>>	macro index \! "!/usr/bin/mbsync \$MYSYNCFOLDER\n"

>That somehow works, as does:
>
>  macro index \" "!/usr/bin/mbsync \$MYSYNCFOLDER\n"
>
>But, when I use it, I get:
>
>  No channel or group named '~/mail/mutt/' defined.
>
>It seems that the folder hooks are fetching the current maildir name 
>relative to my home, but mbsync would need its name relative to 
>~/mail/?
>Maybe adding some grep rule into the hooks would make that ~/mail/ part 
>go away?

:echo $visual shows now:

   =mutt   or   =inbox

I only need to get rid of the trailing =, but I can't find the way to do 
it with grep.  I think that this should do it:

   folder-hook . 'set box = `echo $visual | sed \'s/=//g\'`'

But it doesn't.  I get a too many parameters error.  I guess it has to 
do with the nested quotation marks, but I don't see how to do it.

Cheers,
Ángel


More information about the Mutt-users mailing list