Function: marginalia-annotate-tab

marginalia-annotate-tab is a byte-compiled function defined in marginalia.el.

Signature

(marginalia-annotate-tab CAND)

Documentation

Annotate named tab CAND with tab index, window and buffer information.

Source Code

;; Defined in ~/.emacs.d/elpa/marginalia-20260724.810/marginalia.el
(defun marginalia-annotate-tab (cand)
  "Annotate named tab CAND with tab index, window and buffer information."
  (when-let* ((tabs (funcall tab-bar-tabs-function))
              (index (seq-position
                      tabs nil
                      (lambda (tab _) (equal (alist-get 'name tab) cand)))))
    (let* ((tab (nth index tabs))
           (ws (alist-get 'ws tab))
           (bufs (window-state-buffers ws)))
      ;; When the buffer key is present in the window state it is added in front
      ;; of the window buffer list and gets duplicated.
      (when (cadr (assq 'buffer ws)) (pop bufs))
      (marginalia--fields
       (:left (1+ index) :format " (%s)" :face 'marginalia-key)
       ((if (eq (car tab) 'current-tab)
            (length (window-list nil 'no-minibuf))
          (length bufs))
        :format "win:%s" :face 'marginalia-size)
       ((or (alist-get 'group tab) 'none)
        :format "group:%s" :face 'marginalia-type :truncate 20)
       ((if (eq (car tab) 'current-tab)
            "(current tab)"
          (string-join bufs " "))
        :face 'marginalia-documentation)))))