[comp.mail.mh] mh and sequences

marc@apollo.HP.COM (Marc Gibian) (12/21/90)

I am a very heavy mh user, processing well over 100 messages a
day and more.  So far, I have set up automatic archiving of old
mail, a number of useful combinations of pick and other commands.
I also have /bin/ksh setup to include the current folder and 
current message number in my ksh prompt.

But, I keep finding a need to do a number of things that I can't
find anyway of accomplishing without writing more shell 
scripts/functions.  Before doing that, I thought I would 
ask if anyone already can do any of the following:

1.  Read one message at a time forward through a sequence, rather
than all messages in a folder.

2.  Do 1 backwards.

3.  pick through a number of folders in a single command/script.

4.  Do 1 & 2 with the results of 3.

5.  any other neat suggestions for handling this kind of message
volume?

Thanks for your help... one way or another I will be implementing
1,2,&3 if noone has anything to offer.  

Marc S. Gibian

Software Engineer/NetLS HP/CCD
Internet: marc@apollo.hp.COM
NETel:    HP/Apollo: 508-256-6600 x4247    HPtelnet:  256-4247
(Copyright 1990 by author. All rights reserved.  Free redistribution allowed.)

tr@samadams.princeton.edu (Tom Reingold) (12/21/90)

In article <4eb69609.20b6d@apollo.HP.COM> marc@apollo.HP.COM (Marc
Gibian) writes:

$ [...]
$ But, I keep finding a need to do a number of things that I can't
$ find anyway of accomplishing without writing more shell 
$ scripts/functions.  Before doing that, I thought I would 
$ ask if anyone already can do any of the following:
$ 
$ 1.  Read one message at a time forward through a sequence, rather
$ than all messages in a folder.

In my .mh_profile, I have an entry:

pick: -seq select -list

which puts "pick" sequences into a sequence called "select".  So a
command for your problem number 1 would be

for i in `pick select`
do
	echo -n 'message $i: '
	read junk
	show $i
done

$ 2.  Do 1 backwards.

for in in `pick select | rev`
do
	echo -n 'message $i: '
	read junk
	show $i
done

where "rev" is a program that prints its input last line first, and so
on.  How to write this program "is left as an exercise for the reader"
as some pedants love to say.

$ 3.  pick through a number of folders in a single command/script.
$ 
$ 4.  Do 1 & 2 with the results of 3.

It would be nice if this were easy.  In the meantime, you have to do
something like

for j in `folders $* -fast -recurse`
do
	...
done

$ 5.  any other neat suggestions for handling this kind of message
$ volume?
$ [...]

Change jobs.
--
        Tom Reingold
        tr@samadams.princeton.edu  OR  ...!princeton!samadams!tr
        "Warning: Do not drive with Auto-Shade in place.  Remove
        from windshield before starting ignition."

jns@fernwood.mpk.ca.US (Jerry Sweet) (12/21/90)

Well, as far as going one-at-a-time through a sequence, most persons
tell me to use mh-e with Gnu Emacs, but I have this csh script, called
"consider", that sort of gives you what you want.  To use it, just
type something like this:

	consider `pick -subject cerebus`

It then creates and pushes to the folder +consider.  This folder
contains symbolic links to all the selected messages.  You can then
step through the messages any way that you like.

When you're done, just use

	folder -pop

				cut here
------------------------------------------------------------------------
#!/bin/csh -f
# consider - create a folder for a sequence of messages
# jns, 5/9/89
# modified 6/21/90 by jns to do a few sanity checks.
# modified yet again 10/12/90 to display only the top folder

set considerf=~/Mail/consider

if (-e $considerf) then
  rm -rf $considerf
endif

if ( $#argv > 0 ) then
  set messages = ( `mhpath $*` )
else
  echo "no messages to consider"
  exit 1
endif

if ( $#messages > 0 ) then
  mkdir $considerf
  ln -s $messages $considerf
  folder -push +consider > /dev/null
  folder first > /dev/null
else
  echo "no messages to consider"
  exit 1
endif

folder -fast

swb@chumley.tn.cornell.edu (Scott Brim) (12/21/90)

In article <5519@rossignol.Princeton.EDU> tr@samadams.princeton.edu (Tom Reingold) writes:

   for i in `pick select`
   do
	   echo -n 'message $i: '
	   read junk
	   show $i
   done

   ...

The problem with doing this is that you are forced to serialize, you
can't pick and choose out of the sequence(s) selected.  The only
satisfying solution I can find is to front-end MH with GNU emacs, or
maybe XMH, although I like the GNU emacs front-end environment better.
(I know someone who converted to mush because he didn't have anything
X-capable, he didn't want to learn emacs, and he couldn't stand not
being able to pick and choose out of a selected list of messages!)
							Scott