1

Sometimes I have multiple open frames (not only windows) in Spacemacs, and would like to collapse all frames into one single frame. That's easier to keep track on open buffers.

However, I cant' find a way to collapse all frames into one. I'm aware that I can kill open frames, but that's not what I want.

  1. Question:

How can I collapse all open frames into one single frame in Spacemacs (or Emacs)?


EDIT: To clarify, what I want, please consider the following images.

What I have:

enter image description here

Multiple Windows appear in multiple frames.

What I WANT:

enter image description here

I would like to collect all windows within one frame. That is, whereas before the $n$ windows were spread across $k$ frames, now I want to have the $n$ windows within one frame.

Of course, I could delete all other frames, and then reopen the windows in my main, single, remaining frame. But I do not reopen all the windows again. Rather, I'm looking for a key binding that changes from "what I have" to "what I want"


(2nd question deleted as asked by Editor)

9
  • Please do not x-post: stackoverflow.com/q/58833125/2708138
    – Tobias
    Nov 14, 2019 at 14:24
  • 1
    Please clarify what you mean by "collapse" and how that's different from what delete-other-frames (bound to C-x 5 1 by default) does.
    – Stefan
    Nov 14, 2019 at 14:41
  • @Stefan The OP does not mention delete-other-frames in his question and delete-other-frames is not in the file-menu by default. So I assume that the OP just not knew about delete-other-frames and I informed him for that reason in my answer about it.
    – Tobias
    Nov 14, 2019 at 16:05
  • The question is unclear, and so risks being deleted. Please specify what you mean by "collapsing" multiple frames into one frame.
    – Drew
    Nov 14, 2019 at 20:39
  • Also, regarding the last pargraph: plase make it a separate question. @Tobias indeed it's not clear whether he knows about delete-other-frames (his mention of "I can kill other frames" suggests that maybe he does), that's part of the problem.
    – Stefan
    Nov 14, 2019 at 23:08

1 Answer 1

2

The newish tab-bar-mode might help here.

If the desire is to consolidate the window or even multiple windows that may be open in a second frame into the first frame, but with’s n-number of window splits, @Tobias ‘s comment above about the dangers of the frame being too cluttered are valid, and you’d need some separate logic to determine how to lay the windows out.

Using the tab-bar (available from Emacs 27 on) seems simpler and helps here as it retains the window layouts of the multiple frames, but allows you to bring them together into just one frame. Each tab in tab-bar-mode is a frame-like object and can have multiple windows in it.

If you:

  • enable tab-bar with M-x tab-bar-mode turning on tabs in all the frames.
  • switch to the “other” frame (the one you no longer want) C-x 5 o if you weren’t there already
  • the windows in the second frame should now be part of a tab and can be moved to the first frame with M-x tab-bar-move-tab-to-frame

If you have more than two frames, it may ask which you want to move the tab to, but if you only had two frames, as in the OP question, the first is automatically chosen as the destination and the second frame will be gone.

The remaining frame will have two tabs in the tab-bar, one containing its original windows and the other containing the windows from the former frame.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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