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

Emulating certain Pine foldering behaviour



I am trying to emulate pine's behaviour for managing
sent-mail folders.  basically, on the first of the month it
(a) renames sent-mail to sent-mail-{mon} where {mon} is the
previous month; and (b) offers to delete old sent-mail
folders.  Towards those ends, I intend to alias mutt to the
following shell function I have written:

--begin code snippet--
Mutt () 
{ 
  if [[ $(date +%d) -eq "01" ]]; then
     sf=$(date +sent-mail-%b-%Y | tr A-Z a-z);
     if [[ ! -f ${HOME}/mail/$sf ]]; then
       echo "moving sent-mail to $sf."
       echo mv -i ${HOME}/mail/sent-mail $HOME/mail/$sf
     fi;
  fi
  $(which mutt) "$@"
}
--end code snippet--

where $@ is some appropriate sequence to push a la:

$ mutt -e "push \<ctrl\>\<B\>"

Now, I have two questions:

1. Args to push are to be a keystroke sequence mapped to the
equivalent of: 

--begin quote--
for folder in $(ls -tr $HOME/mail/sent* | \
grep -v $(ls -tr $HOME/mail/sent* | sed '1!G;h;$!d' |\
sed "2q;d") | grep -v sent-mail$ )
do
  echo "To save disk space, delete $folder [y/n] ?"
  read reply
  case "$reply" in 
    N|n*) : ;;
    Y|y*) echo removing $folder ;;
    \?) reply not understood ;;
  esac;
done
--end quote--

So how do map a keystroke to this in my .muttrc? Will it be
*in* my .muttrc, or will I have to save this as another
function and specify the *function* in my .muttrc?

2.  Note escapes of angle brackets in CL prompt above.  I
have a problem though.  Mutt understands <enter> for the
enter key, <tab> for the tab key, and so on.  So what do if
I want to send mutt, say, Ctrl-B, (control key followed by B
key) for instance?  escaping the angle brackets does not
work.  Neither does any nesting I tried.

I never received my post on this last point from yesterday,
so apologies if you recieved it twice.

Thanks,
GJ