From c5cb66fd5ac9b24c3c462876a463aa9e78bddbd2 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Thu, 4 Jun 2026 00:29:59 +0800 Subject: mail: notmuch new and disable a notification * 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. --- mail.el | 15 +++++++++++++-- 1 file 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.") -- cgit v1.2.3-18-g5258