changeset 6247:22d4037cbce2

(Fprevious_window, Fnext_window): ALL_FRAMES = visible means consider only visible frames. (window_loop): Likewise for FRAMES. (Fget_buffer_window, Fget_largest_window, Fget_lru_window): Doc fix. (Fdelete_windows_on): Doc fix.
author Richard M. Stallman <rms@gnu.org>
date Tue, 08 Mar 1994 06:20:18 +0000
parents 128dc040e121
children 0e4319197d29
files src/window.c
diffstat 1 files changed, 45 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/src/window.c	Tue Mar 08 06:18:49 1994 +0000
+++ b/src/window.c	Tue Mar 08 06:20:18 1994 +0000
@@ -1,6 +1,6 @@
 /* Window creation, deletion and examination for GNU Emacs.
    Does not include redisplay.
-   Copyright (C) 1985, 1986, 1987, 1993 Free Software Foundation, Inc.
+   Copyright (C) 1985, 1986, 1987, 1993, 1994 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -736,7 +736,8 @@
 
     if (EQ (window, pwindow))
       {
-	Lisp_Object alternative = Fnext_window (window, Qlambda, Qnil);
+	Lisp_Object alternative;
+	alternative = Fnext_window (window, Qlambda, Qnil);
 
 	/* If we're about to delete the selected window on the
 	   selected frame, then we should use Fselect_window to select
@@ -841,7 +842,8 @@
 \n\
 Optional third arg ALL-FRAMES t means include windows on all frames.\n\
 ALL-FRAMES nil or omitted means cycle within the frames as specified\n\
-above.  If neither nil nor t, restrict to WINDOW's frame.\n\
+above.  ALL-FRAMES = `visible' means include windows on all visible frames.\n\
+Anything else means restrict to WINDOW's frame.\n\
 \n\
 If you use consistent values for MINIBUF and ALL-FRAMES, you can use\n\
 `next-window' to iterate through the entire cycle of acceptable\n\
@@ -878,6 +880,8 @@
 		       (WINDOW_FRAME
 			(XWINDOW (window)))))
 		   : Qnil);
+  else if (EQ (all_frames, Qvisible))
+    ;
   else if (! EQ (all_frames, Qt))
     all_frames = Qnil;
   /* Now all_frames is t meaning search all frames,
@@ -954,7 +958,8 @@
 \n\
 Optional third arg ALL-FRAMES t means include windows on all frames.\n\
 ALL-FRAMES nil or omitted means cycle within the frames as specified\n\
-above.  If neither nil nor t, restrict to WINDOW's frame.\n\
+above.  ALL-FRAMES = `visible' means include windows on all visible frames.\n\
+Anything else means restrict to WINDOW's frame.\n\
 \n\
 If you use consistent values for MINIBUF and ALL-FRAMES, you can use\n\
 `previous-window' to iterate through the entire cycle of acceptable\n\
@@ -992,6 +997,8 @@
 		       (WINDOW_FRAME
 			(XWINDOW (window)))))
 		   : Qnil);
+  else if (EQ (all_frames, Qvisible))
+    ;
   else if (! EQ (all_frames, Qt))
     all_frames = Qnil;
   /* Now all_frames is t meaning search all frames,
@@ -1095,6 +1102,7 @@
    with argument OBJ.
    If FRAMES is Qt, look at all frames;
                 Qnil, look at just the selected frame;
+		Qvisible, look at visible frames;
 	        a frame, just look at windows on that frame.
    If MINI is non-zero, perform the operation on minibuffer windows too.
 */
@@ -1121,6 +1129,8 @@
   register Lisp_Object next_window;
   register Lisp_Object last_window;
   FRAME_PTR frame;
+  Lisp_Object frame_arg;
+  frame_arg = Qt;
 
 #ifdef MULTI_FRAME
   /* If we're only looping through windows on a particular frame,
@@ -1132,10 +1142,18 @@
     frame = selected_frame;
   else
     frame = 0;
+  if (frame)
+    frame_arg = Qlambda;
+  else if (EQ (frames, Qvisible))
+    frame_arg = frames;
 #else
   frame = 0;
 #endif
 
+  /* frame_arg is Qlambda to stick to one frame,
+     Qvisible to consider all visible frames,
+     or Qt otherwise.  */
+
   /* Pick a window to start with.  */
   if (XTYPE (obj) == Lisp_Window)
     w = obj;
@@ -1151,14 +1169,7 @@
      We can't just wait until we hit the first window again, because
      it might be deleted.  */
 
-#ifdef MULTI_FRAME
-  if (frame)
-    last_window = Fprevious_window (w, (mini ? Qt : Qnil), Qlambda);
-  else
-#endif	/* MULTI_FRAME */
-    /* We know frame is 0, so we're looping through all frames.
-       Or we know this isn't a MULTI_FRAME Emacs, so who cares?  */
-    last_window = Fprevious_window (w, mini ? Qt : Qnil, Qt);
+  last_window = Fprevious_window (w, mini ? Qt : Qnil, frame_arg);
 
   best_window = Qnil;
   for (;;)
@@ -1167,15 +1178,13 @@
 
       /* Pick the next window now, since some operations will delete
 	 the current window.  */
+      next_window = Fnext_window (w, mini ? Qt : Qnil, frame_arg);
+
 #ifdef MULTI_FRAME
-      if (frame)
-	next_window = Fnext_window (w, (mini ? Qt : Qnil), Qlambda);
-      else
-#endif				/* MULTI_FRAME */
-	/* We know frame is 0, so we're looping through all frames.
-	   Or we know this isn't a MULTI_FRAME Emacs, so who cares?  */
-	next_window = Fnext_window (w, mini ? Qt : Qnil, Qt);
-
+      if (frame != 0 && EQ (frames, Qt)
+	  && FRAME_VISIBLE_P (w_frame))
+	continue;
+#endif
       if (! MINI_WINDOW_P (XWINDOW (w))
 	  || (mini && minibuf_level > 0))
 	switch (type)
@@ -1283,24 +1292,28 @@
 
 DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 1, 0,
   "Return the window least recently selected or used for display.\n\
-If optional argument FRAMES is t, search all frames.  If FRAME is a\n\
-frame, search only that frame.\n")
-  (frames)
-    Lisp_Object frames;
+If optional argument FRAME is `visible', search all visible frames.\n\
+If FRAME is t, search all frames.\n\
+If FRAME is nil, search only the selected frame.\n\
+If FRAME is a frame, search only that frame.")
+  (frame)
+    Lisp_Object frame;
 {
   register Lisp_Object w;
   /* First try for a window that is full-width */
-  w = window_loop (GET_LRU_WINDOW, Qt, 0, frames);
+  w = window_loop (GET_LRU_WINDOW, Qt, 0, frame);
   if (!NILP (w) && !EQ (w, selected_window))
     return w;
   /* If none of them, try the rest */
-  return window_loop (GET_LRU_WINDOW, Qnil, 0, frames);
+  return window_loop (GET_LRU_WINDOW, Qnil, 0, frame);
 }
 
 DEFUN ("get-largest-window", Fget_largest_window, Sget_largest_window, 0, 1, 0,
   "Return the largest window in area.\n\
-If optional argument FRAMES is t, search all frames.  If FRAME is a\n\
-frame, search only that frame.\n")
+If optional argument FRAME is `visible', search all visible frames.\n\
+If FRAME is t, search all frames.\n\
+If FRAME is nil, search only the selected frame.\n\
+If FRAME is a frame, search only that frame.")
   (frame)
     Lisp_Object frame;
 {
@@ -1310,9 +1323,10 @@
 
 DEFUN ("get-buffer-window", Fget_buffer_window, Sget_buffer_window, 1, 2, 0,
   "Return a window currently displaying BUFFER, or nil if none.\n\
-If optional argument FRAME is t, search all visible frames.\n\
+If optional argument FRAME is `visible', search all visible frames.\n\
+If FRAME is t, search all frames.\n\
 If FRAME is nil, search only the selected frame.\n\
-If FRAME is a frame, search only that frame.\n")
+If FRAME is a frame, search only that frame.")
   (buffer, frame)
     Lisp_Object buffer, frame;
 {
@@ -1370,6 +1384,7 @@
 Optional second argument FRAME controls which frames are affected.\n\
 If nil or omitted, delete all windows showing BUFFER in any frame.\n\
 If t, delete only windows showing BUFFER in the selected frame.\n\
+If `visible', delete all windows showing BUFFER in any visible frame.\n\
 If a frame, delete only windows showing BUFFER in that frame.")
   (buffer, frame)
      Lisp_Object buffer, frame;