I'd like to make Emacs not just bury a buffer but kill it too when I press q
in a *Completions*/*Help*/etc
buffer. I can't get the substitute-key-definition function to work. I'm running Emacs24 on OSX.
Here's what I have:
(substitute-key-definition
'quit-window '(lambda () (interactive) (quit-window "KILL")) global-map)
Best Answer
The other answer actually gives slightly incompatible behavior. Consider a situation where you already have a frame split into two windows, then you open a help buffer and quit it.
quit-window
is smart enough to know that it shouldn't kill the window, just the buffer. It actually even has a few more clever tricks up its sleeve so our best bet is to work with it and just tweak it a bit. Here's a simple way of achieving what you want: