🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #266052

Re: [Gnus] Applying scores to groups as soon as news is fetched

#266052
From: Benjamin Esham
Date: Mon, 22 May 2023 16:31
33 lines
2181 bytes
issdr wrote:

> i tried the piece of code you isolated, it works both at startup and
> when checking news again, it just gives warnings of no group found once
> it's thru.

Yes, the warnings are a bit annoying. Maybe it's possible to suppress them
by setting gnus-verbose locally? Otherwise, though, this works well:

    ; Apply scores as soon as news is fetched
    (defun apply-scores-to-subscribed-groups ()
      (let (info group newsrc unread)
        (setq newsrc (cdr gnus-newsrc-alist))
        (while (setq info (pop newsrc))
          (setq group (gnus-info-group info)
                unread (gnus-group-unread group))
          (when (and (<= (gnus-info-level info) gnus-level-subscribed)
                     (and unread
                          (or (eq unread t)
                              (not (zerop unread)))))
            (ignore-errors
              (gnus-summary-read-group group nil t nil t)) 
            (when (eq (current-buffer) (get-buffer gnus-summary-buffer))
              (gnus-summary-exit))))))

    (add-hook 'gnus-started-hook
              'apply-scores-to-subscribed-groups)
    (add-hook 'gnus-after-getting-new-news-hook
              'apply-scores-to-subscribed-groups)

Thank you for the assistance!

Benjamin
Technical Details
Message-ID: <rv2j3l.ev0xt0@bdesham.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
References: <rucwqq.ngzfbd@bdesham.net> <87bkiuvzhu.fsf@ID-313311.news.uni-berlin.de> <rurn21.lz09lt@bdesham.net> <87h6sbl45q.fsf@ID-313311.news.uni-berlin.de> <rut40y.9jc61k@bdesham.net> <877ct6byzv.fsf@ID-313311.news.uni-berlin.de>

Show Full Headers
Complete Article Headers
Message-ID: <rv2j3l.ev0xt0@bdesham.net>
Subject: Re: [Gnus] Applying scores to groups as soon as news is fetched
Date: Mon, 22 May 2023 12:31:36 -0400
From: Benjamin Esham <usenet@esham.io>
References: <rucwqq.ngzfbd@bdesham.net> <87bkiuvzhu.fsf@ID-313311.news.uni-berlin.de> <rurn21.lz09lt@bdesham.net> <87h6sbl45q.fsf@ID-313311.news.uni-berlin.de> <rut40y.9jc61k@bdesham.net> <877ct6byzv.fsf@ID-313311.news.uni-berlin.de>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
Newsgroups: news.software.readers
Organization: United Federation of Planets
Lines: 33
Mime-Version: 1.0
Content-Type: text/plain
User-Agent: Gnus/5.13 (macOS)
Cancel-Lock: sha1:VChq52wBhg+UtWzY1VTL7Z5e8QA= sha1:3LL3XXs2fng94wJ5/cWm6kezTkA=