;; Inspired from `mouse-tear-off-window'.
(defun tear-off-window ()
"Create a new frame displaying buffer of selected window.
If window is not the only one in frame, then delete it.
Otherwise, this command effectively clones the frame and window."
(interactive)
(let ((owin (selected-window))
(buf (window-buffer))
(fr (make-frame)))
(select-frame fr)
(switch-to-buffer buf)
(save-window-excursion
(select-window owin)
(unless (one-window-p) (delete-window owin)))))
선택한 윈도우가 프레임에 단독으로있는 경우 아무 것도 수행하지 않는이 명령과 다음 명령은 library에서 사용할 수 있습니다 frame-cmds.el
.
(defun tear-off-window-if-not-alone ()
"Move selected window to a new frame, unless it is alone in its frame.
If it is alone, do nothing. Otherwise, delete it and create a new
frame showing the same buffer."
(interactive)
(if (one-window-p 'NOMINI)
(message "Sole window in frame")
(tear-off-window)))