summaryrefslogtreecommitdiff
path: root/mail.el
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2024-07-31 16:38:14 +0800
committerJSDurand <mmemmew@gmail.com>2024-07-31 16:38:14 +0800
commiteac0b7a1dae4d3af314321bba5eed33e9a408bcb (patch)
tree05b6cc7d9323b0e33190bc06b00110254171561a /mail.el
parentffc1490530460759689b0355679743544d338a9e (diff)
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.
Diffstat (limited to 'mail.el')
-rw-r--r--mail.el7
1 files changed, 6 insertions, 1 deletions
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"