I would like to replicate GMail's "Filter Messages Like These" feature. Basically, I'm hoping to bind a key in mutt, such as *, and that can "Limit" displayed messages to those sent by the same sender (or senders if prefixed with ;)

I am trying the macro approach above, but struggling to read the sender address into a variable in mutt. Is macro the right way to go here? and what's the correct way to read message headers into variables?

2 Answers
2

Unfortunately it's not possible to populate variable from function. Even if You're able to call function <display-address>:push @, :exec display-address or using lua in neomutt – it's displayed in the bottom bar, but variable stays empty.

After consulting this issue today on #neomutt IRC the best option right now is using temporary file.

This macro will pipe message to formail which returns the from header, passes it to awk to get the e-mail address only and redirects output to /tmp/sender

or you can use any other command to parse e-mail address from the message.

EDIT: works only once per neomutt session. There's probably issue with variable expansion inside macro since it is in doublequotes and it has to be this way. So it's still probably not possible, at least easily.

This answer is based on Jakub Jindra's answer. Unfortunately, I didn't have enough reputation to post it as a comment to his correct answer but I thought this might help others who encounter the same issue.

This is a workaround to his macro that can fix the problem of one time expansion:

The main difference is instead of cating the file, I tried to source it. In this way, you will not have the variable expansion problem and it works as many times as you want in one session. Apparently, source is not an onetime expansion compared to cat since it's an internal mutt command however, cat is an external bash command which should be expanded.