mu4e interactive mail check

29 views
Skip to first unread message

Yuri D'Elia

unread,
Dec 24, 2016, 7:52:44 AM12/24/16
to mu-discuss
As my mu4e-init.el keeps growing (sadly? ;)), I have some tweaks which
are generic enough for sharing.

I get my mail outside of mu4e. The sync is slow enough to be bothering,
so I divided my mbsync setup into different channels according to
priority that I fetch at different intervals through cron. For example,
inboxes are checked every 5 mins, but a full sync only happens every 30
min.

I let mu4e reindex every 60 seconds, but that's about it.

I occasionally still get the colleague plop into my office asking if I
saw the email he just sent 5 seconds ago. Guess what?

For this, I tweaked mu4e-update-mail-and-index to support two commands:
one which is executed non-interactively and one for interactive use.
The idea is that when mu4e runs update-mail-and-index in background I'm
fine with indexing, but when I explicitly use 'C-U' in the headers
view I want to fetch as well.

(setq mu4e-get-mail-command t
mu4e-interactive-get-mail-command "mbsync -n inbox"
mu4e-update-interval 60)

(defun my4e~interactive-update-mail-and-index (f &rest args)
(let* ((cmd (if (interactive-p)
mu4e-interactive-get-mail-command
mu4e-get-mail-command))
(mu4e-get-mail-command cmd))
(apply f args)))

(advice-add 'mu4e-update-mail-and-index :around
'my4e~interactive-update-mail-and-index)
Reply all
Reply to author
Forward
0 new messages