From eac0b7a1dae4d3af314321bba5eed33e9a408bcb Mon Sep 17 00:00:00 2001 From: JSDurand Date: Wed, 31 Jul 2024 16:38:14 +0800 Subject: mail: Only update mails automatically when GNUS is on. * mail.el (durand-mail-update): Only update mails automatically when GNUS is on. Sometimes I want to carry the computer to some place without internet, in which case I do not really want to update mails. With this change, I can simply turn off GNUS to stop automatically updating mails, without cancelling the timer, which is quite convenient in my opinion. --- mail.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'mail.el') diff --git a/mail.el b/mail.el index 008df28..0e2ecdb 100644 --- a/mail.el +++ b/mail.el @@ -307,11 +307,16 @@ If FOREGROUND-P is `0', do not fetch mails, but just run 0) ((null arg)))))) (let ((process-found (get-process "durand-mail-update")) - (internet-on (durand-internet-on))) + (internet-on (durand-internet-on)) + (gnus-on (get-buffer "*Group*"))) (cond ((and (numberp foreground-p) (= foreground-p 0)) (run-hooks 'durand-mail-update-hook)) + ((not gnus-on) + ;; Do nothing if GNUS is not turned on, and the function is + ;; asked to update in the background. + ) ((and (not process-found) internet-on) (make-process :name "durand-mail-update" -- cgit v1.2.3-18-g5258