From a frame first-frame containing two Emacs windows, win-one displaying buffer buf-one and win-two displaying buf-two, I'd like to be able to 'break' win-two off into its own frame, perhaps using a modifier-click on the modeline. After this,

  • both win-one and win-two would retain their individual height/width and buffer associations they had when in first-frame
  • win-one would stay in the same first-frame, and win-two would now be in a new, separate second-frame
  • original position, color and font settings would be retained where possible

I was wondering if this behavior was available somewhere in the standard library, if there was an extension for it, or perhaps if a small elisp function would work?


Yes, there is such a command: mouse-tear-off-window. I bind it to C-mouse-1 on the mode line:

(global-set-key [mode-line C-mouse-1] 'mouse-tear-off-window)

The command is available in vanilla Emacs (emacs -Q). But I use my own version of it, which does not delete the window if it is alone in its frame. Instead, it clones the frame and window. That version is in library mouse+.el. Doc string:

| mouse-tear-off-window is an interactive compiled Lisp function in
| `mouse+.el'.
| It is bound to mode-line C-mouse-1.
| (mouse-tear-off-window EVENT)
| Create a new frame displaying buffer of window clicked on.
| If window is not the only one in frame, then delete it.
| Otherwise, this command effectively clones the frame and window.
  • This is close enough to my request that I think I can extend it to preserve other frame properties. – user38983 Nov 14 '13 at 4:12

This is a default binding:

C-x 5 C-o : display-buffer-other-frame

Which does: Display buffer BUFFER in another frame.


You can use:

M-x new-frame

I've bound it to F9, for example:

(global-set-key (kbd "<f9>") 'new-frame)
  • That leaves the buffer that is in the new frame also in the old frame. – Drew Nov 12 '13 at 4:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.