mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 09:14:18 +00:00
Fix selected group sort with topics (bug#80341)
* lisp/gnus/gnus-topic.el (gnus-group-sort-selected-topic): New function to sort selected groups into topic. (gnus-topic-mode): Use it as sort selected function in topic mode. * etc/NEWS: Announce the change.
This commit is contained in:
parent
ed158fb8fc
commit
8325809896
2 changed files with 29 additions and 2 deletions
3
etc/NEWS
3
etc/NEWS
|
|
@ -1787,6 +1787,9 @@ It is believed to no longer be useful as a method to fight spam. The
|
|||
The symbolic prefix is another kind of universal prefix that is used in
|
||||
Gnus, see "(gnus) Symbolic Prefixes" in the Gnus manual.
|
||||
|
||||
---
|
||||
*** Sorting selected groups is now possible with 'gnus-topic-mode'.
|
||||
|
||||
** Sieve
|
||||
|
||||
+++
|
||||
|
|
|
|||
|
|
@ -1158,7 +1158,8 @@ articles in the topic and its subtopics."
|
|||
#'gnus-topic-group-indentation)
|
||||
(setq-local gnus-group-update-group-function
|
||||
#'gnus-topic-update-topics-containing-group)
|
||||
(setq-local gnus-group-sort-alist-function #'gnus-group-sort-topic)
|
||||
(setq-local gnus-group-sort-alist-function #'gnus-group-sort-topic
|
||||
gnus-group-sort-selected-function #'gnus-group-sort-selected-topic)
|
||||
(setq gnus-group-change-level-function #'gnus-topic-change-level)
|
||||
(setq gnus-goto-missing-group-function #'gnus-topic-goto-missing-group)
|
||||
(add-hook 'gnus-check-bogus-groups-hook #'gnus-topic-clean-alist
|
||||
|
|
@ -1173,7 +1174,8 @@ articles in the topic and its subtopics."
|
|||
(setq gnus-group-change-level-function nil)
|
||||
(remove-hook 'gnus-check-bogus-groups-hook #'gnus-topic-clean-alist)
|
||||
(setq gnus-group-prepare-function #'gnus-group-prepare-flat)
|
||||
(setq gnus-group-sort-alist-function #'gnus-group-sort-flat))
|
||||
(setq gnus-group-sort-alist-function #'gnus-group-sort-flat
|
||||
gnus-group-sort-selected-function #'gnus-group-sort-selected-flat))
|
||||
(when (called-interactively-p 'any)
|
||||
(gnus-group-list-groups))))
|
||||
|
||||
|
|
@ -1651,6 +1653,28 @@ If performed on a topic, edit the topic parameters instead."
|
|||
(setcar alist (delete "dummy.group" (car alist)))
|
||||
(gnus-topic-sort-topic (pop alist) func reverse))))
|
||||
|
||||
(defun gnus-group-sort-selected-topic (groups func reverse)
|
||||
"Sort selected GROUPS in the topics according to FUNC and REVERSE."
|
||||
(let ((alist gnus-topic-alist))
|
||||
(while alist
|
||||
;; !!!Sometimes nil elements sneak into the alist,
|
||||
;; for some reason or other.
|
||||
(setcar alist (delq nil (car alist)))
|
||||
(setcar alist (delete "dummy.group" (car alist)))
|
||||
(let* ((topic (pop alist))
|
||||
(inter (seq-intersection groups (cdr topic))))
|
||||
;; Do something only if there are some selected groups in this
|
||||
;; topic.
|
||||
(when inter
|
||||
(let ((sorted (mapcar #'gnus-info-group
|
||||
(sort (mapcar #'gnus-get-info inter) func))))
|
||||
;; Do the reversal, if necessary.
|
||||
(when reverse
|
||||
(setq sorted (nreverse (cdr sorted))))
|
||||
;; Set the topic contents as the union of the sorted
|
||||
;; selected groups and its previous contents.
|
||||
(setcdr topic (seq-union sorted (cdr topic)))))))))
|
||||
|
||||
(defun gnus-topic-sort-topic (topic func reverse)
|
||||
;; Each topic only lists the name of the group, while
|
||||
;; the sort predicates expect group infos as inputs.
|
||||
|
|
|
|||
Loading…
Reference in a new issue