* Ailbhe Leamy [[EMAIL PROTECTED]] on [29-03-01] wrote:
> However, I obviously expressed myself badly. What I actually want is
> the ability to hit
>  ^foo 
> and have it change the From and Sig to a pre-determined one,
> presumably using a :set command. ^bar to change to a different
> one. I'd prefer to be able to do this _after_ composing a message, but
> will accept answers on how to do it in the index.

Here is a solution, provided you use vim as your editor.  If you don't
then the general idea should allow you to create a similar function
for your own editor.

:map ;f /-- <CR>dGo-- <ESC>:r !/usr/games/fortune<CR>/^From:<CR>C
\From: Brian Foley <[EMAIL PROTECTED]><ESC>

:map ;g /-- <CR>dGo-- <ESC>:r !/usr/games/fortune<CR>/^From:<CR>C
\From: Brian Foley <[EMAIL PROTECTED]><ESC>

the "\" in front of the second lines of both macros are line
continuation characters, if they dont work then just remove them and
join the two lines before you put them in your .vimrc.

These will toggle between two set From: lines while you are composing
and randomise the sig.  It could be easily adapted to use fixed sigs
as well, just change the !/usr/games/fortune bit to some fixed text
(or a unique sig file).  Setting the Reply-To: would also be trivial.

This assumes a couple of things:
1. you already have a sig in the file with a "-- " seperator
2. you have edit_headers turned on
3. you don't have any other lines beginning with "From:"

I hope this helps.  But please note that I havent acutally tested any
of this.
  Brian.


P.S.
This has nothing to do with your post, but here is another cool vim
trick that I discovered on this list a while back, and which may be of
interest to the rest of the group.  Put the following in your
.vimrc.mail (or whatever .vimrc you source while editing mail):

" Give mutt's window a proper header when composing
let i = 1
let line = getline(i)
while (match(line, "To:") == -1 && line != "")
    let i = i + 1
    let line = getline(i)
endwhile
if (line != "")
    let i = match(line, " ") + 1
    let j = match(line, "<") - 1
    if j == -2
        let j = match(line, ",")
    endif
    if j == -1
        let j = strlen(line)
    endif
    let len = j - i
    let address = strpart(line, i, len)
    let title = "Mail to " . address
    let title = substitute(title, " ", "\\\\ ", "g")
    let title = substitute(title, "\"", "", "g")
    execute 'set titlestring=' . title
    execute 'set iconstring=' . title
else
    execute 'set titlestring=Mutt'
    execute 'set iconstring=Mutt'
endif
execute 'set titleold=Mutt'

This will give a meaningful title to your xterm window when you are
composing mail.  If anybody has the time to improve it (eg when you
send mail to mulitple people) I would be interested!!!


-- 
Brian Foley -- [EMAIL PROTECTED] -- www.maths.tcd.ie/~brianf
Visit the Intervarsity Track & Field web-site:  www.iv2001.com

Reply via email to