summaryrefslogtreecommitdiff
path: root/mail.el
diff options
context:
space:
mode:
Diffstat (limited to 'mail.el')
-rw-r--r--mail.el18
1 files changed, 15 insertions, 3 deletions
diff --git a/mail.el b/mail.el
index 0e2ecdb..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
@@ -283,7 +291,8 @@ PROCESS is finished."
(defvar durand-mail-update-command
(list "mbsync"
"mymail-inbox" "mymail-sent"
- "gmail-inbox" "gmail-sent")
+ "gmail-inbox" "gmail-sent"
+ "myaccount-inbox")
"Command to update mails.")
(defvar durand-mail-update-buffer "*mail*"
@@ -330,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.")