Function: merge-frames
merge-frames is an autoloaded, interactive and byte-compiled function
defined in window-x.el.gz.
Signature
(merge-frames &optional FRAME1 FRAME2 VERTICAL)
Documentation
Merge the main window of FRAME2 into FRAME1.
Split the main window of FRAME1 and make the new window display the main window of FRAME2. Both FRAME1 and FRAME2 must be live frames. If VERTICAL is non-nil, make the new window below the old main window of FRAME1. Otherwise, make the new window on the right of FRAME1's main window. Interactively, VERTICAL is the prefix argument, FRAME1 is the selected frame and FRAME2 is the frame following FRAME1 in the frame list. Delete FRAME2 if the merge completed successfully and return FRAME1.
Probably introduced at or before Emacs version 31.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/window-x.el.gz
;;;###autoload
(defun merge-frames (&optional frame1 frame2 vertical)
"Merge the main window of FRAME2 into FRAME1.
Split the main window of FRAME1 and make the new window display the main
window of FRAME2. Both FRAME1 and FRAME2 must be live frames. If
VERTICAL is non-nil, make the new window below the old main window of
FRAME1. Otherwise, make the new window on the right of FRAME1's main
window. Interactively, VERTICAL is the prefix argument, FRAME1 is the
selected frame and FRAME2 is the frame following FRAME1 in the frame
list. Delete FRAME2 if the merge completed successfully and return
FRAME1."
(interactive "i\ni\nP")
(let* ((frame1 (window-normalize-frame frame1))
(frame2 (or (if frame2
(window-normalize-frame frame2)
(next-frame frame1))
(user-error "Cannot find frame to merge"))))
(window-state-put
;; Source window on frame2.
(window-state-get (window-main-window frame2))
;; Make new window on frame1.
(split-window (window-main-window frame1) nil (not vertical)))
(delete-frame frame2)
frame1))