Function: erc-status-sidebar-default-allsort

erc-status-sidebar-default-allsort is a byte-compiled function defined in erc-status-sidebar.el.gz.

Signature

(erc-status-sidebar-default-allsort TARGET-BUFFERS)

Documentation

Return a list of servers interspersed with their targets.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-status-sidebar.el.gz
;; FIXME profile this.  Rebuilding the graph every time track updates
;; seems wasteful for occasions where server messages are processed
;; unthrottled, such as during history playback.  If it's a problem,
;; we should look into rewriting this using `ewoc' or some other
;; solution that maintains a persistent model.
(defun erc-status-sidebar-default-allsort (target-buffers)
  "Return a list of servers interspersed with their targets."
  (mapcan (pcase-lambda (`(,proc . ,chans))
            (cons (process-buffer proc)
                  (let ((erc-status-sidebar--trimpat
                         (and (eq erc-status-sidebar-style 'all-mixed)
                              (with-current-buffer (process-buffer proc)
                                (when-let ((ch-pfxs (erc--get-isupport-entry
                                                     'CHANTYPES 'single)))
                                  (regexp-quote ch-pfxs)))))
                        (erc-status-sidebar--prechan
                         (and (eq erc-status-sidebar-style
                                  'all-queries-first)
                              "\C-?")))
                    (sort chans
                          (lambda (x y)
                            (string<
                             (erc-status-sidebar-prefer-target-as-name x)
                             (erc-status-sidebar-prefer-target-as-name y)))))))
          (sort (seq-group-by (lambda (b)
                                (buffer-local-value 'erc-server-process b))
                              target-buffers)
                (lambda (a b)
                  (string< (buffer-name (process-buffer (car a)))
                           (buffer-name (process-buffer (car b))))))))