You are not logged in.

#1 2010-06-16 20:35:18

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Two Mutt/Offlineimap/Gmail questions (re labels/folders, unread flags)

I've had the Mutt/Offlineimap/Gmail combination working well for quite awhile now...just a couple of minor annoyances I'd love to sort out if possible. I've got a couple of dozen Gmail labels which translate nicely into mutt/maildir folders. I have a number of filters setup in Gmail which automatically label most incoming emails with one or more labels. I can then see that email in the inbox, the all-mail folder and in whichever folders/labels it is assigned.

First issue -- When I delete an email in mutt from the Inbox, the copy of the message in the archive and label folder(s) still has the unread message flag attached. Is there a way to set a hook to find all the matching messages in the folders and remove the unread flag?

Second -- Is there a way to also determine which folders/labels the incoming messages are assigned to and display that in the status line for the message? This seems difficult since each message is actually located in potentially 4 or 5 different folders.

Thanks!

Scott

Note: Belated thanks to brisbin33 for his detailed setup instructions for mutt/gmail/offlineimap!

Offline

#2 2010-06-16 20:49:45

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: Two Mutt/Offlineimap/Gmail questions (re labels/folders, unread flags)

firecat53 wrote:

First issue -- When I delete an email in mutt from the Inbox, the copy of the message in the archive and label folder(s) still has the unread message flag attached. Is there a way to set a hook to find all the matching messages in the folders and remove the unread flag?

I've been annoyed by this as well.  Basically i have to do this:

1. read the email in the inbox
2. sync the mailbox
3. wait ~3 minutes for offlineimap to sync the 'read' status back to gmail which then updates all the other labels to read as well
4. delete/move the message

it's annoying but it works.  i also have a macro in my muttrc for "mark all as read" which i use to clean up when i'm too impatient for the above.

firecat53 wrote:

Note: Belated thanks to brisbin33 for his detailed setup instructions for mutt/gmail/offlineimap!

hehe, my pleasure smile.

Offline

#3 2010-06-16 20:55:32

gazj
Member
From: /home/gazj -> /uk/cambs
Registered: 2007-02-09
Posts: 681
Website

Re: Two Mutt/Offlineimap/Gmail questions (re labels/folders, unread flags)

All hail brisbin33, who is god of the mutt/gmail world.  I have also found your .muttrc very very useful. wink

Last edited by gazj (2010-06-16 20:56:07)

Offline

#4 2010-06-16 21:07:50

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: Two Mutt/Offlineimap/Gmail questions (re labels/folders, unread flags)

gazj wrote:

All hail brisbin33, who is god of the mutt/gmail world.  I have also found your .muttrc very very useful. wink

lol:lol:

i try.

Offline

#5 2010-06-16 21:10:55

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: Two Mutt/Offlineimap/Gmail questions (re labels/folders, unread flags)

Yeah, I was afraid there wasn't a great solution for that -- may I have your mark-all-as-read macro?

And any insight into solving #2?

Thanks!
Scott

Offline

#6 2010-06-16 21:17:39

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: Two Mutt/Offlineimap/Gmail questions (re labels/folders, unread flags)

firecat53 wrote:

Yeah, I was afraid there wasn't a great solution for that -- may I have your mark-all-as-read macro?

sure, it's in the muttrc you all love so much wink

here it is anyway,

macro index \Cr "<tag-pattern>all<enter><tag-prefix><clear-flag>N<untag-pattern>all<enter>" "mark all as read"

smile

firecat53 wrote:

And any insight into solving #2?

i really don't see any way to do this.  since the status format is determined at loading of muttrc you couldn't dynamically use any `shell commands` to figure things out, and the format itself is limited only to the formatting %things mutt makes available.

if anyone knows a way i'd be very impressed.  it would probably take legit patching.

/edit: typo

Last edited by brisbin33 (2010-06-16 21:33:46)

Offline

#7 2010-06-16 21:29:48

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: Two Mutt/Offlineimap/Gmail questions (re labels/folders, unread flags)

Thanks!  Edit: OMG I'm so blind -- it's already in my muttrc! Ah well

Edit2:  What about a macro that could be manually triggered to search for messages matching the current message in the folder structure and printing a list of the folders? Perhaps using 'find'? Hmmmm....

Last edited by firecat53 (2010-06-16 21:45:16)

Offline

#8 2010-06-17 21:06:43

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: Two Mutt/Offlineimap/Gmail questions (re labels/folders, unread flags)

Ok, I sort of got something kind of working to show the folder(s) in which a message resides. It requires mairix to be installed and configured to search every folder. I normally just have it configured to search the 'archive'/all-mail folder, so this had to be changed. It uses the m: flag for mairix to search on Message-ID number. This also requires the headers to be visible ('weed' =off). Please forgive my scripting skills smile

Little script:

#!/bin/sh
while read data; do
        if [[ "$data" == *Message-ID* ]]; then
                echo "$data" | sed 's/Message-ID: <\(.*[^>]\)>/\1/' | sed 's/^/m:/' | xargs mairix -r|while read line; do dirname $line |awk -F \/ '{print $5}';done
                exit 0
        fi
done

Then a little macro in muttrc:

macro index,pager      i       "<pipe-message>~/scripts/mail-folders.sh<return>"

Make sure headers are toggled on and hit 'i' and it should show the folders the message is in. Of course, it totally messes up the display and shows any mailcap entry errors. I tried to add an <enter-command>set weed=off<return>   and same to turn weed back on in the same line as the macro but it didn't work.  Any ideas to improve this?

Scott

Last edited by firecat53 (2010-06-17 21:13:51)

Offline

#9 2011-04-14 19:37:45

zarfleen
Member
Registered: 2011-04-14
Posts: 1

Re: Two Mutt/Offlineimap/Gmail questions (re labels/folders, unread flags)

I realize this thread is pretty old, but I came across it looking for a solution to the same mail being marked as unread problem.  Hope this helps anyone else looking for a solution.

I found this while looking for a solution.  Essentially, "set imap_peek = no" needs to be set in your muttrc.  The linked post describes a bug on Gmail's side that was continuing to leave messages unread even with the mentioned muttrc value set.  This appears to have been fixed, though, as a couple of quick tests showed that messages were getting marked read properly.

Offline

#10 2012-01-09 23:25:52

cdysthe
Member
Registered: 2009-11-20
Posts: 62

Re: Two Mutt/Offlineimap/Gmail questions (re labels/folders, unread flags)

Thank you so much zarfleen! I have been looking all over for a solution to deleted mail not being marked read, and then it turns out to be a tine line added to muttrc!

Offline

Board footer

Powered by FluxBB