From: Daniel Semyonov Date: Mon, 1 Jul 2024 22:42:26 +0000 (+0300) Subject: nnfeed: (Mostly) fix group descriptions X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=91f202f3f6331dc7c0cf3e662ab062e9d2760779;p=emacs.git 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. (Bug#71888) (cherry picked from commit 2fb6a98ecfa1579273a640e923f2e52f75e1f7ad) --- 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 @@ Only HEADERS of a type included in MIME are considered." (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 @@ Only HEADERS of a type included in MIME are considered." ((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)))