Function: tab-line-format

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

Signature

(tab-line-format)

Documentation

Format for displaying the tab line of the selected window.

Source Code

;; Defined in /usr/src/emacs/lisp/tab-line.el.gz
(defun tab-line-format ()
  "Format for displaying the tab line of the selected window."
  (let* ((tabs (funcall tab-line-tabs-function))
         (cache-key (list tabs
                          ;; handle buffer renames
                          (buffer-name (window-buffer))
                          ;; handle tab-line scrolling
                          (window-parameter nil 'tab-line-hscroll)
                          ;; for setting face 'tab-line-tab-current'
                          (eq (selected-window) (old-selected-window))
                          (and (memq 'tab-line-tab-face-modified
                                     tab-line-tab-face-functions)
                               (buffer-file-name) (buffer-modified-p))))
         (cache (window-parameter nil 'tab-line-cache)))
    ;; Enable auto-hscroll again after it was disabled on manual scrolling.
    ;; The moment to enable it is when the window-buffer was updated.
    (when (and tab-line-auto-hscroll        ; if auto-hscroll was enabled
               (integerp (nth 2 cache-key)) ; integer on manual scroll
               cache                        ; window-buffer was updated
               (not (equal (nth 1 (car cache)) (nth 1 cache-key))))
      (set-window-parameter nil 'tab-line-hscroll (float (nth 2 cache-key))))
    (or (and cache (equal (car cache) cache-key) (cdr cache))
        (cdr (set-window-parameter
              nil 'tab-line-cache
              (cons cache-key (tab-line-format-template tabs)))))))