I use notmuch to read emails.
I've configured notmuch
to call offlineimap
via pre-new
hook.
When I press G
to refresh my notmuch
buffer, I want emacs to open my offlineimap log file in another window so I can see the sync process in real time.
Here's is what I've done:
(use-package notmuch
:bind
(:map notmuch-hello-mode-map
("G" . (lambda ()
(interactive)
(find-file-other-window "~/Maildir/.notmuch/hooks/offlineimap.log")
(notmuch-poll-and-refresh-this-buffer)))))
Problem with this is, emacs would only open the log file after sync is done.
How do I make emacs open the log file before notmuch and offlineimap action?
(sit-for 0)
in between. But it's more likely that the refresh function is synchronous and so emacs is "frozen" until it is done. In fact, this seems to say as much, but it also provides a patch to make it asynchronous. Whether that's enough, I don't know, but I would guess not: you still need to tail the logfile which would probably require a bit more work.(sit-for 0)
does fix the problem. Thank you so much. Now a new problem is that the other window wouldn'tauto-revert
until function run is complete. Guess this is not as easy as I thought it would be. Maybe i'll settle with using a terminal to tail my log file.