From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Juanma Barranquero" Newsgroups: gmane.emacs.bugs Subject: Re: other-window: say there is none if none Date: Mon, 13 Nov 2006 18:19:13 +0100 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1163438413 22994 80.91.229.2 (13 Nov 2006 17:20:13 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 13 Nov 2006 17:20:13 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Nov 13 18:20:09 2006 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GjfT9-0000q5-Uu for geb-bug-gnu-emacs@m.gmane.org; Mon, 13 Nov 2006 18:19:42 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GjfT9-0001rP-67 for geb-bug-gnu-emacs@m.gmane.org; Mon, 13 Nov 2006 12:19:39 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GjfSn-0001Oj-2W for bug-gnu-emacs@gnu.org; Mon, 13 Nov 2006 12:19:17 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GjfSl-0001MO-EM for bug-gnu-emacs@gnu.org; Mon, 13 Nov 2006 12:19:16 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GjfSl-0001M9-3t for bug-gnu-emacs@gnu.org; Mon, 13 Nov 2006 12:19:15 -0500 Original-Received: from [64.233.162.196] (helo=nz-out-0102.google.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GjfSl-0004mn-1D for bug-gnu-emacs@gnu.org; Mon, 13 Nov 2006 12:19:15 -0500 Original-Received: by nz-out-0102.google.com with SMTP id r28so787132nza for ; Mon, 13 Nov 2006 09:19:14 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=ep7zqw+yX0uLRxKfiYOywTlKFj2VPgZvvioc1zH5SAG6jOti5+vDbJ6+qkVX8XjQlf3rmkjS8z43uVxw6pXPKPZ+xcOdtjDB2Gy2GgPxwN22REPhzXNjFxShtpCag/vpO9q1SrW7cD352n8ft3loHihLLPztiye9JJF9b8juvhw= Original-Received: by 10.35.70.2 with SMTP id x2mr11463525pyk.1163438354030; Mon, 13 Nov 2006 09:19:14 -0800 (PST) Original-Received: by 10.35.95.18 with HTTP; Mon, 13 Nov 2006 09:19:13 -0800 (PST) Original-To: "Kevin Rodgers" In-Reply-To: Content-Disposition: inline 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:15416 Archived-At: On 11/13/06, Kevin Rodgers wrote: > (defadvice other-window (before one-window-p activate) > "When called interactively, signal an error if there are no other > windows." > (when (and (interactive-p) (one-window-p)) > (error "No other windows"))) All in all, perhaps something like the following attached patch (based in your code) would be useful. /L/e/k/t/u Index: lisp/frame.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/frame.el,v retrieving revision 1.241 diff -u -2 -r1.241 frame.el --- lisp/frame.el 23 Sep 2006 09:16:40 -0000 1.241 +++ lisp/frame.el 13 Nov 2006 16:33:56 -0000 @@ -728,5 +728,7 @@ (setq frame (previous-frame frame))) (setq arg (1+ arg))) - (select-frame-set-input-focus frame))) + (if (eq frame (next-frame frame)) + (error "No other frames") + (select-frame-set-input-focus frame)))) (defun iconify-or-deiconify-frame () Index: src/window.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/window.c,v retrieving revision 1.564 diff -u -2 -r1.564 window.c --- src/window.c 28 Oct 2006 22:03:51 -0000 1.564 +++ src/window.c 13 Nov 2006 17:12:57 -0000 @@ -1981,8 +1981,9 @@ { Lisp_Object window; + Lisp_Object old; int i; CHECK_NUMBER (arg); - window = selected_window; + old = window = selected_window; for (i = XINT (arg); i > 0; --i) @@ -1991,5 +1992,9 @@ window = Fprevious_window (window, Qnil, all_frames); - Fselect_window (window, Qnil); + if (!EQ (window, old)) + Fselect_window (window, Qnil); + else if (Finteractive_p () && EQ (window, Fnext_window (window, Qnil, Qnil))) + error ("No other windows"); + return Qnil; }