Hi.

I've change a function a little. Now it takes only name of recipient (if it's
there) and its address otherwise. If there are multiple recipients in To:
field, it takes only first one (the title string can be too long).

function M_settitle()
    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, " ")
        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")
        execute 'set titlestring=' . title
        execute 'set iconstring=' . title
        execute 'set titleold=Mutt'
    endif
endfunc

Also note that is assumes that you have 

        set edit_headers

in your .muttrc

Peter.

Reply via email to