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

Re: Fcc hook simplicity?



On Sun, Jun 11, 2006 at 09:36:32PM +0700, Dave Patterson wrote:
> * Michael Tatge <Michael.Tatge@xxxxxx> [2006-06-11 16:27:24 +0200]:
> > I don't follow. If you use a recent mutt (1.5.X) series >>^<< references
> > the current folder.
> > So let's say all lists in under =lists, then:
> > folder-hook '=lists' 'set record="^"' will set record to =lists/foo
> > when you are in =lists/foo and =lists/bar accordingly.
> > 
> Ah.  The light comes on.  Thank you.  Now, it's time to go to bed.  I'm in
> Bangkok, and we have to get up early.

Note that you need to use a hook when you are using '^', since ^ 
references the current folder at the time of assignment.  ie. doing 
this by itself:

set record="^"

won't generally do anything useful since the value of record is being 
set to whatever the current folder is when that line is interpreted 
(when muttrc is loaded, *not* what it is at the time when the copyself 
mail is being saved.  If you put this in your muttrc (with nothing else 
modifying record) then you'll get record set to nothing useful.  You 
will not get the arguably desired effect of copyself emails being put in 
whatever folder you are currently in.  To do that you need to use a 
folder-hook - these are triggered when you *enter* folders (at which 
time ^ has a meaningful value)

I use this:

set record                       ="+z_sent"      # default copyself folder for 
batch mode
folder-hook  .        'set record="+z_sent"'     # default copyself folder for 
interactive mode
folder-hook  +list-*  'set record="^"'           # use current-folder for 
mailling-list copyselfs

The first line is to set a record folder for emails sent from the 
command-line (by scripts etc) - since Mutt never gets to enter a folder 
in such a case, the folder hooks would never get triggered and record 
would never have got set.

The second line sets a default folder for folders in general, and most 
importantly, resets the value when I go into a general folder after 
having been in one of the 'list-*' folders.  Otherwise, record would 
stay pointing to whichever list-* folder I was in most recently.

The third line sets the usage of the current folder whenever I enter one 
of my mailling-list folders.

(Disclaimer: I only just got this working myself, because I had 
previously overlooked exactly the problem I am describing.  Therefore I 
might still be completely wrong!  But it seems to be working for me)


Karl.