Re: How to let mutt always mark mbox as new if it contains new
Hi,
* Derek Martin wrote:
> This is exactly what the OP was complaining about, and I completely
> agree with him. It's highly inconvenient, if you have a lot of mbox
> folders with unread e-mail in them, to go back and figure out which
> ones you care about. NO OTHER MAILER HAS THIS PROBLEM, as far as I
> know... Mutt behaves as the OP (and I, and lots of other people)
> expect if maildir is used, but there are valid reasons not to use
> maildir, and mutt's behavior should be consistent regardless of
> selected mailbox format.
Strange. I cannot reproduce this with $check_mbox_size unset, i.e. use
atime vs. mtime to detect new mail. And since I cannot reproduce it, I
cannot fix it. Attached is a patch that's supposed to reset times in
case an mbox folder has new mail. I cannot really test this.
> This probably should not be very difficult to fix, at least part way;
> you could either use the header cache, or add a flag to the structure
> representing a visited mbox mailbox, to mark a folder containing
> unread mail as needing to be visited.
Hmm. Muttt already has mechanisms to detect if a folder has new
mail. For me, this works -- if it doesn't for you, we need to fix
it. Maintaining the state internally during the session is the wrong
way, IMHO.
Rocco
diff --git a/mbox.c b/mbox.c
--- a/mbox.c
+++ b/mbox.c
@@ -1037,9 +1037,18 @@ bail: /* Come here in case of disaster
/* close a mailbox opened in write-mode */
int mbox_close_mailbox (CONTEXT *ctx)
{
+ int i, rset = 0;
+
+ for (i = 0; !rset && i < ctx->msgcount; i++)
+ {
+ if (!ctx->hdrs[i]->read && !ctx->hdrs[i]->old)
+ rset = 1;
+ }
mx_unlock_file (ctx->path, fileno (ctx->fp), 1);
mutt_unblock_signals ();
mx_fastclose_mailbox (ctx);
+ if (rset)
+ mutt_decrease_mtime (ctx->path, NULL);
return 0;
}