summaryrefslogtreecommitdiff
path: root/mail.el
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2026-06-04 00:29:59 +0800
committerJSDurand <mmemmew@gmail.com>2026-06-04 00:29:59 +0800
commitc5cb66fd5ac9b24c3c462876a463aa9e78bddbd2 (patch)
tree2259a6cea55c8a7872825202ccaf9fdb8be72bf4 /mail.el
parent101d1dea204d53b8043376d0df87f360258dddfe (diff)
mail: notmuch new and disable a notificationHEADmaster
* mail.el (notmuch-new, durand-mail-update-hook): I now call `notmuch new` inside the update-hook to keep notmuch in synchronization. (durand-mail-update): I used to message about the internet not being connected when trying to update. Now this is disblaed if the updating happens in background.
Diffstat (limited to 'mail.el')
-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.")