<div dir="ltr"><div>How do I create a macro which sets $folder differently depending on attributes of the current message?</div><div><br></div><div>Motivation:<br></div><div><br></div><div>I have multiple email accounts (for example, a personal email and a work email) and I have created a virtual folder that shows me a mixture of emails from the different accounts via a notmuch search.</div><div><br></div><div>I would like to have a keyboard shortcut that copies the current message to another folder, but I would like the location of the folder that it is copied to to be different depending on which email account the message is from. This is because I need to keep any saved work emails in a separate location from all of my other emails.<br></div><div><br></div><div>"which email account the message is from" could be detected via (1) notmuch tags, or (2) by the folder location of the current message, or (3) by the To: address in the message.</div><div><br></div><div>To accomplish this, I would like to create a macro which (a) redefines the $folder variable, with conditional branching based on (1), (2), or (3) in the previous paragraph, and then (b) uses the new $folder variable to determine the path to which to copy the message.</div><div><br></div><div>Therefore my question is, how do I create a macro which sets $folder differently conditioned upon (1), (2), or (3)?</div><div><br></div><div>If this is not possible, then I suppose a workaround would be to apply a special notmuch tag, and then to call a custom shell script. But it would be preferable to do everything within neomutt.<br></div><div><br></div><div>thanks,</div><div>  Bayle<br></div></div>