MDCore
MDCore

Reputation: 18145

How do I stop Emacs from changing my split buffers?

I have a number of splits open, looking at various buffers. But when I for example check the help on a function it will replace one of the splits with the help buffer. Once I'm done reading the help I have to go back to the correct buffer manually which is a pain. How do I get Emacs to be nicer to my buffers?

Update: Help will let you press q to go back to the previous buffer. But causing the Emacs backtrace to pop up also steals one of my buffer windows and it doesn't have a q.

Update: Backtrace DOES have q to go back. My original question still remains: how do I ask Emacs not to steal one of my splits?

Upvotes: 9

Views: 1296

Answers (4)

jrichter
jrichter

Reputation: 123

You could also use winner-mode. It came up on planet.emacsen.org a while back.

Winner Mode is a global minor mode. When activated, it allows to “undo” (and “redo”) changes in the window configuration with the key commands ‘C-c left’ and ‘C-c right’.

That way you can undo any changes to your splits immediately after they happen.

Upvotes: 3

huaiyuan
huaiyuan

Reputation: 26549

Adding the line

(push "*Help*" special-display-buffer-names)
to the init file should make subsequent invocations of the help buffer to appear in its own frame(what the desktop usually calls "window"), and leave the original frame with its configuration alone.

See Special Buffer Frames.

Upvotes: 6

Jérôme Radix
Jérôme Radix

Reputation: 10533

I hope this will help you :

  • C-x 0 to remove the current window

  • C-x 1 to keep only the current window

  • you can use windmove by adding the following line in your .emacs :

(windmove-default-keybindings)

Then, you can move the point between windows using S-right S-left S-up and S-down

There are lots of ways to store and restore emacs windows, see emacswiki.org on the subject.

Upvotes: 1

Kizaru
Kizaru

Reputation: 2513

What I do is just go to that changed buffer, C-x k it, and the current buffer in that window will be the previous buffer.

It may be possible to define advice for the help that saves the current window and buffer state and restores it with a simple keybind. But this is outside my basic elisp knowledge.

Upvotes: 0

Related Questions