From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#1259: quit-window does not kill the window Date: Fri, 14 Nov 2008 09:06:36 +0100 Message-ID: <491D318C.80402@gmx.at> References: Reply-To: martin rudalics , 1259@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1226651444 8068 80.91.229.12 (14 Nov 2008 08:30:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 14 Nov 2008 08:30:44 +0000 (UTC) Cc: 1259@emacsbugs.donarmstrong.com To: Juanma Barranquero Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Nov 14 09:31:45 2008 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1L0u5W-0005KZ-NE for geb-bug-gnu-emacs@m.gmane.org; Fri, 14 Nov 2008 09:31:34 +0100 Original-Received: from localhost ([127.0.0.1]:40746 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L0u4O-0002D6-9k for geb-bug-gnu-emacs@m.gmane.org; Fri, 14 Nov 2008 03:30:24 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L0u4K-0002C7-Kr for bug-gnu-emacs@gnu.org; Fri, 14 Nov 2008 03:30:20 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L0u4I-0002Bv-7S for bug-gnu-emacs@gnu.org; Fri, 14 Nov 2008 03:30:19 -0500 Original-Received: from [199.232.76.173] (port=52250 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L0u4I-0002Bs-1K for bug-gnu-emacs@gnu.org; Fri, 14 Nov 2008 03:30:18 -0500 Original-Received: from mx20.gnu.org ([199.232.41.8]:55938) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L0u4H-0002cA-TA for bug-gnu-emacs@gnu.org; Fri, 14 Nov 2008 03:30:18 -0500 Original-Received: from rzlab.ucr.edu ([138.23.92.77]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1L0u4G-0004Lq-Pr for bug-gnu-emacs@gnu.org; Fri, 14 Nov 2008 03:30:17 -0500 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id mAE8U72O017968; Fri, 14 Nov 2008 00:30:07 -0800 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id mAE8F3VB014047; Fri, 14 Nov 2008 00:15:03 -0800 X-Loop: don@donarmstrong.com Resent-From: martin rudalics Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Fri, 14 Nov 2008 08:15:03 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 1259 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 1259-submit@emacsbugs.donarmstrong.com id=B1259.122665014312755 (code B ref 1259); Fri, 14 Nov 2008 08:15:03 +0000 Original-Received: (at 1259) by emacsbugs.donarmstrong.com; 14 Nov 2008 08:09:03 +0000 Original-Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with SMTP id mAE88xRi012738 for <1259@emacsbugs.donarmstrong.com>; Fri, 14 Nov 2008 00:09:00 -0800 Original-Received: (qmail invoked by alias); 14 Nov 2008 08:08:52 -0000 Original-Received: from 62-47-54-118.adsl.highway.telekom.at (EHLO [62.47.54.118]) [62.47.54.118] by mail.gmx.net (mp035) with SMTP; 14 Nov 2008 09:08:52 +0100 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX18zdYZiA0AzPTZSevmSS8BIbaHNEdKaMun5RHJGA4 X6mSGzE7YOGN2h User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) In-Reply-To: X-Y-GMX-Trusted: 0 X-FuHaFi: 0.63 X-detected-kernel: by mx20.gnu.org: Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Resent-Date: Fri, 14 Nov 2008 03:30:19 -0500 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:22334 Archived-At: > But yes, it breaks one of my favorite uses. > > The docstring previously said: > > "If WINDOW is non-nil, it specifies a window; we delete that window, > and the buffer that is killed or buried is the one in that window." > > Now, it says: > > "If WINDOW > is dedicated or a minibuffer window, delete it and, if it's the > only window on its frame, delete its frame as well provided there > are other frames left. Otherwise, display some other buffer in > the window." > > I was using the previously documented behavior. I have a function > > (defun quit-buffer-and-window () > (interactive) > (quit-window nil (selected-window))) > > (I assign it to "q" in many modes). Now, > > C-x 2 C-x o M-x quit-buffer-and-window > > leaves me with two windows. Sorry. I apparently fail to understand what that function is supposed to do. Please try the version below and tell me whether it does what you want. If it still doesn't, then please try to write a doc-string so I can implement what that doc-string says. Thank you, martin. (defun quit-window (&optional kill window) "Delete WINDOW and bury its buffer. WINDOW defaults to the selected window. Optional argument KILL non-nil means kill WINDOW's buffer instead of burying it. Always delete WINDOW if its frame contains at least one other window. If WINDOW is dedicated or a minibuffer window, and is the only window on its frame, try to delete its frame too. In any other case, display another buffer in WINDOW." (interactive "P") (let* ((window (or window (selected-window))) (buffer (window-buffer window))) (if (eq window (frame-root-window (window-frame window))) ;; WINDOW is the only window on its frame. `delete-windows-on' ;; knows how to handle that particular case. (delete-windows-on buffer (selected-frame)) ;; There are other windows left, delete just this window. But ;; don't throw an error if that fails for some reason; rather ;; switch to another buffer instead. (condition-case nil (delete-window window) (error (with-selected-window window (switch-to-buffer nil))))) ;; Deal with the buffer. (if kill (kill-buffer buffer) (bury-buffer buffer))))