[comp.mail.mush] goto-msg considered harmful

bryan@cs.utexas.edu (Bryan Bayerdorffer @ Wit's End) (11/14/89)

	I use curses mode most of the time.  In my .mushrc I have the
following:

cmd waiting 'update -N;await'

bind a macro '[line-mode]waiting\ng`headers :n`\nn'


where 'g' is bound to goto-msg.  This is supposed to go to the next new message
after waking up from the await, and print it (the final 'n').  Unfortunately,
this fails when the system mailbox contains only the new message that just
arrived.  This is because goto-msg detects that there is only one message in
the mailbox, prints 'Not enough messages' and returns an error that aborts the
macro.

This special case behavior doesn't seem to me to have any use.  It only gets in
the way of macros like the above.

Of course, this wouldn't be a problem if there were a line-mode goto command.
As far as I can see, there is no way to explicitly change the current message
pointer in line mode without doing anything else.  The only way to change it is
implictly with something like 'next' or 'print'.  Why is this?

schaefer@ogccse.ogc.edu (Barton E. Schaefer) (11/14/89)

In article <424@mohawk.cs.utexas.edu> bryan@cs.utexas.edu writes:
} 
} cmd waiting 'update -N;await'
} bind a macro '[line-mode]waiting\ng`headers :n`\nn'
} 
} where 'g' is bound to goto-msg.  [....]  Unfortunately,
} this fails when the system mailbox contains only the [one] new message
} [...] because goto-msg detects that there is only one message in
} the mailbox, prints 'Not enough messages' and returns an error [....]
} 
} This special case behavior doesn't seem to me to have any use.

The -list commands ([save-list] etc.) used to have this problem as
well.  (Some of them still may, I hardly ever have only one message
in my mailbox so I seldom notice.)  This is a throwback to the days
before mush had macros, when refusing to do this kind of operation
on a one-message folder seemed "helpful" (don't let the user type
something that won't work).  We've been repairing these as we find
(or remember) them.

} Of course, this wouldn't be a problem if there were a line-mode goto command.

You can use

    cmd goto "from -"
    bind a macro '[line-mode]waiting|goto\n[display-next]'

which has the drawback of printing the header summaries of the new
messages twice before displaying the first new message.

} As far as I can see, there is no way to explicitly change the current message
} pointer in line mode without doing anything else.  [....]  Why is this?

It's because all the line-mode commands that "affect" messages will
change the current message automatically.  "Affect" here is sort
of a difficult concept to classify; just displaying the message's
header summary isn't enough (pick, headers), but almost anything
else is.  The "from +" and "from -" special cases are as close as
mush gets to a line-mode goto.

This probably won't help bryan, but more recent beta versions of
mush support options to "pick" to take head and/or tail of a list
of messages.  So even if [goto-msg] worked, I'd rewrite this as

    cmd waiting 'update -N ; await'
    cmd first 'pick +1 | next'
    bind-macro a '[line-mode]waiting | first\n'

except that I wouldn't use 'a' as the trigger-key; too easy to set
off an update -N accidentally when I really wouldn't want one.
-- 
Bart Schaefer          "Sometimes I think the surest sign that intelligent life
                        exists elsewhere in the universe is that none of it has
schaefer@cse.ogc.edu        tried to contact us."                     -- Calvin
(soon to be cse.ogi.edu)