Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

3 Answers 3

up vote 1 down vote accepted

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.
`----
share|improve this answer
    
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.

share|improve this answer

You can use:

M-x new-frame

I've bound it to F9, for example:

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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