Function: gnus-group-sort-selected-topic

gnus-group-sort-selected-topic is a byte-compiled function defined in gnus-topic.el.gz.

Signature

(gnus-group-sort-selected-topic GROUPS FUNC REVERSE)

Documentation

Sort selected GROUPS in the topics according to FUNC and REVERSE.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-topic.el.gz
(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)))))))))