Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

couple windows/buffers together in emacs?

Tags:

emacs

elisp

I often have multiple processes running (R, Python, eshell/shell), and for each I often have an associated script from which I send snippets. For this purpose I usually split each frame into two windows vertically so that my script file (e.g., .py) is in the top window and the REPL or interactive program is in the lower window (e.g., Python). Is there a simple way to link the two such that switching and closing buffers will operate on the two buffers together? I do have winner-mode and elscreen - but after switching buffers in one window, I try to use it to return to a previous state in which I had the original script-process buffers together in the same frame and split into windows, and I often get a mixing of buffers so that the "correct" script buffer does not appear together with its process buffer in the two windows. Sorry if this is a bit confusing but perhaps one solution is to make C-x b (iswitch buffers or ido-switch buffers) aware of the other buffer running in the frame (but different window)? Any help appreciated. Thanks -

like image 487
hatmatrix Avatar asked Feb 22 '10 08:02

hatmatrix


People also ask

Can you have more than one buffer in Emacs?

When Emacs has multiple windows, each window has a chosen buffer which is displayed there, but at any time only one of the windows is selected and its chosen buffer is the selected buffer. Each window's mode line displays the name of the buffer that the window is displaying (see section Multiple Windows).

How many buffers can be open in Emacs at a time?

The number of buffers you can have really has no limit. Most of the time, only one or two buffers are displayed, but even if you can't see them, all the buffers you create in an Emacs session are still active. You can think of them as a stack of pages, with the one being displayed as the top page.

How many buffers can you have in Emacs?

This is because Emacs tracks buffer positions using that data type. For typical 64-bit machines, this maximum buffer size is 2^{61} - 2 bytes, or about 2 EiB. For typical 32-bit machines, the maximum is usually 2^{29} - 2 bytes, or about 512 MiB.

Can you only have one buffer open in Emacs at a time?

Each Emacs window displays one Emacs buffer at any time. A single buffer may appear in more than one window; if it does, any changes in its text are displayed in all the windows where it appears.


1 Answers

You could store the window configuration in a register (C-x r w <key>, e.g. C-x r w w), one for each window configuration, and then instead of switching buffers, just jump to the window configuration you have stored (C-x r j <key>, e.g. C-x r j w).

So for example, when you have the windows laid out for R like you like them, hit C-x r w r. Then when you want to switch back to R, just hit C-x r j r.

like image 138
Eric Warmenhoven Avatar answered Nov 15 '22 03:11

Eric Warmenhoven