diff options
| author | Alex Bochannek | 2021-06-19 15:04:37 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2021-06-19 15:04:37 +0200 |
| commit | 6ea7e338466056c10402005a2c2425dfd3c76299 (patch) | |
| tree | 268493746110e9b416108e5efa01a0deeab31189 | |
| parent | 75b68c322716068466ea7b42bc5ff9aea77e3311 (diff) | |
| download | emacs-6ea7e338466056c10402005a2c2425dfd3c76299.tar.gz emacs-6ea7e338466056c10402005a2c2425dfd3c76299.zip | |
Add support for displaying total number of groups in subgroups in Gnus
* 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 (bug#49068).
| -rw-r--r-- | doc/misc/gnus.texi | 2 | ||||
| -rw-r--r-- | lisp/gnus/gnus-topic.el | 39 |
2 files changed, 27 insertions, 14 deletions
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index b63947c044f..ff8404e5320 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi | |||
| @@ -4126,6 +4126,8 @@ Visibility. | |||
| 4126 | Level. | 4126 | Level. |
| 4127 | @item g | 4127 | @item g |
| 4128 | Number of groups in the topic. | 4128 | Number of groups in the topic. |
| 4129 | @item G | ||
| 4130 | Number of groups in the topic and all its subtopics. | ||
| 4129 | @item a | 4131 | @item a |
| 4130 | Number of unread articles in the topic. | 4132 | Number of unread articles in the topic. |
| 4131 | @item A | 4133 | @item A |
diff --git a/lisp/gnus/gnus-topic.el b/lisp/gnus/gnus-topic.el index b974dff372b..568fbbcafb1 100644 --- a/lisp/gnus/gnus-topic.el +++ b/lisp/gnus/gnus-topic.el | |||
| @@ -54,6 +54,7 @@ with some simple extensions. | |||
| 54 | %n Topic name. | 54 | %n Topic name. |
| 55 | %v Nothing if the topic is visible, \"...\" otherwise. | 55 | %v Nothing if the topic is visible, \"...\" otherwise. |
| 56 | %g Number of groups in the topic. | 56 | %g Number of groups in the topic. |
| 57 | %G Number of groups in the topic and its subtopics. | ||
| 57 | %a Number of unread articles in the groups in the topic. | 58 | %a Number of unread articles in the groups in the topic. |
| 58 | %A Number of unread articles in the groups in the topic and its subtopics. | 59 | %A Number of unread articles in the groups in the topic and its subtopics. |
| 59 | 60 | ||
| @@ -87,6 +88,7 @@ See Info node `(gnus)Formatting Variables'." | |||
| 87 | (?v visible ?s) | 88 | (?v visible ?s) |
| 88 | (?i indentation ?s) | 89 | (?i indentation ?s) |
| 89 | (?g number-of-groups ?d) | 90 | (?g number-of-groups ?d) |
| 91 | (?G total-number-of-groups ?d) | ||
| 90 | (?a (gnus-topic-articles-in-topic entries) ?d) | 92 | (?a (gnus-topic-articles-in-topic entries) ?d) |
| 91 | (?A total-number-of-articles ?d) | 93 | (?A total-number-of-articles ?d) |
| 92 | (?l level ?d))) | 94 | (?l level ?d))) |
| @@ -485,16 +487,18 @@ If LOWEST is non-nil, list all newsgroups of level LOWEST or higher." | |||
| 485 | If SILENT, don't insert anything. Return the number of unread | 487 | If SILENT, don't insert anything. Return the number of unread |
| 486 | articles in the topic and its subtopics." | 488 | articles in the topic and its subtopics." |
| 487 | (let* ((type (pop topicl)) | 489 | (let* ((type (pop topicl)) |
| 490 | (entries-level (if gnus-group-listed-groups | ||
| 491 | gnus-level-killed | ||
| 492 | list-level)) | ||
| 493 | (all (or predicate gnus-group-listed-groups | ||
| 494 | (cdr (assq 'visible | ||
| 495 | (gnus-topic-hierarchical-parameters | ||
| 496 | (car type)))))) | ||
| 497 | (lowest (if gnus-group-listed-groups 0 lowest)) | ||
| 488 | (entries (gnus-topic-find-groups | 498 | (entries (gnus-topic-find-groups |
| 489 | (car type) | 499 | (car type) entries-level all lowest)) |
| 490 | (if gnus-group-listed-groups | 500 | (all-groups (gnus-topic-find-groups |
| 491 | gnus-level-killed | 501 | (car type) entries-level all lowest t)) |
| 492 | list-level) | ||
| 493 | (or predicate gnus-group-listed-groups | ||
| 494 | (cdr (assq 'visible | ||
| 495 | (gnus-topic-hierarchical-parameters | ||
| 496 | (car type))))) | ||
| 497 | (if gnus-group-listed-groups 0 lowest))) | ||
| 498 | (visiblep (and (eq (nth 1 type) 'visible) (not silent))) | 502 | (visiblep (and (eq (nth 1 type) 'visible) (not silent))) |
| 499 | (gnus-group-indentation | 503 | (gnus-group-indentation |
| 500 | (make-string (* gnus-topic-indent-level level) ? )) | 504 | (make-string (* gnus-topic-indent-level level) ? )) |
| @@ -573,7 +577,7 @@ articles in the topic and its subtopics." | |||
| 573 | (gnus-topic-insert-topic-line | 577 | (gnus-topic-insert-topic-line |
| 574 | (car type) visiblep | 578 | (car type) visiblep |
| 575 | (not (eq (nth 2 type) 'hidden)) | 579 | (not (eq (nth 2 type) 'hidden)) |
| 576 | level all-entries unread)) | 580 | level all-entries unread all-groups)) |
| 577 | (gnus-topic-update-unreads (car type) unread) | 581 | (gnus-topic-update-unreads (car type) unread) |
| 578 | (gnus-group--setup-tool-bar-update beg end) | 582 | (gnus-group--setup-tool-bar-update beg end) |
| 579 | (goto-char end) | 583 | (goto-char end) |
| @@ -627,10 +631,10 @@ articles in the topic and its subtopics." | |||
| 627 | (defvar gnus-tmp-header) | 631 | (defvar gnus-tmp-header) |
| 628 | 632 | ||
| 629 | (defun gnus-topic-insert-topic-line (name visiblep shownp level entries | 633 | (defun gnus-topic-insert-topic-line (name visiblep shownp level entries |
| 630 | &optional unread) | 634 | &optional unread all-groups) |
| 631 | (gnus--\,@ | 635 | (gnus--\,@ |
| 632 | (let ((vars '(indentation visible name level number-of-groups | 636 | (let ((vars '(indentation visible name level number-of-groups |
| 633 | total-number-of-articles entries))) | 637 | total-number-of-groups total-number-of-articles entries))) |
| 634 | `((with-suppressed-warnings ((lexical ,@vars)) | 638 | `((with-suppressed-warnings ((lexical ,@vars)) |
| 635 | ,@(mapcar (lambda (s) `(defvar ,s)) vars))))) | 639 | ,@(mapcar (lambda (s) `(defvar ,s)) vars))))) |
| 636 | (let* ((visible (if visiblep "" "...")) | 640 | (let* ((visible (if visiblep "" "...")) |
| @@ -639,6 +643,7 @@ articles in the topic and its subtopics." | |||
| 639 | (indentation (make-string (* gnus-topic-indent-level level) ? )) | 643 | (indentation (make-string (* gnus-topic-indent-level level) ? )) |
| 640 | (total-number-of-articles unread) | 644 | (total-number-of-articles unread) |
| 641 | (number-of-groups (length entries)) | 645 | (number-of-groups (length entries)) |
| 646 | (total-number-of-groups (length all-groups)) | ||
| 642 | (active-topic (eq gnus-topic-alist gnus-topic-active-alist)) | 647 | (active-topic (eq gnus-topic-alist gnus-topic-active-alist)) |
| 643 | gnus-tmp-header) | 648 | gnus-tmp-header) |
| 644 | (gnus-topic-update-unreads name unread) | 649 | (gnus-topic-update-unreads name unread) |
| @@ -731,6 +736,9 @@ articles in the topic and its subtopics." | |||
| 731 | (entries (gnus-topic-find-groups | 736 | (entries (gnus-topic-find-groups |
| 732 | (car type) (car gnus-group-list-mode) | 737 | (car type) (car gnus-group-list-mode) |
| 733 | (cdr gnus-group-list-mode))) | 738 | (cdr gnus-group-list-mode))) |
| 739 | (all-groups (gnus-topic-find-groups | ||
| 740 | (car type) (car gnus-group-list-mode) | ||
| 741 | (cdr gnus-group-list-mode) nil t)) | ||
| 734 | entry) | 742 | entry) |
| 735 | (while children | 743 | (while children |
| 736 | (cl-incf unread (gnus-topic-unread (caar (pop children))))) | 744 | (cl-incf unread (gnus-topic-unread (caar (pop children))))) |
| @@ -738,7 +746,7 @@ articles in the topic and its subtopics." | |||
| 738 | (when (numberp (car entry)) | 746 | (when (numberp (car entry)) |
| 739 | (cl-incf unread (car entry)))) | 747 | (cl-incf unread (car entry)))) |
| 740 | (gnus-topic-insert-topic-line | 748 | (gnus-topic-insert-topic-line |
| 741 | topic t t (car (gnus-topic-find-topology topic)) nil unread))) | 749 | topic t t (car (gnus-topic-find-topology topic)) nil unread all-groups))) |
| 742 | 750 | ||
| 743 | (defun gnus-topic-goto-missing-topic (topic) | 751 | (defun gnus-topic-goto-missing-topic (topic) |
| 744 | (if (gnus-topic-goto-topic topic) | 752 | (if (gnus-topic-goto-topic topic) |
| @@ -768,6 +776,9 @@ articles in the topic and its subtopics." | |||
| 768 | (entries (gnus-topic-find-groups | 776 | (entries (gnus-topic-find-groups |
| 769 | (car type) (car gnus-group-list-mode) | 777 | (car type) (car gnus-group-list-mode) |
| 770 | (cdr gnus-group-list-mode))) | 778 | (cdr gnus-group-list-mode))) |
| 779 | (all-groups (gnus-topic-find-groups | ||
| 780 | (car type) (car gnus-group-list-mode) | ||
| 781 | (cdr gnus-group-list-mode) t)) | ||
| 771 | (parent (gnus-topic-parent-topic topic-name)) | 782 | (parent (gnus-topic-parent-topic topic-name)) |
| 772 | (all-entries entries) | 783 | (all-entries entries) |
| 773 | (unread 0) | 784 | (unread 0) |
| @@ -786,7 +797,7 @@ articles in the topic and its subtopics." | |||
| 786 | (gnus-topic-insert-topic-line | 797 | (gnus-topic-insert-topic-line |
| 787 | (car type) (gnus-topic-visible-p) | 798 | (car type) (gnus-topic-visible-p) |
| 788 | (not (eq (nth 2 type) 'hidden)) | 799 | (not (eq (nth 2 type) 'hidden)) |
| 789 | (gnus-group-topic-level) all-entries unread) | 800 | (gnus-group-topic-level) all-entries unread all-groups) |
| 790 | (gnus-delete-line) | 801 | (gnus-delete-line) |
| 791 | (forward-line -1) | 802 | (forward-line -1) |
| 792 | (setq new-unread (gnus-group-topic-unread))) | 803 | (setq new-unread (gnus-group-topic-unread))) |