Function: tab-line-format-template

tab-line-format-template is a byte-compiled function defined in tab-line.el.gz.

Signature

(tab-line-format-template TABS)

Documentation

Template of the format for displaying tab line for selected window.

This is used by tab-line-format(var)/tab-line-format(fun).

Source Code

;; Defined in /usr/src/emacs/lisp/tab-line.el.gz
(defun tab-line-format-template (tabs)
  "Template of the format for displaying tab line for selected window.
This is used by `tab-line-format'."
  (let* ((separator (or tab-line-separator (if (window-system) " " "|")))
         (hscroll (window-parameter nil 'tab-line-hscroll))
         (strings
          (mapcar
           (lambda (tab)
             (concat separator
                     (funcall tab-line-tab-name-format-function tab tabs)))
           tabs))
         (hscroll-data (tab-line-auto-hscroll strings hscroll)))
    (setq hscroll (nth 1 hscroll-data))
    (append
     (if (null (nth 0 hscroll-data))
         (when hscroll
           (setq hscroll nil)
           (set-window-parameter nil 'tab-line-hscroll hscroll))
       (list separator
             (when (and (numberp hscroll) (not (zerop hscroll)))
               tab-line-left-button)
             (when (if (numberp hscroll)
                       (< (truncate hscroll) (1- (length strings)))
                     (> (length strings) 1))
               tab-line-right-button)))
     (if hscroll (nthcdr (truncate hscroll) strings) strings)
     (list separator)
     (when (and (eq tab-line-tabs-function #'tab-line-tabs-window-buffers)
                tab-line-new-button-show
                tab-line-new-button)
       (list tab-line-new-button)))))