@item C-x 5 c
@kindex C-x 5 c
@findex clone-frame
-Create a new frame using the parameters of the current frame
-(@code{clone-frame}).
+Create a new frame using the window configuration and frame parameters
+of the current frame (@code{clone-frame}).
@item C-x 5 b @var{bufname} @key{RET}
Select buffer @var{bufname} in another frame. This runs
+++
*** New command 'clone-frame' (bound to 'C-x 5 c').
-This is like 'C-x 5 2', but uses the frame parameters of the current
-frame instead of 'default-frame-alist'.
+This is like 'C-x 5 2', but uses the window configuration and frame
+parameters of the current frame instead of 'default-frame-alist'.
---
*** Default values of 'frame-title-format' and 'icon-title-format' have changed.
(make-frame)
(select-frame (make-frame))))
-(defun clone-frame (&optional frame use-default-parameters)
- "Make a new frame with the same parameters as FRAME.
-With a prefix arg (USE-DEFAULT-PARAMETERS), use
-`default-frame-alist' instead.
+(defun clone-frame (&optional frame no-windows)
+ "Make a new frame with the same parameters and windows as FRAME.
+With a prefix arg NO-WINDOWS, don't clone the window configuration.
FRAME defaults to the selected frame. The frame is created on the
same terminal as FRAME. If the terminal is a text-only terminal then
also select the new frame."
- (interactive "i\nP")
- (if use-default-parameters
- (make-frame-command)
- (let* ((default-frame-alist (seq-filter
- (lambda (elem)
- (not (eq (car elem) 'name)))
- (frame-parameters frame)))
- (new-frame (make-frame)))
- (unless (display-graphic-p)
- (select-frame new-frame))
- new-frame)))
+ (interactive (list (selected-frame) current-prefix-arg))
+ (let* ((frame (or frame (selected-frame)))
+ (windows (unless no-windows
+ (window-state-get (frame-root-window frame))))
+ (default-frame-alist
+ (seq-remove (lambda (elem) (eq (car elem) 'name))
+ (frame-parameters frame)))
+ (new-frame (make-frame)))
+ (when windows
+ (window-state-put windows (frame-root-window new-frame) 'safe))
+ (unless (display-graphic-p)
+ (select-frame new-frame))
+ new-frame))
(defvar before-make-frame-hook nil
"Functions to run before `make-frame' creates a new frame.")
`(menu-item "Detach" (lambda () (interactive)
(tab-bar-detach-tab
,tab-number))
- :help "Detach the tab to new frame"))
+ :help "Move the tab to new frame"))
(define-key-after menu [close]
`(menu-item "Close" (lambda () (interactive)
(tab-bar-close-tab ,tab-number))
(force-mode-line-update t))))
(defun tab-bar-detach-tab (&optional from-number)
- "Detach tab number FROM-NUMBER to a new frame.
-Interactively or without argument, detach current tab."
+ "Move tab number FROM-NUMBER to a new frame.
+Interactively or without argument, move the current tab."
(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)))))