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 it quit the wrong buffer? Date: Mon, 27 Oct 2008 11:31:47 +0100 Message-ID: <49059893.3020006@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=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1225104928 10951 80.91.229.12 (27 Oct 2008 10:55:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 27 Oct 2008 10:55:28 +0000 (UTC) Cc: 1259@emacsbugs.donarmstrong.com To: David Reitter Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Oct 27 11:56:28 2008 connect(): Connection refused 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 1KuPlr-0007KL-1G for geb-bug-gnu-emacs@m.gmane.org; Mon, 27 Oct 2008 11:56:27 +0100 Original-Received: from localhost ([127.0.0.1]:59142 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KuPkk-0005dc-VV for geb-bug-gnu-emacs@m.gmane.org; Mon, 27 Oct 2008 06:55:19 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KuPfn-0003sh-0P for bug-gnu-emacs@gnu.org; Mon, 27 Oct 2008 06:50:11 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KuPfj-0003pY-BR for bug-gnu-emacs@gnu.org; Mon, 27 Oct 2008 06:50:09 -0400 Original-Received: from [199.232.76.173] (port=45198 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KuPfi-0003p0-QN for bug-gnu-emacs@gnu.org; Mon, 27 Oct 2008 06:50:06 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:55391) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KuPfi-0007qv-MM for bug-gnu-emacs@gnu.org; Mon, 27 Oct 2008 06:50:06 -0400 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 m9RAo2fQ000827; Mon, 27 Oct 2008 03:50:03 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id m9RAe33A030960; Mon, 27 Oct 2008 03:40:03 -0700 X-Loop: don@donarmstrong.com Resent-From: martin rudalics Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Mon, 27 Oct 2008 10:40: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.122510362029734 (code B ref 1259); Mon, 27 Oct 2008 10:40:03 +0000 Original-Received: (at 1259) by emacsbugs.donarmstrong.com; 27 Oct 2008 10:33:40 +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 m9RAXacc029727 for <1259@emacsbugs.donarmstrong.com>; Mon, 27 Oct 2008 03:33:37 -0700 Original-Received: (qmail invoked by alias); 27 Oct 2008 10:33:29 -0000 Original-Received: from 62-47-42-130.adsl.highway.telekom.at (EHLO [62.47.42.130]) [62.47.42.130] by mail.gmx.net (mp048) with SMTP; 27 Oct 2008 11:33:29 +0100 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX1/l/UJZ7CvlleXgQHCUSuzw+qL+EgXzJVXn5+yxeI WIkrc/1sfY1bUD User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) In-Reply-To: X-Y-GMX-Trusted: 0 X-FuHaFi: 0.64 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Mon, 27 Oct 2008 06:50:09 -0400 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:21939 Archived-At: > I'm wondering if there is a discrepancy between the doc string of > quit-window and its implementation: The function is supposed to quit > the current buffer, but what it seems to do is to quit the buffer in the > selected window. You're right. The doc-string is wrong in other respects as well. Does the form below fit your needs? martin (defun quit-window (&optional kill window) "Bury or kill (with KILL non-nil) the buffer displayed in WINDOW. KILL defaults to nil, WINDOW to the selected window. If WINDOW is dedicated and the only window on its frame, delete its frame provided there are other frames left." (interactive) (let* ((window (or window (selected-window))) (buffer (window-buffer window)) (frame (window-frame window)) window-solitary window-handled) (with-selected-window window (setq window-solitary (one-window-p t)) (unless (or (window-minibuffer-p) (window-dedicated-p)) (switch-to-buffer (other-buffer)))) ;; Get rid of the frame, if it has just one dedicated window ;; and other visible frames exist. (when (and (or (window-minibuffer-p window) (window-dedicated-p window)) window-solitary (frame-visible-p frame)) (unless (and (eq default-minibuffer-frame frame) (= 1 (length (minibuffer-frame-list)))) (delete-frame frame)) (setq window-handled t)) ;; Deal with the buffer. (if kill (kill-buffer buffer) (bury-buffer buffer)) ;; Maybe get rid of the window. (when (and (not window-handled) (not window-solitary)) (delete-window window))))