Re: Best way to add Forgejo support?

Tushar <[email protected]> Tue, 10 Mar 2026 11:58:23 +0530
Newsgroups gmane.emacs.gnus.general
Message-ID <[email protected]>
I have been trying to write a dummy backend for the last two weeks. It
displays the groups in a list but I when I click on a group to open it,
it says it couldn't do it.

Any help regarding why this doesn't work would be appreciated.

--8<---------------cut here---------------start------------->8---
;;; nnforgejo.el --- a forgejo backend for Gnus  -*- lexical-binding: t; -*-

;; Copyright (C) 2026  Tushar <[email protected]>

;; Author: Tushar <[email protected]>
;; Keywords: news, vc, tools
;; Version: 0.0.0

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:
;;

;;; Code:

(require 'nnheader)
(require 'nnoo)

(nnoo-declare nnforgejo)
(nnoo-define-basics nnforgejo)

(defun nnforgejo--make-header (number)
  (make-full-mail-header
   number
   (format "%dth issue" number)
   (format "Person named %d" number)
   (format-time-string "%a, %d %h %Y %T %z (%Z)")))

(deffoo nnforgejo-retrieve-headers (articles &optional group server fetch-o=
ld)
  (with-current-buffer nntp-server-buffer
    (erase-buffer)
    (dolist (number articles)
      (nnheader-insert-header (nnforgejo--make-header number)))
    'headers))

(deffoo nnforgejo-request-article (article &optional group server to-buffer)
  (with-current-buffer (or to-buffer nntp-server-buffer)
    (insert "Newsgroups: " group "\n")
    (nnheader-insert-header (nnforgejo--make-header 1))
    (insert (format "Hello I am person named %d" article))
    t))

(deffoo nnforgejo-request-group (group &optional server fast info)
  (nnheader-insert (format "211 10 1 10 %s\n" group)))

(deffoo nnforgejo-request-list (&optional server)
  (with-current-buffer nntp-server-buffer
    (erase-buffer)
    (dotimes (n 10)
      (insert (format "test%d 0000000001 0000000010 n\n" (1+ n)))))
  t)

(nnoo-define-skeleton nnforgejo)
(gnus-declare-backend "nnforgejo" 'post 'address)

(provide 'nnforgejo)

;;; nnforgejo.el ends here
--8<---------------cut here---------------end--------------->8---



[email protected] writes:

> I have been trying to research how one could add forgejo[1] support to
> Gnus (Reading and post to Forgejo issues and pull requests). I am not an
> experienced Gnus user so I might be using the wrong terms.
>
> Is it better to add this support as a =E2=80=9Cbackend=E2=80=9D to Gnus, =
like NNTP, etc.
> Or is it better to write an intermediate server which talks with Forgejo
> and acts like an NNTP server to Gnus (or some other server, I am not
> sure).
>
> Footnotes:
> [1]  https://forgejo.org/

--=20
tusharhero