Function: tab-bar--current-tab-make

tab-bar--current-tab-make is a byte-compiled function defined in tab-bar.el.gz.

Signature

(tab-bar--current-tab-make &optional TAB)

Documentation

Make the current tab data structure from TAB.

TAB here is an argument meaning "use tab as template", i.e. the tab is created using data from TAB. This is necessary when switching tabs, otherwise the destination tab inherits the current tab's explicit-name parameter.

Source Code

;; Defined in /usr/src/emacs/lisp/tab-bar.el.gz
(defun tab-bar--current-tab-make (&optional tab)
  "Make the current tab data structure from TAB.
TAB here is an argument meaning \"use tab as template\",
i.e. the tab is created using data from TAB.  This is
necessary when switching tabs, otherwise the destination tab
inherits the current tab's `explicit-name' parameter."
  (let* ((tab-explicit-name (alist-get 'explicit-name tab))
         (tab-group (if tab
                        (alist-get 'group tab)
                      (pcase tab-bar-new-tab-group
                        ((pred stringp) tab-bar-new-tab-group)
                        ((pred functionp) (funcall tab-bar-new-tab-group))))))
    `(current-tab
      (name . ,(if tab-explicit-name
                   (alist-get 'name tab)
                 (funcall tab-bar-tab-name-function)))
      (explicit-name . ,tab-explicit-name)
      ,@(if tab-group `((group . ,tab-group)))
      ;; Copy other possible parameters
      ,@(mapcan (lambda (param)
                  (unless (memq (car param)
                                '(name explicit-name group time
                                  ws wc wc-point wc-bl wc-bbl
                                  wc-history-back wc-history-forward))
                    (list param)))
                (cdr tab)))))