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.
If ALIST contains a non-nil tab-name entry (string or function) then
display BUFFER in a new tab with this name. If tab-name is a function
it is called with two arguments (BUFFER and ALIST) and should return the
tab name. If tab-name is omitted or nil, create a new tab without an
explicit name.
If ALIST contains a non-nil tab-group entry (string or function), this
defines the tab group, overriding user option tab-bar-new-tab-group.
To check for a suitable existing tab to reuse before creating a new tab,
use display-buffer-in-tab instead.
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.
If ALIST contains a non-nil `tab-name' entry (string or function) then
display BUFFER in a new tab with this name. If `tab-name' is a function
it is called with two arguments (BUFFER and ALIST) and should return the
tab name. If `tab-name' is omitted or nil, create a new tab without an
explicit name.
If ALIST contains a non-nil `tab-group' entry (string or function), this
defines the tab group, overriding user option `tab-bar-new-tab-group'.
To check for a suitable existing tab to reuse before creating a new tab,
use `display-buffer-in-tab' instead.
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)))