* fetchmail returns non-zero when there is no mail; try to handle this a bit

more gracefully by showing (possible) 'errors for 5 seconds in the update buffer
This commit is contained in:
djcb 2012-04-16 23:09:42 +03:00
parent 127a9108fb
commit 2ac3a63f98
2 changed files with 19 additions and 14 deletions

View File

@ -319,15 +319,19 @@ processing takes part in the background, unless buf is non-nil."
(message "Retrieving mail...")
(set-process-sentinel proc
(lambda (proc msg)
(let ((status (process-status proc)) (code (process-exit-status proc)))
(let* ((status (process-status proc))
(code (process-exit-status proc))
;; sadly, fetchmail returns '1' when there is no mail; this is not really
;; an error of course, but it's hard to distinguish from a genuine error
(maybe-error (or (not (eq status 'exit)) (/= code 0))))
(message nil)
(if (or (not (eq status 'exit)) (/= code 0))
(message "Some error occured while retrieving mail")
(progn ;; update went well, now rerun the index
(mu4e-proc-index mu4e-maildir)
(let ((buf (process-buffer proc)))
(when (buffer-live-p buf)
(kill-buffer buf))))))))))
;; there may be an error, give the user up to 5 seconds to check
(when maybe-error
(sit-for 5))
(mu4e-proc-index mu4e-maildir)
(let ((buf (process-buffer proc)))
(when (buffer-live-p buf)
(kill-buffer buf))))))))
(defun mu4e-display-manual ()

View File

@ -53,7 +53,8 @@ PATH, you can specify the full path."
(defcustom mu4e-get-mail-command nil
"Shell command to run to retrieve new mail; e.g. 'offlineimap' or
'fetchmail'."
'fetchmail'. Note, when there is no mail, fetchmail will return 1
as it error code, which mu4e interprets as an error."
:type 'string
:group 'mu4e
:safe 'stringp)
@ -358,6 +359,11 @@ flag set)."
"Face for a header title in the headers view."
:group 'mu4e-faces)
(defface mu4e-footer-face
'((t :inherit font-lock-comment-face))
"Face for message footers (signatures)."
:group 'mu4e-faces)
(defface mu4e-view-url-number-face
'((t :inherit font-lock-reference-face :bold t))
"Face for the number tags for URLs."
@ -388,11 +394,6 @@ flag set)."
"Face for cited message parts (level 4)."
:group 'mu4e-faces)
(defface mu4e-view-footer-face
'((t :inherit font-lock-comment-face))
"Face for message footers (signatures)."
:group 'mu4e-faces)
(defface mu4e-hdrs-marks-face
'((t :inherit font-lock-preprocessor-face))
"Face for the mark in the headers list."