[PATCH 1/2] mutt, notmuch: Update 'unread' tag for all files mapped to msg
by Don Zickus
I ran into an issue where I would read an email in my inbox that was
sent to me and cc'd a mailing list and it would not remove the 'unread'
tag after syncing the mailbox.
Apparently, when nm_synci'ing the message, the local inbox copy would be
recognized as seen but the duplicate copy in the mailing list folder
would still be in the 'new' directory, so the 'unread' flag would not
be cleared.
The way the 'duplicate' messags where handled in 'rename_filename', it
appears after the add/remove the local copy of 'msg' was not updated
with the new paths. I fixed this by destorying the message and then
re-reading it from the notmuch database.
However, the tags were still off. I had to further call
'update_header_flags' to re-read the tags from the database (using
the updated paths) to clear the 'unread' tag.
Both of these changes seem to work as expected now.
Signed-off-by: Don Zickus <dzickus(a)redhat.com>
--
I am not too familar with this code, so my changes may not be
correct. I do know they seem to work after a couple of days of
testing.
---
mutt_notmuch.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/mutt_notmuch.c b/mutt_notmuch.c
index 1a39249..3a25cc1 100644
--- a/mutt_notmuch.c
+++ b/mutt_notmuch.c
@@ -1474,6 +1474,9 @@ static int rename_filename(struct nm_ctxdata *data,
notmuch_database_add_message(db, newpath, NULL);
}
}
+ notmuch_message_destroy(msg);
+ msg = NULL;
+ notmuch_database_find_message_by_filename(db, new, &msg);
st = NOTMUCH_STATUS_SUCCESS;
break;
default:
@@ -1484,6 +1487,7 @@ static int rename_filename(struct nm_ctxdata *data,
if (st == NOTMUCH_STATUS_SUCCESS && h && msg) {
notmuch_message_maildir_flags_to_tags(msg);
+ update_header_tags(h, msg);
update_tags(msg, nm_header_get_tags(h));
}
--
1.8.4
7 years, 9 months
virtual folder sidebar provides deceiving new email count
by Don Zickus
Hi,
I stumbled upon mutt-kz, notmuch and afew a couple of months ago and have
been fairly happy with how they all work together.
One of the quirks I haven't figure out yet, is my sidebar virtual folder new
email count.
I have a virtual folder Inbox that contains all notmuch query
'to:dzickus@redhat.com'. Going into that folder works great. However, when
I leave that folder to go to another virtual folder, it says I have some new
messages in my Inbox folder. When I go back into my 'Inbox' folder there is
no new messages waiting.
Digging through the notmuch database I am _guessing_ the problem is duplicate
messages from a mailing list sent to me or cc'd to me. Further guessing is
that I am clearing the new flag (by reading the email) in one of the copies
but not the other?
Querying notmuch produces the same 'unread' count as the virtual folder, so
I don't believe mutt-kz is reading anything wrong. So my guess was
duplicate files, though I haven't figured out the right notmuch-fu to
conclude that properly.
Thoughts? Tips?
(using mutt-kz::5147a6c1921)
Thanks again for the tool!
Cheers,
Don
7 years, 9 months