Macro to apply on current mailbox

Angel M Alganza ama at ugr.es
Mon Feb 15 09:35:25 UTC 2021


Hello:

I am trying to build a macro to apply a function to the current maildir, 
but I can't find the way to capture the current maildir into a variable.

The idea is as follows: I synch my mail with mbsync, which I run from a 
crontab entry at different time intervals for different mail folders.

Some times I want to manually force the synchronization, if for example 
I'm expecting an email in a maildir which has a low cycle, or I'm doing 
some testing and I need to check my inbox faster than my cron does.

At the moment I have a few macros to do that on my inbox, my 'new', 
'day', and 'old' groups of maildirs:

	macro index  \" "!/usr/bin/mbsync inbox\n"
	macro pager  \" "!/usr/bin/mbsync inbox\n"
	macro index  · "!/usr/bin/mbsync new\n"
	macro pager  · "!/usr/bin/mbsync new\n"
	macro index  ( "!/usr/bin/mbsync day\n"
	macro pager  ( "!/usr/bin/mbsync day\n"
	macro index  ) "!/usr/bin/mbsync old\n"
	macro pager  ) "!/usr/bin/mbsync old\n"

That does the job, but what I would really want is to force the synchronization
of the current maildir I'm working in. A while ago somebody (I don't think it
was here in the mailing list, or I'd have kept the thread) suggested me to use
the following folder-hooks and macro:

	# 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"
	#macro index \" "!echo \$MYSYNCFOLDER\n"

Now that I have finally upgraded, I'm trying it out again and, when I press ! I get an error message:

	Macro loop detected

The only info I can find which contains that string is written in cyrillic
alphabet, so I don't understand a single word.  :-)

Any pointer to what the problem might be, please?  I understand how macros
work, but I'm very new to hooks and I'm not grasping them well enough yet.

Thanks in advance.

Cheers,
Ángel 


More information about the Mutt-users mailing list