On Wed, Nov 15, 2000 at 03:03:57PM +0800 or so it is rumoured hereabouts, 
lang thought:
> On Tue, 14 Nov 2000, Mikko Hänninen wrote:
> 
> > Juergen Salk <[EMAIL PROTECTED]> wrote on Tue, 14 Nov 2000:
> > > To make a long story short: How can I make the cursor highlight
> > > the last visited mailbox in the folder view rather than the
> > > first one in the list?
> > 
> > There's no simple way (unfortunately).
> > 
> > I think someone's created a set of .muttrc macros possibly combined with
> > an external shell script or two that achieves this effect by storing the
> > number of "down arrow" keystrokes in the folder browser, and then
> 
> I think something like a list of macros like the following in
> .muttrc works.
> 
> folder-hook . 'macro index h <change-folder>?<tab><jump><enter>0<enter>'
> folder-hook '!' 'macro index h <change-folder>?<tab><jump><enter>1<enter>'
> folder-hook =mutt 'macro index h <change-folder>?<tab><jump><enter>2<enter>'
> folder-hook =vim 'macro index h <change-folder>?<tab><jump><enter>3<enter>'
> ... etc etc
> 
> where 'h' is the key you use to return to the browser from the
> index, and the order of folders is the order you have in the
> mailboxes command. The folder hooks essentially write a new macro
> for the key every time you enter that particular folder. The
> problem with this solution is that every time you add a new
> mailbox to your .muttrc, you need to rewrite the hooks. I wrote
> some vim mappings to do this more easily, but they are not
> robust, so I won't copy them here.

I'm kinda thinking a script off the mailboxes line in .muttrc.  You know
the thread a while ago about doing something like

mailboxes `ls ~/Mail/* | grep -v <stuff you don't want to include>`

Now, if that went in a script and became something like

------- cut here -----------
#!/bin/bash
echo > ~/.mailboxchooser
echo "~/mbox" > /tmp/boxes
COUNT=1
# The "cut -f5-20 -d/" command needs to be modified to suit your paths.  My path
# looks like "/home/cdaly/Mail/<mailboxes/and/subfolders>
# Counting the leading / as the first field, I need to dump the first 4 fields
# ie. "/home/cdaly/Mail/" to get the list in order. 
# You'll also need to modify the "grep -v <blah>" sections to eliminate stuff
# you don't want to appear in your folder list
for BOX in `find ~/Mail -type f -print | grep -v sent | grep -v procmail | grep -v 
backup | grep -v cache | cut -f5-20 -d/ | xargs`; do
        echo "=""$BOX" >> /tmp/boxes
done
sort /tmp/boxes > /tmp/boxes1
mv /tmp/boxes1 /tmp/boxes
for BOX in `cat /tmp/boxes | xargs`; do
        echo "folder-hook $BOX 'macro index <left> 
<change-folder>?<tab>""$COUNT""<enter>'" >> ~/.mailboxchooser
        echo $BOX # Because we need to give the mailboxes command the list of 
mailboxes also
        COUNT=`echo $(($COUNT + 1))`
done
rm -f /tmp/boxes
--------- cut here -------------

then have in .muttrc
mailboxes `~/mailboxchooser`
source ~/.mailboxchooser

That should set the folder hooks correctly for each folder and for new
folders as they are added

-- 
Conor Daly <[EMAIL PROTECTED]>

Domestic Sysadmin :-)

Reply via email to