I was trying to get navigating between the index and mailbox
screen in the browser more like moving from the pager to the
index, and specifically, to make the current entry the mailbox I
was just viewing rather than my spool mailbox. I was doing this
with some macros and scripts that write to a file the position of
the mailbox in the mailbox screen. 

The problem was that when reading the 'j' the script had written
to the file the macro used to write to the file was being invoked
again, apparently, so I was getting two js for the price of one.
It worked when I changed the internal representation in the file to
'<next-entry>'.

So the macros I have are:

macro browser j ':macro index \cBJ `$HOME/.jayplus`'\n<next-entry>\cBJ
macro browser k ':macro index \cBK `$HOME/.jayminus`'\n<previous-entry>\cBK
macro index h ':macro index \cIJ "c?\t`$HOME/.jayread`"'\n\cIJ

And in .jayplus, there is:

> #!/bin/bash
> 
> #test if last-entry has been reached. If not, add another.
> #I have 33 mailboxes including spool, so 32 <next-entry> are needed.
> 
> touch $HOME/.jay
> JAY=`cat $HOME/.jay`
> if [ $JAY = 
>"<next-entry><next-entry><next-entry><next-entry><next-entry><next-entry><next-entry><next-entry><next-entry><next-entry><next-entry><next-entry><next-entry><next-entry><next-entry><next-entry><next-entry><next-entry><next-entry><next-entry><next-entry><next-entry><next-entry><next-entry><next-entry><next-entry><next-entry><next-entry><next-entry><next-entry><next-entry><next-entry>"
> ] 
> then 
>       exit
> else
>       echo -n "<next-entry>" >> $HOME/.jay
> fi

In .jayminus:

> #!/bin/bash
> 
> #takes first 13 bytes (ie <next-entry>) off .jay
> 
> tail -c +13 $HOME/.jay > /tmp/jay 
> mv /tmp/jay $HOME/.jay

And in .jayread:

> #!/bin/sh
> 
> #writes '<next-entry><next-entry>...' to macro definition
> 
> cat $HOME/.jay
> echo

Interestingly, I couldn't find any other position for
'<next-entry>' in my macros. If they were at the end of the line,
I got an error beep, even though the macros worked. In the
present position, I don't get a beep, but I get the error
message, 'Key is not bound. Press '?' for help,' even though the
macros work.

If I called a shell to write to the file, I got major screen flashing.
Now how do I cope with <next-page> and <previous-page> and
accessing mailboxes with numbers?

-- 
Greg Matheson                           Think locally
Chinmin College, Taiwan                 Act globally
[EMAIL PROTECTED]                  Think one thing, do another

Reply via email to