<<< Date Index >>>     <<< Thread Index >>>

Re: How to change dynamically the From hdr?



On Mon, Feb 16, 2009 at 10:00:53PM +0100, Ennio-Sr wrote:
* Rocco Rutte <pdmef@xxxxxxx> [160209, 16:44]:
Yes, this works like a charm. What _exactly_ happens in your case? A
guess: you put ^ and U in there instead of a Control-U character?

I just put an '^' and a 'U' as can be seen printed in my lines above.
I do not know how to put a 'Control-U charachter' in .muttrc being
edited with 'vim'. (Tried with '<C-U>, which appears to be 'vim'
syntax, to no avail). Anyway ...

If you really wanted to do this, as opposed to the much cleaner syntax below, to insert a literal Control-U with vim in insert mode you'd press Control-V, then Control-U. vim will probably display the character in a different color, to emphasize that it's a single Control-U character, not a sequence of "caret, uppercase U".

If you try to edit the from line, mutt fills it with the content already
there. Control-U or <kill-line> editor function clears that line. Thus,
the above is equivalent to:

       macro compose z "<edit-from><kill-line>Identity_<tab>" "Select from"


I changed the macro line to read as you suggest (with 'kill-line') but
still get the same result, i.e. nothing at all happens when I press 'z'
while being in the 'compose menu' (i.e. the page pre-filled with my
chosen headers that appears on the console when - within mutt - I press
'm').

It works for me.  Relevant sections of my .muttrc:

alias Identity_default Ed Blackman <ed@xxxxxxxxxxx>
alias Identity_school  Ed Blackman <addr@xxxxxxxxxx>
alias Identity_hobby   Ed Blackman <addr@xxxxxxxxx>

set from="Identity_default"
send-hook .                     my_hdr "From: Identity_default"
send-hook "~t .*school.edu"   my_hdr "From: Identity_school"

macro compose z "<edit-from><kill-line>Identity_<tab>" "Select from"

With this configuration, when I reply or compose a new message, mutt prompts me for the address and subject, then runs my editor. When I save and exit my editor, I come back to the mutt compose menu. (The send hooks are optional, and set a different default on messages to people at my school.) I can then press "z" and choose between the three identities that I established.

Could it be related to my using vim as the default editor to compose the
message?

Mutt is in control at the compose menu, so your editor doesn't matter. FYI, I also use vim.

Ed

Attachment: signature.txt
Description: Digital signature