On Sun, Jan 18, 2004 at 10:27:00PM EST, William O'Higgins wrote: > I am trying to create a macro to change my headers in the compose > screen. I use a mess of different email addresses which I manage with > different rc files. If my config [1] is useful but lacks specific functionality you need, there's a high probability that I'm willing to add it (or that I'm already planning to add it - see the TODO file), if not to my own config at least as a "special order" for you. As you can tell from my "From:" address here, I have my address set automatically depending on a few factors. I can add more without much difficulty. > Some instances are taken care of with folder hooks, folder-hooks are probably the only thing you won't see from me. I keep all my mail (including sent mail) in my inbox until it gets sufficiently old, and then I move it to my oldbox. If I want to read through messages for a particular list without being bothered with other stuff, I just limit to it. (Likewise, if I just want to see stuff I sent off to my best friend, I just run a limit query. I see no reason for separate boxes except to avoid the overhead of writing to a huge inbox, and an oldbox is sufficient for that.) > but sometimes I get through a message, and then discover that I'm using > the wrong rc file. Right now I edit the headers manually, but that's > obviously annoying. What I want is to press a key and change both the > >From and the Reply-To headers. Here's what I tried so far: Well, you can do something like this: macro compose <f5> ":set editor=\"echo -e '/From:/s/^.*$/From: William O\'Higgins <addy_I_want@xxxxxxxxxxx>/\nwq' | ed\"\n<edit-headers>:set editor=\"vi\"" > macro compose > <f5> "my_hdr From: William O'Higgins <addy_I_want@xxxxxxxxxxx>" Nope, that won't work. When you're in the compose menu, Mutt has already created the message, so it's too late for a my_hdr to take effect. It'll only affect messages you compose after that. > I was going to worry about adding the change to the Reply-To once I got > it half right, but I haven't got there yet. Once you get that complex, it's easier to make an editor script: macro compose <f5> ":set editor='some_script'\n<edit-headers>:set editor='vi'" ...and here's some_script: #!/bin/sh file=$1 ( echo "/From:/s/^.*\$/From: William O'Higgins <addy_I_want@xxxxxxxxxxx>/" echo "/Reply-To:/s/^.*\$/Reply-To: William O'Higgins <addy_I_want@xxxxxxxxxxx>/ wq" ) | ed $file > Can anyone point me in the > right direction? Thanks. There's no single right direction, but I just pointed you in a right direction :-) - Dave -- Uncle Cosmo, why do they call this a word processor? It's simple, Skyler. You've seen what food processors do to food, right? Please visit this link: http://rotter.net/israel
Attachment:
pgplVltXSqKac.pgp
Description: PGP signature