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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 49068 in the body.
You can then email your comments to 49068 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#49068; Package emacs. (Thu, 17 Jun 2021 00:22:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Alex Bochannek <alex <at> bochannek.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 17 Jun 2021 00:22:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Alex Bochannek <alex <at> bochannek.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 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.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49068; Package emacs. (Sat, 19 Jun 2021 13:06:01 GMT) Full text and rfc822 format available.

Message #8 received at 49068 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Alex Bochannek <alex <at> bochannek.com>
Cc: 49068 <at> debbugs.gnu.org
Subject: Re: bug#49068: 28.0.50; [PATCH] Feature suggestion, add number of
 groups in subtopics to gnus-topic-line-format
Date: Sat, 19 Jun 2021 15:04:51 +0200
Alex Bochannek <alex <at> bochannek.com> writes:

> 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

Thanks; applied to Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 28.1, send any further explanations to 49068 <at> debbugs.gnu.org and Alex Bochannek <alex <at> bochannek.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 19 Jun 2021 13:06:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49068; Package emacs. (Sat, 19 Jun 2021 15:41:01 GMT) Full text and rfc822 format available.

Message #13 received at 49068 <at> debbugs.gnu.org (full text, mbox):

From: Alex Bochannek <alex <at> bochannek.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 49068 <at> debbugs.gnu.org
Subject: Re: bug#49068: 28.0.50; [PATCH] Feature suggestion, add number of
 groups in subtopics to gnus-topic-line-format
Date: Sat, 19 Jun 2021 08:40:09 -0700
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Alex Bochannek <alex <at> bochannek.com> writes:
>
>> 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
>
> Thanks; applied to Emacs 28.

Thanks!

-- 
Alex.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 18 Jul 2021 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 282 days ago.

Previous Next


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