So, with the upcoming google workspace changes (no more free-tier for greymanlabs), I've been looking at cleaning up my gmail stuff to make it easier to transition to a traditional email solution.
As a starting point, I thought I'd try to clean up my personal account. There are several apps that offer to help, but they all cost money and I'm not super jazzed to give a 3rd party the password to my email.
So I thought it should be fairly easy to just fire up mutt and do some manual cleanup.
Turns out...no. Not so simple.
First of all, gmail "helpfully" moves all read mail from the Inbox to '[Gmail]/All Mail', which makes it a little obtuse to get to. For some reason, mutt doesn't like it, but I can manage to get there by hitting 'c' and navigating to the folder.
The other issue I can into was that I'd use mutt's delete-with-pattern flow to mark a bunch of emails as 'deleted', but when I'd try to sync to expunge them, often a bunch would be left in the folder marked for deletion, but not actually deleted.
I found the answer on someone's blog which is to move the email to gmail's trash folder, where it will be pruned some time in the next 30 days.
The relevant line is: ...assuming you have setup your imap user that way.
Seems to work for me.