diff options
-rw-r--r-- | mail.el | 38 |
1 files changed, 21 insertions, 17 deletions
@@ -306,23 +306,27 @@ If FOREGROUND-P is `0', do not fetch mails, but just run (= arg 0)) 0) ((null arg)))))) - (cond - ((and (numberp foreground-p) - (= foreground-p 0)) - (run-hooks 'durand-mail-update-hook)) - ((and (not (get-process "durand-mail-update")) - (durand-internet-on)) - (make-process - :name "durand-mail-update" - :command durand-mail-update-command - :filter (cond (foreground-p #'durand-mail-update-filter)) - :sentinel (cond (foreground-p #'durand-mail-update-sentinel)) - :buffer (cond - (foreground-p - (let ((buffer - (get-buffer-create durand-mail-update-buffer))) - (buffer-disable-undo buffer) - buffer))))))) + (let ((process-found (get-process "durand-mail-update")) + (internet-on (durand-internet-on))) + (cond + ((and (numberp foreground-p) + (= foreground-p 0)) + (run-hooks 'durand-mail-update-hook)) + ((and (not process-found) internet-on) + (make-process + :name "durand-mail-update" + :command durand-mail-update-command + :filter (cond (foreground-p #'durand-mail-update-filter)) + :sentinel (cond (foreground-p #'durand-mail-update-sentinel)) + :buffer (cond + (foreground-p + (let ((buffer + (get-buffer-create + durand-mail-update-buffer))) + (buffer-disable-undo buffer) + buffer))))) + ((not (or process-found internet-on)) + (message "There is no internet connection."))))) (defvar durand-mail-update-timer nil "A timer to automatically update mail in the background.") |