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

* bug#71888: [PATCH] nnfeed: (Mostly) fix group descriptions
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2024-07-02 12:11 UTC (permalink / raw)
  To: Daniel Semyonov; +Cc: 71888

> Date: Tue, 02 Jul 2024 02:43:29 +0300
> From:  Daniel Semyonov via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> 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.

Thanks, but please tell whether this is for the emacs-30 release
branch or for master.  IOW, does the problem exist on emacs-30 or only
on master?






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

* bug#71888: [PATCH] nnfeed: (Mostly) fix group descriptions
  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
  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-02 21:01 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 71888

>>>>> Eli Zaretskii writes:

    >> Date: Tue, 02 Jul 2024 02:43:29 +0300
    >> From:  Daniel Semyonov via "Bug reports for GNU Emacs,
    >> the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
    >> 
    >> 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.

    > Thanks, but please tell whether this is for the emacs-30 release
    > branch or for master.  IOW, does the problem exist on emacs-30 or only
    > on master?

Sorry, this problem exists on both emacs-30 and on master (it was
unfortunately broken since nnfeed and nnatom were added to Emacs last
year).

I'm currently going over nnfeed and nnatom when I have free time to
hopefully find any issues I missed before Emacs 30 is released (as it
will be the first stable release to include them).





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

* bug#71888: [PATCH] nnfeed: (Mostly) fix group descriptions
  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
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2024-07-06 10:12 UTC (permalink / raw)
  To: Daniel Semyonov; +Cc: 71888

> From: Daniel Semyonov <daniel@dsemy.com>
> Cc: 71888@debbugs.gnu.org
> Date: Wed, 03 Jul 2024 00:01:57 +0300
> 
> >>>>> Eli Zaretskii writes:
> 
>     >> Date: Tue, 02 Jul 2024 02:43:29 +0300
>     >> From:  Daniel Semyonov via "Bug reports for GNU Emacs,
>     >> the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>     >> 
>     >> 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.
> 
>     > Thanks, but please tell whether this is for the emacs-30 release
>     > branch or for master.  IOW, does the problem exist on emacs-30 or only
>     > on master?
> 
> Sorry, this problem exists on both emacs-30 and on master (it was
> unfortunately broken since nnfeed and nnatom were added to Emacs last
> year).

Thanks, so I've now installed the patch on the emacs-30 release
branch.

> I'm currently going over nnfeed and nnatom when I have free time to
> hopefully find any issues I missed before Emacs 30 is released (as it
> will be the first stable release to include them).

So I'm not yet closing this bug, given that you say there's more to be
done here.

Thanks.





^ permalink raw reply	[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.