tags:

views:

119

answers:

3

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?

A: 

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.

Kizaru
I just noticed that it pops up with a message saying 'press q to restore this window'. Going to see if that works for this editing session.
MDCore
I have a vague recollection that the default customisations in Aquamacs cause help to open in a new frame instead of a window in the current frame. If so, you could probably just look to see how they do it and copy their code.
Porculus
I'd prefer a solution where help/backtrace etc doesn't mess with my buffers at all. At the moment a popup window would be preferable!
MDCore
+1  A: 

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.

Jérôme Radix
Well I've got the window split up into four quadrants, showing the files I want to be looking at. Removing windows is going to mess up that arrangement, which is the problem I'm having in the first place.
MDCore
There are lots of ways to store windows arrangements. I update my answer to a link to emacswiki.org on the subject.
Jérôme Radix
I don't need to store or restore an arrangement, I would rather that emacs didn't mess with what I had. I want the program to do what I want not the other way around.
MDCore
+3  A: 

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.

huaiyuan
Beautiful. I just need to rebind "delete-frame" to something more handy than C-x 5 0 now and I'll be all set. I can't upvote this question and this answer enough!
Pascal Cuoq
By the way, it works fine with "*compilation*" too.
Pascal Cuoq
You, sir, are a genius.
MDCore