mu4e buffer don't update when new email arrives

1,264 views
Skip to first unread message

makkus

unread,
Mar 31, 2015, 7:31:08 PM3/31/15
to mu-di...@googlegroups.com
Heya,

I recently re-installed my laptop, and I have problems using mu4e since. The main issue I have at the moment is that mu4e buffers don't seem to be updated when I get new mail. When I leave the buffer (inbox, for example), then re-enter it I can see it fine.

I tried to set a breakpoint in the method 'mu4e~headers-do-auto-update' (from mu4e-headers.el), but that seems to never get called in the first place. I'm a novice in debugging lisp code though, so might be something I've done wrong.

Not quite sure what changed in my setup, using the same config that was working fine before. My mu is installed from source, version 0.9.11.

This is the relevant config from init.el:

(setq mu4e-mu-binary "/usr/local/bin/mu")
(setq mu4e-maildir (expand-file-name "~/.email/work"))
(setq mu4e-drafts-folder "/Drafts")
(setq mu4e-sent-folder   "/Sent Items")
(setq mu4e-refile-folder "/Archives/.2015")
(setq mu4e-trash-folder  "/Trash")
(setq mu4e-get-mail-command "~/config/mbsync/sort_and_fetch.sh"
      mu4e-update-interval 120
      mu4e-headers-auto-update t)

And this is my sort_and_fetch.sh script:

!#/bin/bash

imapfilter
mbsync -c ~/config/mbsync/.mbsyncrc work
pkill -2 -u 1000 mu
sleep 1
mu index --maildir=/home/makkus/.email/work

I tried it without the 'pkill / mu index' lines first, but then even leaving and re-entering the mu4e buffer doesn't help and I never see the new message at all (not even if I restart emacs).

Anybody an idea?

Foivos S. Zakkak

unread,
Mar 31, 2015, 7:49:41 PM3/31/15
to mu-di...@googlegroups.com

Sounds like your mu4e-get-mail-command returns an error code. mu4e
should index the messages on successful "gets".

Foivos
--
PGP: 7B40 69D9 29BA AE91 C0B3 220A 0846 BFD1 03F0 4EA1
signature.asc

makkus

unread,
Mar 31, 2015, 8:06:34 PM3/31/15
to mu-di...@googlegroups.com
Ah, right. Good catch, thanks.

Turns out mbsync didn't like me just moving my email directory to a new computer for some reason. Re-downloaded all mail from scratch and everything good again.

Cheers!

Charles-H. Schulz

unread,
Apr 1, 2015, 6:27:37 AM4/1/15
to mu-di...@googlegroups.com

Hi,

Le mer 1 avr. 2015 02:06, makkus <mak...@gmail.com> a écrit :

Ah, right. Good catch, thanks.

Turns out mbsync didn't like me just moving my email directory to a new computer for some reason. Re-downloaded all mail from scratch and



FWIW, I use offlineimap and did not get this kind of error. At best it is configured in the init file, at worst you can create an offlineimap.py python script. I am not clear what the advantages of mbsync over offlineimap are by the way.

Best,


Charles.


makkus

unread,
Apr 1, 2015, 4:10:31 PM4/1/15
to mu-di...@googlegroups.com


On Wednesday, 1 April 2015 23:27:37 UTC+13, Charles-H. Schulz wrote:

FWIW, I use offlineimap and did not get this kind of error. At best it is configured in the init file, at worst you can create an offlineimap.py python script. I am not clear what the advantages of mbsync over offlineimap are by the way.

Yeah, no reason really I choose mbsync over offlineimap initially. Seemed a tad easier to configure, it's fast, and it was working without issue for ages. Just didn't like me moving my synced local folder over to a new machine for some reason.

zeltak brisbane

unread,
Apr 5, 2015, 8:49:46 AM4/5/15
to mu-di...@googlegroups.com

Hi all

I started using mu4e today and have a similar issue but it also maybe that i dont know what im doing ;-)

i setup mu4e with offline imap and it does auto launch offlineimap and sends/receives emails yet if im in my inbox i have to go out of the inbox to the default mu4e buffer view and re-enter the inbox to see new emails?

any clue anyone?

best

z

Charles-H. Schulz

unread,
Apr 5, 2015, 12:17:01 PM4/5/15
to mu-di...@googlegroups.com
Hello Zeltak,

2015-04-05 14:49 GMT+02:00 zeltak brisbane <ikl...@gmail.com>:


Hi all

I started using mu4e today and have a similar issue but it also maybe that i dont know what im doing ;-)

i setup mu4e with offline imap and it does auto launch offlineimap and sends/receives emails yet if im in my inbox i have to go out of the inbox to the default mu4e buffer view and re-enter the inbox to see new emails?

any clue anyone?

I use offlineimap but in my case I don't have to "go out", it automatically receives messages at pre-defined intervals. In my case, every 10 mn expressed in seconds. I've put my settings below, including the offlineimap and my MailDir folder, so that you can see how one real life example may work. As you will see it is the first part of my mu4e config that is in my init file:

;; mu4e
(add-to-list 'load-path "/usr/local/share/emacs/site-lisp/")
(require 'mu4e)

 (setq mu4e-get-mail-command "offlineimap")
(setq mu4e-update-interval 600)
(setq mu4e-maildir "~/Maildir")

Hope this helps,

Charles.

zeltak brisbane

unread,
Apr 6, 2015, 1:29:12 AM4/6/15
to mu-di...@googlegroups.com
Thanks for the answer charles

thats exactly the setup i tried, heres the relevant part of my config as well

(require 'mu4e)

(setq mu4e-get-mail-command "offlineimap"
      mu4e-update-interval 120
      mu4e-headers-auto-update t)

(setq mu4e-maildir "~/Maildir")

(setq mu4e-drafts-folder "/[Gmail].Drafts")
(setq mu4e-sent-folder   "/[Gmail].Sent Mail")
(setq mu4e-trash-folder  "/[Gmail].Trash")
(setq mu4e-attachment-dir  "~/Downloads")

but if i leave emacs in the mu4e "inbox" buffer new mail wont appear there (thats is it wont auto refresh) and i have to exit with 'q' and re-enter with 'ji' to see the new mails

any clue what i can test to try and figure this out?

best'

Z

Gour

unread,
Apr 6, 2015, 2:15:30 AM4/6/15
to mu-di...@googlegroups.com

zeltak brisbane <ikl...@gmail.com> writes:

> but if i leave emacs in the mu4e "inbox" buffer new mail wont appear
> there (thats is it wont auto refresh) and i have to exit with 'q' and
> re-enter with 'ji' to see the new mails
>
> any clue what i can test to try and figure this out?

Here is the snippet from my setup:

(require 'mu4e)
(require 'org-mu4e)
(require 'mu4e-contrib)
(mu4e-maildirs-extension)

(setq
mu4e-maildir "~/Maildir" ;; top-level Maildir
mu4e-sent-folder "/sent" ;; folder for sent messages
mu4e-drafts-folder "/drafts" ;; unfinished messages
mu4e-trash-folder "/trash" ;; trashed messages
mu4e-refile-folder "/archive") ;; saved messages

;; suitable for mbsync
(setq mu4e-change-filenames-when-moving t)

(setq mail-user-agent 'mu4e-user-agent)
(setq mu4e-get-mail-command "mbsync -a -q"
mu4e-update-interval 1800
;; mu4e-headers-auto-update t)
)
(setq message-kill-buffer-on-exit t)

and it works nicely. Pls. note that I use mu4e-maildirs-extension which has
function to update index & cache which I find very handy.


Sincerely,
Gour

--
A person is said to be established in self-realization and is called a yogī
[or mystic] when he is fully satisfied by virtue of acquired knowledge and
realization.

zeltak brisbane

unread,
Apr 6, 2015, 3:15:52 AM4/6/15
to mu-di...@googlegroups.com
thx Gour

it seems like mu4e-maildirs-extension does the trick! i wonder why this isnt part of main mu4e!

thanks again

Z

Gour

unread,
Apr 6, 2015, 4:01:45 AM4/6/15
to mu-di...@googlegroups.com

> it seems like mu4e-maildirs-extension does the trick!

I'm glad it helped. ;)

> i wonder why this isnt part of main mu4e!

I'm stil new discovering how to put some pieces together, but using mu4e, in
general, is really enlightnement and I wonder how did I manage to use email
so long without it. :-)

Xavier Maillard

unread,
Apr 7, 2015, 12:59:48 AM4/7/15
to mu-di...@googlegroups.com

zeltak brisbane <ikl...@gmail.com> writes:

> thx Gour
>
> it seems like mu4e-maildirs-extension does the trick! i wonder why this
> isnt part of main mu4e!

I don't have this extension here and my buffers are well
updated/refreshed.

-- Xavier.

Andrey Lisin

unread,
Apr 13, 2015, 10:13:13 AM4/13/15
to mu-di...@googlegroups.com
Hi all,

I've tried to use mu4e in cooperation with offlineimap and have the same issue. The headers buffer is not updated even if offlineimap downloaded new messages successfully unless the headers buffer is not one opened at the moment. If I'm doing stuff in other Emacs buffer I could see echoed messages, that mu4e updating mail indexes, but the buffer is not updated. I could think about a bug in mu4e code. I tried to review mu4e elisp code, but unfortunately I'm not that good in it and the whole thing does not make sense for me :(

P.S. This issue with buffer update is the only reason I don't use mu4e all the time. 

Andrey Lisin

unread,
Apr 14, 2015, 5:45:25 AM4/14/15
to mu-di...@googlegroups.com
After studying mu4e code, I see the issue now.

In mu4e-headers.el module there is a function mu4e~headers-do-auto-update function, responsible for updating headers buffer. This function is hooked locally, because hook defined following manner in mu4e-headers-mode definition:

(add-hook 'mu4e-index-updated-hook 'mu4e~headers-do-auto-update nil t)

So this hook is active only if you're in mu4e-headers-mode.

I guess, motivation behind this is if hook is active globally, you will be be brought to headers buffer whenever new message is coming. Just try to add something like 

(add-hook 'mu4e-index-updated-hook 'mu4e~headers-do-auto-update)

to your init.el

That can be annoying. So the real question is how to update headers buffer without been switched to headers buffer.

Hope this makes sense. 

понедельник, 13 апреля 2015 г., 20:13:13 UTC+6 пользователь Andrey Lisin написал:
Reply all
Reply to author
Forward
0 new messages