From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: Should delete-window switch to next buffer when there is only one window? Date: Tue, 14 Jan 2014 15:57:45 -0800 (PST) Message-ID: References: <20140114223057.GA27881@doriath.local> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1389743891 425 80.91.229.3 (14 Jan 2014 23:58:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 14 Jan 2014 23:58:11 +0000 (UTC) To: =?iso-8859-1?B?RXJuZXN0IEFkcm9ndek=?= , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jan 15 00:58:17 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W3Ds8-0006t5-S9 for geh-help-gnu-emacs@m.gmane.org; Wed, 15 Jan 2014 00:58:16 +0100 Original-Received: from localhost ([::1]:51279 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W3Ds8-0004NM-El for geh-help-gnu-emacs@m.gmane.org; Tue, 14 Jan 2014 18:58:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59668) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W3Drq-0004N9-MI for help-gnu-emacs@gnu.org; Tue, 14 Jan 2014 18:58:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W3Dri-00006S-2J for help-gnu-emacs@gnu.org; Tue, 14 Jan 2014 18:57:58 -0500 Original-Received: from userp1040.oracle.com ([156.151.31.81]:50081) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W3Drh-00006F-RA for help-gnu-emacs@gnu.org; Tue, 14 Jan 2014 18:57:49 -0500 Original-Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s0ENvkDa028700 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 14 Jan 2014 23:57:47 GMT Original-Received: from aserz7022.oracle.com (aserz7022.oracle.com [141.146.126.231]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s0ENvjcK029219 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 14 Jan 2014 23:57:46 GMT Original-Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s0ENvjjv012701; Tue, 14 Jan 2014 23:57:45 GMT In-Reply-To: <20140114223057.GA27881@doriath.local> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8 (707110) [OL 12.0.6680.5000 (x86)] X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 156.151.31.81 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:95403 Archived-At: > Currently if you attempt to delete an only window, the following > message shows up: "Attempt to delete minibuffer or sole ordinary > window" >=20 > I think that perhaps it would be better if it switched buffers > instead. What do you think? No. A user who hits `C-x 0' is asking to delete the window. S?he is not asking to switch to another buffer or buy a beer. These are very different actions, with different purposes. Sure, you could combine them, but they don't seem like a useful combination to me. You either want to switch to a different buffer or you do not. If you do, then you want to do that in any case, not just when the window is alone in its frame. A user who wants to delete the selected window wants to do just that. So the error message is appropriate, to let the user know that it is the sole window in its frame. Now you might indeed look for something much closer to deleting the window, when it is alone in its frame. If you want to get rid of it in that case too, it's likely that you really want to get rid of the frame altogether, including its window. That is likely to be the case if you, like me, use lots of frames, including for things like pop-up windows that you do want to just remove. Whereas it does not make sense to try to remove the only window shown in a frame (hence the error message), it does make sense to remove a frame. For that, library `frame-cmds.el' (note the name - it is especially for people who like to use frames) redefines command `delete-window' to invoke `delete-frame' when the window is the only one in its frame. (Yes, this behavior is maybe not for everyone. Using the library is of course optional. But IMO, this is the behavior that `delete-window' should have, which is why I redefined it instead of just remapping its keys for interactive use.) And I in fact suggest that users of `frame-cmds.el' remap any keys bound to `delete-window' to command `delete-windows-for' instead (also defined in `frame-cmds.el'). That command is just like the redefined `delete-window', except that with a prefix arg it deletes all windows showing the buffer (anywhere).