2

I have downloaded my emails using getmail and indexed them by mu. The problem now is that my mu4e has around 50000 emails that are marked as unread: is there a simply way to mark the entire Maildir as read?

I have tried a couple of scripts external to emacs adding the flag "S" to all the emails, then when I open mu4e they all still have unread flag.

1
  • To mark all messages in the buffer there's mu4e-headers-mark-for-read, so you could use (while (not (eobp)) (mu4e-headers-mark-for-read)). The problem is I can only get 500 messages to show at a time, so you might need several runs to finish.
    – jagrg
    Feb 7 at 11:10
1

Unfortunately mu itself doesn't let you interactuate with it in that way using predefined commands that I'm aware of. I guess that if you know enough about xapian databases, which isn't my case, you could do it. Still, you have a few options out of the box.

  • On mu4e-contrib you have mu4e-headers-mark-all-unread-read, which probably will fit your bill for most use cases. Notice that only flag visible emails, but doesn't excute it, which means:

    1. you're more likely operating on a subset of your stored messages. How big the subset is depends on mu4e-headers-results-limit's value, which by default is 500 IIRC.
    2. you still have to execute your actions.

    Mind you that almost always your day-to-day workflow will be operating on subsets defined by bookmarks. Thread messages, Today's messages, this month's messages, or whatever actual. Having unread messages outside of current/used scopes shouldn't mean much.

  • Also, in mu4e-contrib you can find mu4e-headers-mark-all which asks what to do with the marks and execute. Still applies point 1.

If that falls short or lets you down the basics of doing a search and processing it are well described in Rules for dealing with email in mu4e. It shouldn't be too hard to modify that code using the contributed functions cited above to make your own function. mu script is another option which will require a similar effort.

2
  • Thanks for the help. Mu script seemed like a good option, but I wasn't able to find any documentation for it.
    – Keen
    Feb 6 at 14:57
  • Most of the pointers you'll ever find are here: djcbsoftware.nl/code/mu/mu-guile.html
    – Muihlinn
    Feb 6 at 18:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.