Function: erc-networks--shrink-ids-and-buffer-names-any

erc-networks--shrink-ids-and-buffer-names-any is a byte-compiled function defined in erc-networks.el.gz.

Signature

(erc-networks--shrink-ids-and-buffer-names-any &rest OMIT)

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-networks.el.gz
;; This currently doesn't equalize related identities that may have
;; become mismatched because that shouldn't happen after a connection
;; is up (other than for a brief moment while renicking or similar,
;; when states are inconsistent).
(defun erc-networks--shrink-ids-and-buffer-names-any (&rest omit)
  (let (grown)
    ;; Gather all grown identities.
    (erc-buffer-filter
     (lambda ()
       (when (and erc-networks--id
                  (erc-networks--id-qualifying-p erc-networks--id)
                  (not (memq (current-buffer) omit))
                  (not (memq erc-networks--id grown))
                  (> (erc-networks--id-qualifying-len erc-networks--id) 1))
         (push erc-networks--id grown))))
    ;; Check for other identities with shared prefix.  If none exists,
    ;; and an identity is overlong, shrink it.
    (dolist (nid grown)
      (let ((skip (not (null omit))))
        (catch 'found
          (if (cdr grown)
              (dolist (other grown)
                (unless (eq nid other)
                  (setq skip nil)
                  (when (erc-networks--id-qualifying-prefix-length nid other)
                    (throw 'found (setq skip t)))))
            (setq skip nil)))
        (unless (or skip (< (erc-networks--id-qualifying-len nid) 2))
          (erc-networks--id-qualifying-reset-id nid)
          (erc-buffer-filter
           (lambda ()
             (when (and (eq erc-networks--id nid)
                        (not (memq (current-buffer) omit)))
               (if erc--target
                   (erc-networks--refresh-buffer-names nid omit)
                 (erc-networks--maybe-update-buffer-name))))))))))