From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: delete-window when alone in frame deletes frame too Date: Wed, 16 Jun 2004 10:25:54 -0700 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1087407993 26281 80.91.224.253 (16 Jun 2004 17:46:33 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 16 Jun 2004 17:46:33 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Wed Jun 16 19:46:26 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BaeUU-0002Re-00 for ; Wed, 16 Jun 2004 19:46:26 +0200 Original-Received: from lists.gnu.org ([199.232.76.165]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BaeUU-0005zQ-00 for ; Wed, 16 Jun 2004 19:46:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BaeVU-0007pQ-FA for emacs-devel@quimby.gnus.org; Wed, 16 Jun 2004 13:47:28 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BaeVP-0007mc-7M for emacs-devel@gnu.org; Wed, 16 Jun 2004 13:47:23 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BaeVN-0007lm-JZ for emacs-devel@gnu.org; Wed, 16 Jun 2004 13:47:22 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BaeVN-0007lb-F7 for emacs-devel@gnu.org; Wed, 16 Jun 2004 13:47:21 -0400 Original-Received: from [199.232.41.8] (helo=mx20.gnu.org) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1BaeUK-00019b-KH for emacs-devel@gnu.org; Wed, 16 Jun 2004 13:46:16 -0400 Original-Received: from [141.146.126.230] (helo=agminet03.oracle.com) by mx20.gnu.org with esmtp (Exim 4.34) id 1BaeOb-0003WC-Sm for emacs-devel@gnu.org; Wed, 16 Jun 2004 13:40:26 -0400 Original-Received: from rgmgw3.us.oracle.com (rgmgw3.us.oracle.com [138.1.191.12]) by agminet03.oracle.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id i5GHPtHM021373 for ; Wed, 16 Jun 2004 10:29:54 -0700 Original-Received: from rgmgw3.us.oracle.com (localhost [127.0.0.1]) by rgmgw3.us.oracle.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id i5GHPu5r018539 for ; Wed, 16 Jun 2004 11:25:56 -0600 Original-Received: from dradamslap (dradams-lap.us.oracle.com [130.35.177.126]) by rgmgw3.us.oracle.com (Switch-3.1.4/Switch-3.1.0) with SMTP id i5GHPt5a018525 for ; Wed, 16 Jun 2004 11:25:55 -0600 Original-To: "Emacs-Devel" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 Importance: Normal X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:25043 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:25043 I use frames instead of windows, by default, so the frames are nearly always one-window-p. I use the following redefinition of delete-window. I wonder if this functionality wouldn't make sense for Emacs, in general. It lets you use C-x 0 to delete both windows and (one-window) frames. Obviously, if such a change is made, it should be made in the C code, instead of this way. (or (fboundp 'old-delete-window) (fset 'old-delete-window (symbol-function 'delete-window))) (defun delete-window (&optional window) "Remove WINDOW from the display. Default is `selected-window'. If WINDOW is the only one in its frame, then `delete-frame' too." (interactive) (setq window (or window (selected-window))) (select-window window) (if (one-window-p) (delete-frame) (old-delete-window (selected-window)))) Note: If the frame is a minibuffer-only frame or the sole frame, an error is thrown anyway, which is adequate protection.