I'm trying to create a binding to kill windows (but not buffers) when they're being pressed by a middle mouse click in their header lines. (Just to note, all windows in my setup have header lines.)
So far I've had some limited success killing the active window which is being under focus via this binding:
(global-set-key
(kbd "<header-line> <mouse-2>")
'kill-buffer-and-window)
The two issues I'm having with my current binding:
- When trying to kill an inactive window, it kills the active window instead of the window that is actually being pressed. (by "active" I mean under focus with the caret pointer in it)
- It kills both the window and the buffer, how can I kill just the window but not the buffer? The only interactive function that I've found was
kill-buffer-and-window
.
delete-window
C-x 0
?