unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Juanma Barranquero" <lekktu@gmail.com>
Cc: bug-gnu-emacs@gnu.org
Subject: Re: other-window: say there is none if none
Date: Mon, 13 Nov 2006 18:19:13 +0100	[thread overview]
Message-ID: <f7ccd24b0611130919h51f0b2eenca395c03d9c3add4@mail.gmail.com> (raw)
In-Reply-To: <eja490$tnr$1@sea.gmane.org>

On 11/13/06, Kevin Rodgers <ihs_4664@yahoo.com> 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;
 }

  reply	other threads:[~2006-11-13 17:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-10 19:22 other-window: say there is none if none Dan Jacobson
2006-11-13  0:39 ` Drew Adams
2006-11-13 15:50 ` Kevin Rodgers
2006-11-13 17:19   ` Juanma Barranquero [this message]
2006-11-14 12:26     ` Richard Stallman
2006-11-14 15:31       ` Juanma Barranquero
  -- strict thread matches above, loose matches on Subject: below --
2006-11-20 11:32 Dan Jacobson
2006-11-21 16:14 ` Kevin Rodgers
2006-11-21 16:24   ` Juanma Barranquero

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f7ccd24b0611130919h51f0b2eenca395c03d9c3add4@mail.gmail.com \
    --to=lekktu@gmail.com \
    --cc=bug-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).