tags:

views:

136

answers:

5

This is probably a very naive Emacs question - I'm new to it.

When I'm evaluating a lisp expression, if there's an error the debugger automatically comes up in another window. If I have *scratch* and *info* open (the former for trying out lisp and the latter for reading about it), then the debugger opens up in the window that *info* was in. At the moment, I have to switch to that window, then change it back to *info*, before returning to *scratch*. (The same thing happens if I do C-x C-b for a list of buffers.) I'm guessing there has to be a way to just close that window without this long sequence of commands. Can anyone enlighten me?

+4  A: 

At least here on my emacs (22.3), when the debugger pops up, its window becomes the active one. There, pressing q just quits the debugger, if that's what you want. At that point, it also gets out of recursive editing.

Bahbar
Yep, that works! It doesn't solve the case of the persistent buffer list though, but maybe that's another question...
Skilldrick
+1  A: 

I'm usually using the delete-other-windows command. C-x 1.

It's so regullar, that I rebinded to F4.

Official docs: http://www.gnu.org/software/emacs/manual/html_node/emacs/Change-Window.htmla

HTH

Zsolt Botykai
A: 

One possible solution is to use a window management package. Store your "preferred" window arrangement, and after the debugger/buffer window pops up and you're done with it, revert to your preferred arrangement.

There are a bunch of packages to choose from, see: switching window configurations on the wiki.

Additionally, you might want to figure out the actions you commonly do that trigger the extra (unwanted) window popping up, and use that to trigger saving your window configuration just before the window pops up.

If you want to roll your own (it's pretty easy), you can just save off the window configuration, and restore it like so:

(setq the-window-configuration-i-want (current-window-configuration))
(global-set-key (kbd "<f7>") 
       (lambda () (interactive) 
            (set-window-configuration the-window-configuration-i-want)))

The trick is figuring out where to put the setting of the-window-configuration-i-want.

Trey Jackson
A: 

I think you're looking for C-x 4 C-o, which displays a buffer in the "other" window without switching to it.

As mentioned above, in the case of the backtrace buffer you probably want to exit from it with q, to get out of the recursive edit.

legoscia
+2  A: 

Using winner mode, you can use the keybinding C-C left arrow to return to the previous window configuration. Of course, this doesn't actually kill the new buffer, but it does hide it.

James Sulak