index all rss twitter github linkedin email

Álvaro Ramírez

10 November 2018 Faster junk mail deletion with mu4e

It's been roughly 5 months since my mu4e email migration. Happy with my choice. Mu4e is awesome.

I now have 4 email accounts managed by mu4e, and unfortunately receiving lots of junk mail.

I regularly peek at junk folders for false positives and delete junk email permanently. I've been wanting a quick way to glance at junk mail and easily delete page by page.

Deleting emails page by page is not supported in mu4e by default. Fortunately, this is Emacs and we can change that™.

There's a handy package by Roland Walker called window-end-visible. We can use it to select mu4e emails by page and subsequently glue it all together to enable deleting emails by page.

(require 'mu4e)
(require 'window-end-visible)

(defun ar/mu4e-delete-page ()
  (set-mark (window-start))
  (goto-char (window-end-visible))
  (mu4e-mark-execute-all t)
  (goto-char (window-start)))

I'm a use-package fan, so I use it to bind the "v" key to delete visible emails (by page).

(use-package mu4e
  :bind (:map mu4e-headers-mode-map
         ("v" . ar/mu4e-delete-page))