Function: tab-bar-detach-tab
tab-bar-detach-tab is an interactive and byte-compiled function
defined in tab-bar.el.gz.
Signature
(tab-bar-detach-tab &optional FROM-NUMBER)
Documentation
Move tab number FROM-NUMBER to a new frame.
FROM-NUMBER defaults to the current tab (which happens interactively).
Key Bindings
Aliases
Source Code
;; Defined in /usr/src/emacs/lisp/tab-bar.el.gz
(defun tab-bar-detach-tab (&optional from-number)
"Move tab number FROM-NUMBER to a new frame.
FROM-NUMBER defaults to the current tab (which happens interactively)."
(interactive (list (1+ (tab-bar--current-tab-index))))
(let* ((tabs (funcall tab-bar-tabs-function))
(tab-index (1- (or from-number (1+ (tab-bar--current-tab-index tabs)))))
(tab-name (alist-get 'name (nth tab-index tabs)))
;; On some window managers, `make-frame' selects the new frame,
;; so previously selected frame is saved to `from-frame'.
(from-frame (selected-frame))
(new-frame (make-frame `((name . ,tab-name)))))
(tab-bar-move-tab-to-frame nil from-frame from-number new-frame nil)
(with-selected-frame new-frame
(tab-bar-close-tab))))