Path: utzoo!mnetor!uunet!husc6!uwvax!speedy!solomon
From: solomon@speedy.cs.wisc.edu (Marvin Solomon)
Newsgroups: comp.mail.elm
Subject: "pointnew" option ignored with non-standard sorting order
Message-ID: <5712@spool.cs.wisc.edu>
Date: 8 May 88 12:44:30 GMT
Sender: news@spool.cs.wisc.edu
Distribution: comp
Lines: 40

I set discovered the "pointnew" option in my .elmrc with the following
comment:
	# start up by pointing to the first new message received, if possible
	pointnew = OFF
I figured that's just what I wanted, but was dismayed to find that changing
it to "ON" made no difference!  Upon searching the code, I discovered that
this option is silently ignored if your sorting order is anything other
than RECEIVED_DATE.  I see no good reason for this restriction other than
that the algorithm for implementing the option only works for RECEIVED_DATE
order:  While reading in the mailbox, the code sets "current" to the first
message with a "new" status.  The following patch, while not exactly
elegant, makes "pointnew" work for any sorting order.  After the mailbox
is sorted, I make an extra pass, looking for the first new message.

Insert this code near the end of newmbox.c, between the call
	sort_mailbox(count, 1);
and the statement
	return(count);
at the end of read_headers().

	/* solomon@cs.wisc.edu 8 May 1988:  For funky sorting modes, if
	 * option "pointnew" is selected, we have to find the new message
	 * that is first in SORTED order
	 */
	if (point_to_new && !rereading &&
	    sortby != RECEIVED_DATE) {
	  int i;

	  for (i=0; i