Re: Best way to add Forgejo support?
[email protected] Tue, 10 Mar 2026 11:46:12 -0400
| Newsgroups | gmane.emacs.gnus.general |
|---|---|
| Message-ID | <871phrelh7.fsf@dick> |
tusharhero> for the last two weeks.
Given your rate of progress, I'd urge you to find employment and earn
enough savings to afford a $200 annual Claude "Pro" subscription. I
personally cut alcohol from my expenses so I could afford it. Win-win
you might say.
Dick: I subscribe to one of the test groups, but when I attempt to enter it=
, it
says "Group test1 contains no messages". Can you explain why?
Claude: Found it. The issue is in nnforgejo-request-list. The NNTP LIST
format is <group> <high> <low> <flags>, but the backend outputs them
swapped:
(insert (format "test%d 0000000001 0000000010 n\n" (1+ n)))
;; ^^^low^^^ ^^^high^^^
gnus-active-to-gnus-format (gnus-start.el:2188-2198) reads the two number=
s as max then min,
then stores the active as (min . max):
(numberp (setq max (read cur))) ; reads 1
(numberp (setq min (read cur))) ; reads 10
...
(puthash group (cons min max) hashtb) ; stores (10 . 1) =E2=86=90 inver=
ted!
So every group gets active (10 . 1). Since that's an inverted range, rang=
e-uncompress
returns nil, gnus-articles-to-read returns 0, and gnus-select-newsgroup r=
eturns nil.
When that happens, gnus-sum.el:3844 falls through to check gnus-list-of-u=
nread-articles =E2=80=94
which also returns nil because (cdr '(10 . 1)) =3D 1 and (car '(10 . 1)) =
=3D 10, so first > last
=E2=86=92 empty list. Hence: "Group test1 contains no messages".
The fix is to swap the numbers in request-list: 0000000010 0000000001.
Dick: I reversed the numbers, and the mesasge count for group "test1"
becamse 10. Good work! When I entered the group, the count immediately
became zero, and I got "No unread news" in the echo area
Claude: gnus-get-newsgroup-headers (gnus-sum.el:6195) parses the
nntp-server-buffer content using nnheader-parse-head. Let's see what
that expects:
Looking at nnheader-parse-head (nnheader.el:311):
(when (re-search-forward "^[23][0-9]+ " nil t)
(setq num (read cur)
beg (point)
end (if (search-forward "\n.\n" nil t)
(goto-char (- (point) 2))
(point))))
It expects each article's headers to be preceded by a 220 <num> Article r=
etrieved. line and
terminated by \n.\n. But nnforgejo-retrieve-headers just calls nnheader-i=
nsert-header with
no such framing. nnheader-parse-head finds no ^[23][0-9]+ line, returns =
nil immediately,
and gnus-newsgroup-headers ends up empty.
With an empty summary buffer, gnus-sum.el:3894-3899 fires:
(if (and (zerop (buffer-size)) (not no-display))
(progn
(gnus-summary-catchup-and-exit nil t) ; =E2=86=90 marks 1-10 as re=
ad
(gnus-message 6 "No unread news")
That catchup-and-exit is why the group count drops to 0.
The fix: retrieve-headers needs to wrap each article with 220 <num> Artic=
le retrieved.\n
before and .\n after the headers nnheader-insert-header already inserts.