Basically, I would like GUI emacs to replicate the terminal behavior, where a new frame is opened within the same (OS) window. This would work similar to vim's tabs, which are just a way to move around different window configurations within the same session.
1 Answer
In emacs, a frame is always a separate graphical window (and as you know, in emacs the frame is divided into windows, making the terminology somewhat confusing).
However, you can save window configurations to registers, and restore them later; see the "Configuration Registers" page of the emacs manual (M-: (info "(emacs)Configuration Registers")
).
There are a number of emacs packages which give you a tab bar, such as TabBarMode, but I'm not aware of any off-hand where the tab buttons switch window layouts, rather than which buffer is visible. Maybe you can find one, or you could modify one to do it.
Another option is to do this not in emacs, but in your window manager. i3, for instance, can stack windows into a tabbed container.
-
db48x: The question terminology is pretty much fine. When Emacs is run in a terminal, frames work as described in the question -- opening a new frame (
C-x 5 2
) 'replaces' the frame displayed in the terminal, as does switching between existing frames (C-x 5 o
). iDontKnowBetter is asking how to get the same experience in GUI Emacs.– philsCommented May 16, 2016 at 5:28 -
1I understand, but making a new frame while running in a window manager (as opposed to a terminal) always puts the frame in a new gui window. This isn't configurable, and if you hack
make-frame
so that it always callstty-create-frame-with-faces
then you get an error because you're not in a tty. This is implemented in C, and internally it calls the C functionmake_frame
. It's not exposed to elisp, but even if it were it intermingles all of the X and GTK operations needed to make a new gui window for the frame.– db48xCommented May 16, 2016 at 7:41 -
1Oh, and the brief discussion of terminology is not because of confusion on the part of anyone here; it's for the benefit of future readers. Howdy folks!– db48xCommented May 16, 2016 at 7:43
-
1Ah, I see :) I think the details of your first comment would make a very helpful edit to the body of your answer, as that addresses the question directly.– philsCommented May 16, 2016 at 9:01
elscreen
is the tabbar-looking minor-mode that switches window configurations. I had to do some tweaking to the source-code that I used a while back to get everything working just right, so I'll let someone else provide the best fork/link for it.