summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mail.el15
1 files changed, 13 insertions, 2 deletions
diff --git a/mail.el b/mail.el
index 2cd7f82..61414bc 100644
--- a/mail.el
+++ b/mail.el
@@ -268,6 +268,14 @@ mails."
(defvar durand-mail-update-hook nil
"The hook run after the process that updates mails is finished.")
+;; Update notmuch index
+
+(defun notmuch-new ()
+ "Run notmuch new."
+ (call-process "notmuch" nil nil nil "new"))
+
+(add-hook 'durand-mail-update-hook #'notmuch-new)
+
(defun durand-mail-update-sentinel (process status)
"Handle STATUS changes of the PROCESS for updating mails.
This funciton runs the hook `durand-mail-update-hook' after the
@@ -331,8 +339,11 @@ If FOREGROUND-P is `0', do not fetch mails, but just run
durand-mail-update-buffer)))
(buffer-disable-undo buffer)
buffer)))))
- ((not (or process-found internet-on))
- (message "MAIL: There is no internet connection.")))))
+ ;; I do not want to be notified of this when it runs in the
+ ;; background.
+ ((and foreground-p (not (or process-found internet-on)))
+ (message "MAIL: There is no internet connection.")
+ ))))
(defvar durand-mail-update-timer nil
"A timer to automatically update mail in the background.")