Hello Everyone,
I think I found the reason why this happens, there's a block of code
that uncollapses *all* the threads in the current mailbox when it is
reopened. The comments around that block of code seem to indicate that
only new emails should be uncollapsed, so I've added an if statement
(see attached patch) checking for new mails that are unread. This fixes
the problem that I was having (all threads would uncollapse when flags
were externally modified).
Not sure if this is really a bug or the intended behaviour, any feedback
is greatly appreciated!
Thanks!
Yoshiki.
On (Feb-10-15|12:27), Yoshiki Vazquez Baeza wrote:
> Hey Mutters,
>
> I've encountered a strange behaviour that uncollapses all the threads in
> the current mailbox after I get the message "Mailbox was externally
> modified. Flags may be wrong.". I tried to track down the problem in
> curs_main.c but had no luck.
>
> I have the following folder-hook to collapse all threads when I open any
> mailbox:
> folder-hook . "exec collapse-all" # collapse all threads on start
>
> Any pointers are greatly appreciated!
>
> Yoshiki.
>
# HG changeset patch
# User Yoshiki Vazquez Baeza
# Date 1424032005 28800
# Sun Feb 15 12:26:45 2015 -0800
# Node ID ea89313d929144068891cfd3eba42571ea7267d8
# Parent 385d7434c9d6f44c732fd12fc76d543f9d5d7233
Fix bug where all threads would uncollapse on mailbox reopen
diff -r 385d7434c9d6 -r ea89313d9291 curs_main.c
--- a/curs_main.c Tue Feb 10 12:14:20 2015 -0800
+++ b/curs_main.c Sun Feb 15 12:26:45 2015 -0800
@@ -408,9 +408,10 @@
for (h = ctx->tree; h; h = h->next)
{
- for (j = h; !j->message; j = j->child)
- ;
- mutt_uncollapse_thread (ctx, j->message);
+ for (j = h; !j->message; j = j->child)
+ ;
+ if (!j->message->old && !j->message->read)
+ mutt_uncollapse_thread (ctx, j->message);
}
mutt_set_virtual (ctx);
}