Subject: Re: Preserving New Mail flag?

From: [email-masked] (David W. Tamkin)
Date: Sat, 5 Feb 1994 16:36:57 -0600 (CST)

Chris Weiss wrote,

| Trouble is, when Procmail intercepts the incoming mail and
| tosses it into the folders, it loses whatever flag is used to tell ELM
| that the letter is new and has not been read.

Er, no, that's not how it happens.  You must be brand new to the list be-
cause we discussed it less than a month ago.  There is no Status: header
in incoming mail.  procmail doesn't remove it; it just isn't there.

If you are reading the folder that matches your $MAIL variable -- because
you typed "elm" at the command prompt without specifying "-f folder" or
because you changed folders within Elm to "!" (but not if you gave Elm the
path to the folder) -- Elm realizes it's displaying your mail incoming folder
and displays an N for every letter that has no Status: header.

Once you have read a letter, Elm inserts "Status: RO" into its header and no
longer displays an N on the index screen.  If you exit your main incoming
folder without reading a new letter, Elm inserts "Status: O" into its header
and shows an O on the index screen if you come back to it.  But the RO and
the O are actually in the header: the N never was.

The designers of Elm decided (to the almost unanimous disagreement of users
over the years) that once a letter gets into a folder other than $MAIL, even
if it got put there by a mail thrower and no human eyes saw it, it's been
handled, it's been dealt with (though it got dealt with by being dealt), and
it isn't new.  Thus, no N on the index screen.  But this is Elm's design, not
procmail's.  If you had moved an unread letter to another folder with Elm's
"s)ave" command you'd have seen its status letter on the index screen disap-
pear also.  (I believe that if you use mailx you will see the N for a letter
in any folder if it has no Status: header.)

| I'm not real familiar with how ELM denotes which letters are New and which
| have been read, is there a way to get procmail to re-flag these guys as new
| when they get dumped into their respective folders?

There is an unofficial modification to Elm -- the Elm Development Group
insists that it should not be called a "patch" -- that will make the N's
display in all folders.  But we procmail users have an easier way.

procmail doesn't cause the problem, but it can cure it.  "Status: N" means
nothing and Elm will ignore it, but "Status: O" persuades Elm that a letter
in any folder is unread.  Elm will display the O on the index screen and
start the pointer at the topmost letter with an O instead of at the bottom.
After you read a letter, Elm will change its status from O to RO and display
no status letter on the index screen any more, making it easy to tell which
letters you have read and which you have not.

So the trick is this in your .procmailrc:

:f and maybe other flags
* conditions
| formail -a "Status: O"

on all mail where you want to trick Elm.  You don't need it (and in fact
probably should not use it) on mail that will go to your main folder, and
you probably don't need it on mail that goes to folders that are rarely used.
For example, I have a complex weighted recipe that adds it to mail headed
for my most active folders (such as those for busy mailing lists); on other
letters, such as those headed to my main folder or to folders that receive
one or two letters a day at most, I don't add it.

David W. Tamkin  P. O. Box 3284  Skokie IL  60076-6284
[email-masked]   MCI Mail: 426-1818   +1 312 714 5610

---

From: "Joshua A. Laff" <[email-masked]>
Date: Sun, 6 Feb 1994 10:56:30 -0600 (CST)

In our previous episode, David W. Tamkin said:
:) Chris Weiss wrote,
:) | I'm not real familiar with how ELM denotes which letters are New and which
:) | have been read, is there a way to get procmail to re-flag these guys as new
:) | when they get dumped into their respective folders?
:) 
:) There is an unofficial modification to Elm -- the Elm Development Group
:) insists that it should not be called a "patch" -- that will make the N's
:) display in all folders.  But we procmail users have an easier way.

For those interested in the "non-patch" modifications to elm, I'm including
them again as I did when this was discussed a while back. I've never tried
procmail's "Satus:" modification, but personally I rely on the difference
between Elm's "N" and "O" label. Additionally, if all of the users prefer it,
CPU wise it makes more sense to change Elm's code than to have all of the elm
users run procmail to modify a Status: line.   :) 

----------------/ug/src/elm/COMPILER-NOTE--------------
I've made a modification that allows the "New/Old/Read" headers to work on
folders *other* than the spool folder. Here's the change in case anyone
for any reason decides to reverse it:
==========================================================================

in the file src/newmbox.c, look for the lines:

                /* set default status - always 'visible'  - and
                 * if a spool file, presume 'new', otherwise
                 * 'read', for the time being until overridden
                 * by a Status: header.
                 * We presume 'read' for nonspool mailfile messages
                 * to be compatible messages stored with older versions of elm,
                 * which didn't support a Status: header.
                 */
                if(folder_type == SPOOL)
                  current_header->status = VISIBLE | NEW | UNREAD;
                else
                  current_header->status = VISIBLE;

about 660 lines down. (Just search for the symbol NEW)
Ok, now see that if statement.... well, just delete it and use the
true part as in

                current_header->status = VISIBLE | NEW | UNREAD;

Thats it.
========================================================================
					-Josh Laff
------------------end------------------

      Joshua A. Laff    (217)      //  Disclaimer: If I was important enough
    CRL Head Operator     333-    //  that the UofI would let me speak for it,
  University of Illinois   7408  //  the *last* thing I'd be doing would be
email to: [email-masked]      //  sitting in front of a computer all day.
===============================================================================
43rd Law of Computing: Anything that can go wro$&^[-].!#)(*

---

From: [email-masked] (David W. Tamkin)
Date: Mon, 7 Feb 1994 01:00:50 -0600 (CST)

Josh Laff wrote,

| ... personally I rely on the difference between Elm's "N" and "O" label.

Exactly: if you're used to using the modified Elm and seeing N and O flags
in all folders, forcing "Status: O" on mail you haven't seen is a bad idea,
as deprives you of the distinction between N and O.  That's why I advised
against adding that header to letters that procmail will file in $DEFAULT,
for example; where Elm will give you N's, take them!

| Additionally, if all of the users prefer it, CPU wise it makes more sense
| to change Elm's code than to have all of the elm users run procmail to
| modify a Status: line.

The trick is to persuade a system administrator to install the altered Elm. 
My suggestion was a user-level coping mechanism.  I'm content with it be-
cause, outside my main incoming folder, the distinction between N and O
doesn't mean much to me.  Either way it's a letter I haven't read yet.

But in my main folder the difference is useful: "O" may be unread but I al-
ready knew it was there; "N" mail has come in since the last time I looked. 
Josh finds that difference valuable in all his folders, so for him and for
everyone else who feels the same way, modifying Elm is the way to go.