emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: quit-window


From: Juri Linkov
Subject: Re: quit-window
Date: Mon, 24 Oct 2011 08:12:45 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.90 (x86_64-pc-linux-gnu)

>>   (define-key dired-mode-map "q" 'quit-window-kill-buffer)
>>
>> Or even better to add a new customizable variable with a list of modes
>> where `q' kills the buffer, e.g. `quit-window-kill-buffer-modes'
>> that could be customized to add modes like `dired-mode'.
>
> Is there any reason why one should not use C-x k here?

Actually both are necessary: `quit-window-kill-buffer' and
`kill-this-buffer' (I consider it instead of `kill-buffer'
because it's easier to use in .emacs and it doesn't require
confirmation from the user to kill the current buffer).

There are use cases where one of them is more suitable:

`quit-window-kill-buffer' is useful when you need to return to the
initial window from which this buffer was displayed and also to delete
the window when the current buffer is last in its window history.

Sometimes this behavior is dangerous, e.g. when wanting to
kill all buffers visited in the selected window one by one,
I start typing a key bound to `quit-window-kill-buffer'
repeatedly, and sometimes it jumps to another window, and
not noticing this jump, the next keypress kills the wrong buffer.
`kill-this-buffer' doesn't jump to another window, so it's safer
to use it to kill all previously visited buffers in the selected window.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]