gmail-style archiving

557 views
Skip to first unread message

John Floren

unread,
Oct 29, 2014, 6:02:42 PM10/29/14
to mu-di...@googlegroups.com
I've been using mu4e lately and enjoy it, but I'm a little puzzled trying to replicate my general gmail flow.

When I use gmail, I hit "y" when I'm done with an email to get it out of my inbox, relegated only to "All Mail". The closest I've found in mu4e is "ma" to move to All Mail, but that's two keystrokes :) I've also tried "r", but what sends it to /archive while keeping it in [Gmail].All Mail. I guess I could delete the "archive" folder occasionally, but that spooks me a bit because I want to keep this email and get leery of deleting crap then running offlineimap.

Any suggestions? I guess I could bind a key to "ma".

John

Dirk-Jan C. Binnema

unread,
Oct 29, 2014, 7:01:37 PM10/29/14
to mu-di...@googlegroups.com
Hi John,
I'm mostly using 'r' ("refile"), which is something taken from
mutt/wanderlust. You can customize it to refile messages to the correct
folder.

Cheers,
Dirk.


--
Dirk-Jan C. Binnema Helsinki, Finland
e:dj...@djcbsoftware.nl w:www.djcbsoftware.nl
pgp: D09C E664 897D 7D39 5047 A178 E96A C7A1 017D DA3C

James Felix Black

unread,
Oct 29, 2014, 7:31:50 PM10/29/14
to mu-di...@googlegroups.com
I have a couple of helper functions that determine the appropriate Archive folder based on message and sets mu4e-refile-folder accordingly. This relies on a simple heuristic (different accounts get filed into different Maildirs under Accounts) and I have a bunch of other stuff that sets the smtp stuff up per message as well. I should clean it up and publish it, but here are my functions to get you started:


(defun jfb/account-from-message-maildir (message)
"Given an mu4e-style 'message', return the account that this message belongs to, by examining the maildir into which it is filed. This is jfb specific and probably ought to be generalized, somehow."
(if (or (null message)
(not (mu4e-message-has-field :maildir message)))
(or multi-smtp/current-account
multi-smtp/default-account) ;; use the last account, if set.
(multi-smtp/valid-account-p (intern (downcase (car (split-string (mu4e-message-field-raw message :maildir) "/" t)))))))

(defun jfb/mu4e-folder-from-account (account folder-name)
(interactive)
(format "/%s/%s" (capitalize (symbol-name account)) folder-name))

(setq mu4e/archive-folder (lambda (msg)
(jfb/mu4e-folder-from-account
(jfb/account-from-message-maildir msg)
"Archive”))
> --
> You received this message because you are subscribed to the Google Groups "mu-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to mu-discuss+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Eric Larson

unread,
Oct 30, 2014, 2:55:54 AM10/30/14
to mu-di...@googlegroups.com
I have "d" set to move to my gmail trash and "D" to delete. In my work
email I typically will use "D" while in GMail I will use "D" for
archiving and "d" for actually trashing a message.

HTH,

Eric

--
Sent with my mu4e

Eduardo Mercovich

unread,
Oct 31, 2014, 4:21:48 PM10/31/14
to mu-di...@googlegroups.com
Hi James.

I have a couple of helper functions that determine the appropriate Archive folder based on message and sets mu4e-refile-folder accordingly. [...]

Doesn't this implies duplicate mails?
* one in the refile folder, and
* other in "All Mail"?

--
e

James Felix Black

unread,
Oct 31, 2014, 4:36:38 PM10/31/14
to mu-di...@googlegroups.com
Oh, good point. I don’t do Gmail, so … hmm.

Eduardo Mercovich

unread,
Nov 3, 2014, 2:07:05 PM11/3/14
to mu-di...@googlegroups.com
In Gmail (which I plan to abandon in a not distant future) archiving is really taking of the INBOX label.
Is it possible to do something like that from mu4e?

Even if Gmail is not the ideal world, there is a lot of people there that we may serve well with a super efficient tool like mu4e (and with it, they are closer to a Google Break). ;)

--
e

James Ladan

unread,
Nov 3, 2014, 6:20:30 PM11/3/14
to mu-di...@googlegroups.com
Yet another random person's workflow. Basically what Dirk mentioned.

In offlineimap, I translate "[Gmail].All Mail" to "Archive" in my maildir. I have 'r' refile to "Archive" and 'd' move to "Trash" ([Gmail].Trash).

The only downside for me is that email in my Inbox is also in Archive at the same time, but I only see that when I search for email and get a hit that matches email that's in my inbox and thus see both copies. After archiving and offlineimap doing a sync, I just have the one copy left in my Archive folder.

Raam Dev

unread,
Nov 26, 2014, 3:28:14 PM11/26/14
to mu-di...@googlegroups.com
Here's how I handle Archiving with Gmail to avoid duplicate emails:

In the beginning I was just deleting messages in mu4e; Gmail's default setting is to Archive deleted messages, so this worked as expected, moving messages out of the Inbox. However, it meant that if I searched for an email inside mu4e, I'd end up seeing "deleted" messages in my search results, which was annoying.

So now I use Refile ("r"), to file messages into the ~/Maildir/archive/ directory. Then, to make sure that Gmail sees the fact that I archived the message, I tell mbsync (which is what I use to sync with Gmail) to sync my ~/Maildir/archive/ directory with Gmail's "All Mail" directory, specifying the "Sync Push" Channel option in my mbsync config so that only local changes are pushed to the remote (this prevents downloading *everything* in the "All Mail" folder--100k+ messages).

Now when I press "r" to refile and then sync with remote using "U", the message disappears from my Inbox and gets moved to Gmail's "All Mail". 

I actually have three email accounts that I read and send from mu4e, so my configuration is a bit more complicated, but that's the gist of how I handle archiving emails. If you're interested in seeing my entire configuration, I have it online here:


Cheers,
Raam
Reply all
Reply to author
Forward
0 new messages