Macro to apply on current mailbox

Angel M Alganza ama at ugr.es
Mon Feb 15 18:13:05 UTC 2021


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"

>You've overridden <shell-escape>, bound to '!' by default, with your 
>macro.  But then you are trying to use '!' inside the macro.  That's a 
>loop - instead of calling <shell-escape> you are calling your macro 
>inside the macro.

Oh boy!  That's embarrassing (even though I didn't write the macro, but 
I got it somewhere or from someone).  LOL

Also, I don't want to override <shell-escape> at all!  I was just using 
! because it happens to be beside the " in my (Spanish) keyboard and now 
I'm using " in a macro to fetch my inbox like so:

   macro index  \" "!/usr/bin/mbsync inbox\n"
   macro pager  \" "!/usr/bin/mbsync inbox\n"

But, actually, I won't be needing that when I can fetch the current 
maildir I'm working in with the new macros I'm trying to get working, 
so, I'll be using " for that (in case I'm not missing something with 
overriding ", too).

>Try (untested):
>  macro index \! "<shell-escape>/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?

Cheers,
Ángel


More information about the Mutt-users mailing list