On Wed, May 12, 1999 at 09:13:11AM +0800, [EMAIL PROTECTED] wrote:
> Stefan `Sec` Zehl <[EMAIL PROTECTED]>
> suggested:
> 
> > macro index I "c=<Tab><Tab>`echo -n j>>$HOME/.jay;cat $HOME/.jay`"  
> 
> This does not seem to be incrementing in .jay. I think probably
> these shell commands are only executed when .muttrc is sourced. I
> tried replacing the back quotes with the shell escape (!) and 
> I think this then incremented in .jay. But the
> cat command did not then work. The browser screen just flashes
> and is redrawn, but the reverse video bar does not step down the
> screen. And this is strange, because echo $JAY does work. That
> is, it steps the reverse video bar down the screen. 
> 
> I got somewhat confused here, so this above description is not
> an accurate account of the efforts I have made to get this thing
> working. I think I need more knowledge of how mutt passes
> commands and handles standard output. Is this something mutt
> can't do?  

So, i played around with this, and this whole thing is a bit
complicated, because mutt behaves strange in a few areas.

First, you noticed that .jay doesn't get incremented. This is because
mutt only takes the first line it gets from an `-expansion, and only if
it is a full line. I worked around this, by making a little shellsript:

file $HOME/.jayscript

#!/bin/sh
echo j>>$HOME/.jay
cat $HOME/.jay| tr -d \\012
echo

which has to be set executable (chmod a+x .jayscript)

it eliminates all newlines from .jay with a call to "tr" and terminates
the whole with a newline itself. Also it does increment the number of
j's in $HOME/.jay

then mutt does `-expansion only at parse-time, not at execution-time,
but we can work around this by adding another macro expansion on top
(define a macro in our macro, and call this one)

lastly, <key>-sequences are expanded, even in '-s (it seems. didn't look
closer) so i had to use \t instead.

so here is the final macro

macro index I ':macro index \cXI "c=\t\t`$HOME/.jayscript`"'\n\cXI

which works for me.

Of course you need to "echo >$HOME/.jay" whenever you want to restart
the cycling :-)

CU & HTH,
    Sec
-- 
Larry Wall: "Lisp has all the visual appeal of oatmeal
             with nail clippings thrown in."

Reply via email to