Re: How to maintain newsrc.eld clean and tidy

Björn Bidar <[email protected]> Mon, 28 Oct 2024 15:20:25 +0200
Newsgroups gmane.emacs.gnus.general
Message-ID <[email protected]>
Dilip <[email protected]> writes:

>> Personally I just have a Gnus demon timer to save newsrc, sync with
>> Nextcloud and the close whenever I'm done on that machine.
> It has become an habit to hit 's' to save after I read, Just like 'C-x
> C-s'
> I will also try to make demon timer.

Here's what I do:
(defun gnus-demon-scan-news-2 ()
  (when gnus-plugged
    (let ((win (current-window-configuration))
          (gnus-read-active-file nil)
          (gnus-check-new-newsgroups nil)
          (gnus-verbose 2)
          (gnus-verbose-backends 5))
      (unwind-protect
          (save-window-excursion
            (when (gnus-alive-p)
              (with-current-buffer gnus-group-buffer
                (gnus-group-get-new-news gnus-activate-level))))
        (set-window-configuration win)))))

(defun save-gnus-newsrc ()
  (if (and (fboundp 'gnus-group-exit)
           (gnus-alive-p))
      (with-current-buffer (get-buffer "*Group*")
        (gnus-save-newsrc-file))))


(setopt gnus-demon-handlers '((gnus-demon-scan-mail 120 60)
                              (gnus-demon-close-connections nil 3)
                              (save-gnus-newsrc nil 1)
                              (gnus-demon-scan-news-2 60 nil)))


The rest of my config is here below:
https://github.com/Thaodan/emacs.d/blob/master/init.org