all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#71888: [PATCH] nnfeed: (Mostly) fix group descriptions
@ 2024-07-01 23:43 Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-07-02 12:11 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-07-01 23:43 UTC (permalink / raw)
  To: 71888

[-- Attachment #1: Type: text/plain, Size: 1345 bytes --]

Tags: patch

Hi,

I realized a few days ago I barely tested group descriptions in nnatom
(and by extension nnfeed), and turns out they were in fact broken.
Attached is a patch which should fix them.

Also, while working on this patch I found out the Gnus backend interface
docs are slightly misleading on this subject - Gnus reads a group
description per line inserted in the " *nntpd*" buffer, with each line
containing a group's name followed by its description.
Contrary to the docs, the separator between the name and its associated
description is either a space or a tab (the docs only mention a tab).
This is why this is "mostly" fixed, as groups with a space in their name
will incorrectly include any part of the name after the first space in
the description.

I don't currently have time to go over all other backends to see if
changing this to reflect the docs will break anything, so I just added a
comment about it.

Daniel



In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.41, cairo version 1.18.0) of 2024-06-12 built on coldharbour
Repository revision: 3905db6e3aa947b847c072259ad6d08c8a15e10e
Repository branch: master
System Description: Void Linux

Configured using:
 'configure -C --prefix=/opt/Emacs --without-x --with-pgtk
 --with-small-ja-dic --with-native-compilation 'CFLAGS=-march=native
 -O2''


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-nnfeed-Mostly-fix-group-descriptions.patch --]
[-- Type: text/patch, Size: 2123 bytes --]

From b7cbb2d58cab74eb6137ad05d64466b249cbadf4 Mon Sep 17 00:00:00 2001
From: Daniel Semyonov <daniel@dsemy.com>
Date: Tue, 2 Jul 2024 01:42:26 +0300
Subject: [PATCH] nnfeed: (Mostly) fix group descriptions

* lisp/gnus/nnfeed.el (nnfeed--group-description): New function.
(nnfeed-request-group-description)
(nnfeed-request-list-newsgroups): Use
`nnfeed--group-description' and always return t if group data is
found.
---
 lisp/gnus/nnfeed.el | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/lisp/gnus/nnfeed.el b/lisp/gnus/nnfeed.el
index d6963b2e929..2d33d4c813b 100644
--- a/lisp/gnus/nnfeed.el
+++ b/lisp/gnus/nnfeed.el
@@ -630,12 +630,21 @@ nnfeed-retrieve-groups
 (deffoo nnfeed-request-type (_group &optional _article)
   'unknown)
 
+;; FIXME: Works incorrectly when a group name contains spaces as Gnus actually
+;; separates the group name from the description with either a tab or a space.
+(defun nnfeed--group-description (name group)
+  "Return a description line for a GROUP called NAME."
+  (when-let ((desc (aref group 5))
+             ((not (string-blank-p desc))))
+    (insert name "\t" desc "\n")))
+
 (deffoo nnfeed-request-group-description (group &optional server)
   (when-let ((server (or server (nnfeed--current-server-no-prefix)))
              (g (nnfeed--group-data group server)))
     (with-current-buffer nntp-server-buffer
       (erase-buffer)
-      (insert group "	" (aref g 5) "\n"))))
+      (nnfeed--group-description group g)
+      t)))
 
 (deffoo nnfeed-request-list-newsgroups (&optional server)
   (when-let ((server (or server (nnfeed--current-server-no-prefix)))
@@ -643,9 +652,8 @@ nnfeed-request-list-newsgroups
              ((hash-table-p s)))
     (with-current-buffer nntp-server-buffer
       (erase-buffer)
-      (maphash (lambda (group g)
-                 (insert group "	" (aref g 5) "\n"))
-               s))))
+      (maphash #'nnfeed--group-description s)
+      t)))
 
 (deffoo nnfeed-request-rename-group (group new-name &optional server)
   (when-let ((server (or server (nnfeed--current-server-no-prefix)))
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-07-06 10:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-01 23:43 bug#71888: [PATCH] nnfeed: (Mostly) fix group descriptions Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-02 12:11 ` Eli Zaretskii
2024-07-02 21:01   ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-06 10:12     ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.