From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: quit-window Date: Mon, 24 Oct 2011 08:12:45 +0300 Organization: JURTA Message-ID: <87mxcrjbre.fsf@mail.jurta.org> References: <86mxcsvjsk.fsf@googlemail.com> <4EA3DC67.8050607@gmx.at> <87obx77tms.fsf@mail.jurta.org> <4EA463EC.8030707@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1319433869 31745 80.91.229.12 (24 Oct 2011 05:24:29 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 24 Oct 2011 05:24:29 +0000 (UTC) Cc: Christoph Scholtes , emacs-devel@gnu.org To: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 24 07:24:24 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RID1K-0004ri-Ri for ged-emacs-devel@m.gmane.org; Mon, 24 Oct 2011 07:24:22 +0200 Original-Received: from localhost ([::1]:37387 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RID1K-0006Og-BV for ged-emacs-devel@m.gmane.org; Mon, 24 Oct 2011 01:24:22 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:50724) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RID1C-00062R-3R for emacs-devel@gnu.org; Mon, 24 Oct 2011 01:24:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RID1A-00017U-Eq for emacs-devel@gnu.org; Mon, 24 Oct 2011 01:24:13 -0400 Original-Received: from smarty.dreamhost.com ([208.113.175.8]:51169) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RID19-000179-Ph for emacs-devel@gnu.org; Mon, 24 Oct 2011 01:24:12 -0400 Original-Received: from ps18281.dreamhostps.com (ps18281.dreamhost.com [69.163.218.105]) by smarty.dreamhost.com (Postfix) with ESMTP id 43CF96E8088; Sun, 23 Oct 2011 22:24:11 -0700 (PDT) Original-Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 9E61B451C375; Sun, 23 Oct 2011 22:24:09 -0700 (PDT) In-Reply-To: <4EA463EC.8030707@gmx.at> (martin rudalics's message of "Sun, 23 Oct 2011 20:58:52 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.90 (x86_64-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.113.175.8 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:145456 Archived-At: >> (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.