GNU bug report logs - #49068
28.0.50; [PATCH] Feature suggestion, add number of groups in subtopics to gnus-topic-line-format

Previous Next

Package: emacs;

Reported by: Alex Bochannek <alex <at> bochannek.com>

Date: Thu, 17 Jun 2021 00:22:01 UTC

Severity: normal

Tags: patch

Found in version 28.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Alex Bochannek <alex <at> bochannek.com>
To: 49068 <at> debbugs.gnu.org
Subject: bug#49068: 28.0.50; [PATCH] Feature suggestion, add number of groups in subtopics to gnus-topic-line-format
Date: Wed, 16 Jun 2021 17:21:01 -0700
[Message part 1 (text/plain, inline)]
Hello!

I would like to display not just the number of unread articles for
subtopics in the topic line, but also have the number of groups include
the subtopics.


For 'gnus-topic-line-format' variable add 'G' element to allow for
display of number of groups in subtopics

	* lisp/gnus/gnus-topic.el (gnus-topic-line-format)
	(gnus-topic-line-format-alist, gnus-topic-prepare-topic)
	(gnus-topic-insert-topic-line, )
	(gnus-topic-display-missing-topic, )
	(gnus-topic-update-topic-line):
	Provide number of groups in subtopics for topic line display and
	add 'G' element to be used for 'gnus-topic-line-format' variable

	* doc/misc/gnus.texi (Topic Variables):
	Document 'G' element for 'gnus-topic-line-format' variable
[Message part 2 (text/x-patch, inline)]
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index b63947c044..ff8404e532 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -4126,6 +4126,8 @@ Topic Variables
 Level.
 @item g
 Number of groups in the topic.
+@item G
+Number of groups in the topic and all its subtopics.
 @item a
 Number of unread articles in the topic.
 @item A
diff --git a/lisp/gnus/gnus-topic.el b/lisp/gnus/gnus-topic.el
index b974dff372..568fbbcafb 100644
--- a/lisp/gnus/gnus-topic.el
+++ b/lisp/gnus/gnus-topic.el
@@ -54,6 +54,7 @@ gnus-topic-line-format
 %n  Topic name.
 %v  Nothing if the topic is visible, \"...\" otherwise.
 %g  Number of groups in the topic.
+%G  Number of groups in the topic and its subtopics.
 %a  Number of unread articles in the groups in the topic.
 %A  Number of unread articles in the groups in the topic and its subtopics.
 
@@ -87,6 +88,7 @@ gnus-topic-line-format-alist
     (?v visible ?s)
     (?i indentation ?s)
     (?g number-of-groups ?d)
+    (?G total-number-of-groups ?d)
     (?a (gnus-topic-articles-in-topic entries) ?d)
     (?A total-number-of-articles ?d)
     (?l level ?d)))
@@ -485,16 +487,18 @@ gnus-topic-prepare-topic
 If SILENT, don't insert anything.  Return the number of unread
 articles in the topic and its subtopics."
   (let* ((type (pop topicl))
+	 (entries-level (if gnus-group-listed-groups
+			    gnus-level-killed
+			  list-level))
+	 (all (or predicate gnus-group-listed-groups
+		  (cdr (assq 'visible
+			     (gnus-topic-hierarchical-parameters
+			      (car type))))))
+	 (lowest (if gnus-group-listed-groups 0 lowest))
 	 (entries (gnus-topic-find-groups
-		   (car type)
-		   (if gnus-group-listed-groups
-		       gnus-level-killed
-		     list-level)
-		   (or predicate gnus-group-listed-groups
-		       (cdr (assq 'visible
-				  (gnus-topic-hierarchical-parameters
-				   (car type)))))
-		   (if gnus-group-listed-groups 0 lowest)))
+		   (car type) entries-level all lowest))
+	 (all-groups (gnus-topic-find-groups
+		      (car type) entries-level all lowest t))
 	 (visiblep (and (eq (nth 1 type) 'visible) (not silent)))
 	 (gnus-group-indentation
 	  (make-string (* gnus-topic-indent-level level) ? ))
@@ -573,7 +577,7 @@ gnus-topic-prepare-topic
       (gnus-topic-insert-topic-line
        (car type) visiblep
        (not (eq (nth 2 type) 'hidden))
-       level all-entries unread))
+       level all-entries unread all-groups))
     (gnus-topic-update-unreads (car type) unread)
     (gnus-group--setup-tool-bar-update beg end)
     (goto-char end)
@@ -627,10 +631,10 @@ gnus-topic-fold
 (defvar gnus-tmp-header)
 
 (defun gnus-topic-insert-topic-line (name visiblep shownp level entries
-					  &optional unread)
+					  &optional unread all-groups)
   (gnus--\,@
    (let ((vars '(indentation visible name level number-of-groups
-                 total-number-of-articles entries)))
+                 total-number-of-groups total-number-of-articles entries)))
      `((with-suppressed-warnings ((lexical ,@vars))
          ,@(mapcar (lambda (s) `(defvar ,s)) vars)))))
   (let* ((visible (if visiblep "" "..."))
@@ -639,6 +643,7 @@ gnus-topic-insert-topic-line
 	 (indentation (make-string (* gnus-topic-indent-level level) ? ))
 	 (total-number-of-articles unread)
 	 (number-of-groups (length entries))
+	 (total-number-of-groups (length all-groups))
 	 (active-topic (eq gnus-topic-alist gnus-topic-active-alist))
 	 gnus-tmp-header)
     (gnus-topic-update-unreads name unread)
@@ -731,6 +736,9 @@ gnus-topic-display-missing-topic
 	 (entries (gnus-topic-find-groups
 		   (car type) (car gnus-group-list-mode)
 		   (cdr gnus-group-list-mode)))
+	 (all-groups (gnus-topic-find-groups
+		   (car type) (car gnus-group-list-mode)
+		   (cdr gnus-group-list-mode) nil t))
 	entry)
     (while children
       (cl-incf unread (gnus-topic-unread (caar (pop children)))))
@@ -738,7 +746,7 @@ gnus-topic-display-missing-topic
       (when (numberp (car entry))
 	(cl-incf unread (car entry))))
     (gnus-topic-insert-topic-line
-     topic t t (car (gnus-topic-find-topology topic)) nil unread)))
+     topic t t (car (gnus-topic-find-topology topic)) nil unread all-groups)))
 
 (defun gnus-topic-goto-missing-topic (topic)
   (if (gnus-topic-goto-topic topic)
@@ -768,6 +776,9 @@ gnus-topic-update-topic-line
 	 (entries (gnus-topic-find-groups
 		   (car type) (car gnus-group-list-mode)
 		   (cdr gnus-group-list-mode)))
+	 (all-groups (gnus-topic-find-groups
+		   (car type) (car gnus-group-list-mode)
+		   (cdr gnus-group-list-mode) t))
 	 (parent (gnus-topic-parent-topic topic-name))
 	 (all-entries entries)
 	 (unread 0)
@@ -786,7 +797,7 @@ gnus-topic-update-topic-line
       (gnus-topic-insert-topic-line
        (car type) (gnus-topic-visible-p)
        (not (eq (nth 2 type) 'hidden))
-       (gnus-group-topic-level) all-entries unread)
+       (gnus-group-topic-level) all-entries unread all-groups)
       (gnus-delete-line)
       (forward-line -1)
       (setq new-unread (gnus-group-topic-unread)))
[Message part 3 (text/plain, inline)]
-- 
Alex.

This bug report was last modified 3 years and 339 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.