summaryrefslogtreecommitdiffhomepage
path: root/custom
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2025-09-22 01:37:40 +0100
committerjao <jao@gnu.org>2025-09-22 01:37:40 +0100
commit1ab70176d39e3ff4544bb122d31df6bef61dec9f (patch)
tree20eedfab44d9780204f868787ad502ee72405b1c /custom
parentab86fe6353d5566d62a71a2d80665d330fb705ed (diff)
downloadelibs-1ab70176d39e3ff4544bb122d31df6bef61dec9f.tar.gz
elibs-1ab70176d39e3ff4544bb122d31df6bef61dec9f.tar.bz2
gnus: configurable level for scan demon
Diffstat (limited to 'custom')
-rw-r--r--custom/jao-custom-gnus.el36
1 files changed, 28 insertions, 8 deletions
diff --git a/custom/jao-custom-gnus.el b/custom/jao-custom-gnus.el
index 97201ad..cffedb6 100644
--- a/custom/jao-custom-gnus.el
+++ b/custom/jao-custom-gnus.el
@@ -611,22 +611,42 @@
(require 'gnus-demon)
+(defvar jao-gnus-scan-level 2)
+
+(defun jao-gnus--scan-level (level)
+ (let ((win (current-window-configuration)))
+ (unwind-protect
+ (save-window-excursion
+ (when (gnus-alive-p)
+ (with-current-buffer gnus-group-buffer
+ (gnus-group-get-new-news level))))
+ (set-window-configuration win))))
+
(defun jao-gnus--scan ()
(let ((inhibit-message t))
- (gnus-demon-scan-news)
+ (jao-gnus--scan-level jao-gnus-scan-level)
(jao-gnus--notify)))
+(defun jao-gnus-demon-scan-level (level)
+ (let ((win (current-window-configuration)))
+ (unwind-protect
+ (save-window-excursion
+ (when (gnus-alive-p)
+ (with-current-buffer gnus-group-buffer
+ (gnus-group-get-new-news level t))))
+ (set-window-configuration win))))
+
(defun jao-gnus-add-demon ()
(interactive)
(gnus-demon-add-handler 'jao-gnus--scan 5 1))
-(jao-when-linux
- (jao-gnus-add-demon)
- ;; (gnus-demon-remove-handler 'jao-gnus--scan)
- (gnus-demon-init)
- ;; this is, in theory, not needed; but at some point in the way to emacs
- ;; version 31 this idle timers have ceased to work after a sleep/awake cycle
- (jao-when-linux (add-to-list 'jao-sleep-awake-functions #'jao-gnus-add-demon)))
+(jao-gnus-add-demon)
+;; (gnus-demon-remove-handler 'jao-gnus--scan)
+(gnus-demon-init)
+
+;; this is, in theory, not needed; but at some point in the way to emacs
+;; version 31 this idle timers have ceased to work after a sleep/awake cycle
+(jao-when-linux (add-to-list 'jao-sleep-awake-functions #'jao-gnus-add-demon))
;;; add-ons
;;;; notifications