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

Re: [mmd@xxxxxxxxxxxxx: Alter egos]



On Wed, Sep 08, 2004 at 11:21:18PM -0400, Matthew M Davis wrote:
[...]
> BUT...if I begin to edit a school message (in jed), and then exit
> without changes, the variables remain set to school, because I never
> get to the compose screen where my macros for resetting do the job.
[...]
> Can anyone think of a better way to handle this problem?

Well, here's what I've been using for the past years:

I have several keys mapped to "switch" to other mailadresses/sigs (call
it 'profiles' or whatever) and one key to switch back. The bindings I'm
using are as follows:

-------------
# set emgaron address
macro index ",y" ":color status black magenta;color indicator white 
magenta;send-hook . 'set sendmail=\"/usr/lib/sendmail -femgaron@xxxxxxx -oi 
-oem\"'"
macro index "\ey" ":send-hook . 'my_hdr From: emgaron@xxxxxxx'\r:send-hook . 
'set signature=~/.sigs/emgaron'\r,y\r<^l>" 'Set emgaron@xxxxxxx alias'

# reset address
macro index "\ez" ":color status white blue;color indicator white red;unhook 
send-hook\r:source ~/.mutt/send-hooks\r<^l>" 'Reset to standard alias'
------------

A few remarks:

- The keys used are Esc-y (alternative address) and Esc-z (reset). I
  actually have a lot more than that, as I have a handful of
  addresses...
- I've split the first macro in two parts (the first one being called by
  ",y"), as I used to have problems with the length of the macro when I
  first made it ages ago. Might well be that this isn't necessary
  anymore.
- The macros also change the colours of the index, so I'm always aware
  of the fact that I'm using a "non-standard" address.
- The macros also change the user/from via sendmail, to change the
  headers of the mail as fully as possible. Probably overkill, but I
  liked it better that way. You can most likely leave that out, which
  would shorten the macros significantly.
- I've split my muttrc into several files that get read from the master
  one. That way I have more control and can use tricks like above with
  "send-hooks" - I just re-read that file to reset everything to
  default. In "send-hooks" I have:
  
  # defaults
  send-hook .             'set sendmail="/usr/lib/sendmail -oi -oem"'
  send-hook .             'set signature=~/.sigs/default'
  send-hook .             'my_hdr From: "T. Ribbrock" <MY@xxxxxxxxxxxxxxxx>'
  
- I also have additional send-hooks for mailinglists, but that's nothing
  special - everybody does that, right? ;-)

All in all, it works like a charm. The *only* catch is that I need to
remember hitting the Esc-y *before* hitting 'm', but I can live with
that...

HTH,

Thomas
-- 
-----------------------------------------------------------------------------
        Thomas Ribbrock       http://www.ribbrock.org/muttix (mutt RPMs)
                          http://www.ribbrock.org
   "You have to live on the edge of reality - to make your dreams come true!"