Function: display-buffer-in-new-tab
display-buffer-in-new-tab is a byte-compiled function defined in
tab-bar.el.gz.
Signature
(display-buffer-in-new-tab BUFFER ALIST)
Documentation
Display BUFFER in a new tab using display actions in ALIST.
ALIST is an association list of action symbols and values. See Info node (elisp) Buffer Display Action Alists for details of such alists.
Like display-buffer-in-tab, but always creates a new tab unconditionally,
without checking if a suitable tab already exists.
If ALIST contains a tab-name entry, it creates a new tab with that name
and displays BUFFER in a new tab. The tab-name entry can be a function,
in which case it is called with two arguments: BUFFER and ALIST, and should
return the tab name. When a tab-name entry is omitted, create a new tab
without an explicit name.
The ALIST entry tab-group (string or function) defines the tab group.
This is an action function for buffer display, see Info
node (elisp) Buffer Display Action Functions. It should be
called only by display-buffer or a function directly or
indirectly called by the latter.
Source Code
;; Defined in /usr/src/emacs/lisp/tab-bar.el.gz
(defun display-buffer-in-new-tab (buffer alist)
"Display BUFFER in a new tab using display actions in ALIST.
ALIST is an association list of action symbols and values. See
Info node `(elisp) Buffer Display Action Alists' for details of
such alists.
Like `display-buffer-in-tab', but always creates a new tab unconditionally,
without checking if a suitable tab already exists.
If ALIST contains a `tab-name' entry, it creates a new tab with that name
and displays BUFFER in a new tab. The `tab-name' entry can be a function,
in which case it is called with two arguments: BUFFER and ALIST, and should
return the tab name. When a `tab-name' entry is omitted, create a new tab
without an explicit name.
The ALIST entry `tab-group' (string or function) defines the tab group.
This is an action function for buffer display, see Info
node `(elisp) Buffer Display Action Functions'. It should be
called only by `display-buffer' or a function directly or
indirectly called by the latter."
(let ((tab-bar-new-tab-choice t))
(tab-bar-new-tab)
(let ((tab-name (alist-get 'tab-name alist)))
(when (functionp tab-name)
(setq tab-name (funcall tab-name buffer alist)))
(when tab-name
(tab-bar-rename-tab tab-name)))
(let ((tab-group (alist-get 'tab-group alist)))
(when (functionp tab-group)
(setq tab-group (funcall tab-group buffer alist)))
(when tab-group
(tab-bar-change-tab-group tab-group)))
(window--display-buffer buffer (selected-window) 'tab alist)))