🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #266046

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

#266046
From: Benjamin Esham
Date: Wed, 17 May 2023 14:52
71 lines
3300 bytes
issdr wrote:

> Benjamin Esham wrote:
>
>> issdr wrote:
>
> [...]
>
>>     (add-hook 'gnus-started-hook 'gnus-batch-score)
>>     (add-hook 'gnus-after-getting-new-news-hook 'gnus-batch-score)
>>
>> but that didn't seem to work: there was a very long delay after I started
>> Gnus--maybe as long as a minute--but still not all of my scores had been
>> applied.
>
> those vars are labeled as risky in local files. second one generated an
> endless loop, as `gnus-batch-score' does get new news itself.

Can you tell me where/how they're labeled as risky? I'm pretty new to Emacs
Lisp.

>> I went into the Gnus source and extracted the "main part" of that
>> function, which is
>>
>>     (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)))))
>>
>> and found that if I ran this interactively (at the M-: prompt) after news
>> had been fetched, then the scores would really, truly be applied.
>
> good. define a new function with it, then *add* it to the
> after-getting-new-news hook (you were replacing it, and it's non empty
> by default), like
>
> (eval-after-load "gnus-start"
>   '(add-to-list 'gnus-after-getting-new-news-hook 'ben-gnus-score t))
>
> [...]

Are you sure? The Elisp manual [1] seems to make it pretty clear that
add-hook will *append* the given function to the given hook, not replace any
previously-added functions.

>>> <nntp://news.eternal-september.org/gnu.emacs.gnus>.
>>
>> I'm pretty sure I've posted in that group before, and yet Gnus is
>> telling me that it doesn't exist on the server. But that will be a
>> separate thing to debug...
>
> i believe i have an account there, i'll check when i reach my pc

It looks like I misremembered the error I had gotten. Gnus told me "Group
gnu.emacs.gnus contains no messages", which is surprising (*no one* has
posted recently enough for Eternal September to retain the message?) but not
completely implausible.

Benjamin


[1] https://www.gnu.org/software/emacs/manual/html_node/elisp/Setting-Hooks.html#index-add_002dhook
Technical Details
Message-ID: <rut40y.9jc61k@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>

Show Full Headers
Complete Article Headers
Message-ID: <rut40y.9jc61k@bdesham.net>
Subject: Re: [Gnus] Applying scores to groups as soon as news is fetched
Date: Wed, 17 May 2023 10:52:43 -0400
From: Benjamin Esham <usenet@esham.io>
References: <rucwqq.ngzfbd@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
Newsgroups: news.software.readers
Organization: United Federation of Planets
Lines: 71
MIME-Version: 1.0
Content-Type: text/plain
User-Agent: Gnus/5.13 (macOS)
Cancel-Lock: sha1:hNeItZANAz4OCSE2EUNuawAfEdI=