6

I'm wondering if there is anyway to "search" or "limit" in the mutt index based on text yanked from either an "edit" or "page" mode.

I'm trying to build a macro for the index, that when pressed will limit the index to only mail from (~f) the From: .*$ regex of the current item.

What this will help me to do is see the context of all the messages from a particular sender... it also helps when people accidentally "break threads" when they shouldn't.

I was hoping it would be similar to vim as discussed here and i could yank text from one area and then type ^R" to paste back into the "search" or "limit" prompt.

I tried to make a macro to go into edit and then search for the from string, but i can't figure out how to paste it back into anything in the index...

Community
  • 1
  • 1
joefromct
  • 1,506
  • 13
  • 33

1 Answers1

5

Here is an incomplete (and ugly) solution:

macro index O "|grep ^From | awk 'NR==1 {printf \"macro index Q l%s\",$2}' > /tmp/from;echo>>/tmp/from\n:source /tmp/from\nQ"

The O macro will extract the from address from the current message, and save a new macro definition to /tmp/from.

Then it will source that definition, and finally execute it.

Note: I'm having trouble adding newlines in the script (that's the reason for the echo>>, and the need for you to press enter at the end of the limit prompt. Will try to improve this.

Juancho
  • 7,207
  • 27
  • 31
  • This works great, thanks. I've only changed the keybindings as the "Q" one is basically a throwaway (and not one that i'll ever use non-programatically). – joefromct Feb 04 '15 at 18:35