mutt - index search on yanked text
Asked Answered
A

1

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...

Avaunt answered 29/1, 2015 at 9:56 Comment(0)
L
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.

Lord answered 29/1, 2015 at 13:18 Comment(1)
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).Avaunt

© 2022 - 2024 — McMap. All rights reserved.