bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: other-window: say there is none if none


From: Juanma Barranquero
Subject: Re: other-window: say there is none if none
Date: Mon, 13 Nov 2006 18:19:13 +0100

On 11/13/06, Kevin Rodgers <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]