Function: tab-line-tabs-window-buffers

tab-line-tabs-window-buffers is a byte-compiled function defined in tab-line.el.gz.

Signature

(tab-line-tabs-window-buffers)

Documentation

Return a list of tabs that should be displayed in the tab line.

By default returns a list of window buffers, i.e. buffers previously shown in the same window where the tab line is displayed. This list can be overridden by changing the default value of the variable tab-line-tabs-function.

Probably introduced at or before Emacs version 30.1.

Source Code

;; Defined in /usr/src/emacs/lisp/tab-line.el.gz
(defun tab-line-tabs-window-buffers ()
  "Return a list of tabs that should be displayed in the tab line.
By default returns a list of window buffers, i.e. buffers previously
shown in the same window where the tab line is displayed.
This list can be overridden by changing the default value of the
variable `tab-line-tabs-function'."
  (let* ((window (selected-window))
         (buffer (window-buffer window))
         (next-buffers (seq-remove (lambda (b) (eq b buffer))
                                   (window-next-buffers window)))
         (next-buffers (seq-filter #'buffer-live-p next-buffers))
         (prev-buffers (seq-remove (lambda (b) (eq b buffer))
                                   (mapcar #'car (window-prev-buffers window))))
         (prev-buffers (seq-filter #'buffer-live-p prev-buffers))
         ;; Remove next-buffers from prev-buffers
         (prev-buffers (seq-difference prev-buffers next-buffers)))
    (funcall
     tab-line-tabs-window-buffers-filter-function
     (append (reverse prev-buffers)
             (list buffer)
             next-buffers))))