Mercurial > emacs
comparison src/window.c @ 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 | ed4b06e1975b |
children | 930d259c1f95 |
comparison
equal
deleted
inserted
replaced
6246:128dc040e121 | 6247:22d4037cbce2 |
---|---|
1 /* Window creation, deletion and examination for GNU Emacs. | 1 /* Window creation, deletion and examination for GNU Emacs. |
2 Does not include redisplay. | 2 Does not include redisplay. |
3 Copyright (C) 1985, 1986, 1987, 1993 Free Software Foundation, Inc. | 3 Copyright (C) 1985, 1986, 1987, 1993, 1994 Free Software Foundation, Inc. |
4 | 4 |
5 This file is part of GNU Emacs. | 5 This file is part of GNU Emacs. |
6 | 6 |
7 GNU Emacs is free software; you can redistribute it and/or modify | 7 GNU Emacs is free software; you can redistribute it and/or modify |
8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
734 pwindow = XWINDOW (pwindow)->parent; | 734 pwindow = XWINDOW (pwindow)->parent; |
735 } | 735 } |
736 | 736 |
737 if (EQ (window, pwindow)) | 737 if (EQ (window, pwindow)) |
738 { | 738 { |
739 Lisp_Object alternative = Fnext_window (window, Qlambda, Qnil); | 739 Lisp_Object alternative; |
740 alternative = Fnext_window (window, Qlambda, Qnil); | |
740 | 741 |
741 /* If we're about to delete the selected window on the | 742 /* If we're about to delete the selected window on the |
742 selected frame, then we should use Fselect_window to select | 743 selected frame, then we should use Fselect_window to select |
743 the new window. On the other hand, if we're about to | 744 the new window. On the other hand, if we're about to |
744 delete the selected window on any other frame, we shouldn't do | 745 delete the selected window on any other frame, we shouldn't do |
839 set of windows even when the minibuffer is on another frame. If the\n\ | 840 set of windows even when the minibuffer is on another frame. If the\n\ |
840 minibuffer does not count, only windows from WINDOW's frame count.\n\ | 841 minibuffer does not count, only windows from WINDOW's frame count.\n\ |
841 \n\ | 842 \n\ |
842 Optional third arg ALL-FRAMES t means include windows on all frames.\n\ | 843 Optional third arg ALL-FRAMES t means include windows on all frames.\n\ |
843 ALL-FRAMES nil or omitted means cycle within the frames as specified\n\ | 844 ALL-FRAMES nil or omitted means cycle within the frames as specified\n\ |
844 above. If neither nil nor t, restrict to WINDOW's frame.\n\ | 845 above. ALL-FRAMES = `visible' means include windows on all visible frames.\n\ |
846 Anything else means restrict to WINDOW's frame.\n\ | |
845 \n\ | 847 \n\ |
846 If you use consistent values for MINIBUF and ALL-FRAMES, you can use\n\ | 848 If you use consistent values for MINIBUF and ALL-FRAMES, you can use\n\ |
847 `next-window' to iterate through the entire cycle of acceptable\n\ | 849 `next-window' to iterate through the entire cycle of acceptable\n\ |
848 windows, eventually ending up back at the window you started with.\n\ | 850 windows, eventually ending up back at the window you started with.\n\ |
849 `previous-window' traverses the same cycle, in the reverse order.") | 851 `previous-window' traverses the same cycle, in the reverse order.") |
876 ? (FRAME_MINIBUF_WINDOW | 878 ? (FRAME_MINIBUF_WINDOW |
877 (XFRAME | 879 (XFRAME |
878 (WINDOW_FRAME | 880 (WINDOW_FRAME |
879 (XWINDOW (window))))) | 881 (XWINDOW (window))))) |
880 : Qnil); | 882 : Qnil); |
883 else if (EQ (all_frames, Qvisible)) | |
884 ; | |
881 else if (! EQ (all_frames, Qt)) | 885 else if (! EQ (all_frames, Qt)) |
882 all_frames = Qnil; | 886 all_frames = Qnil; |
883 /* Now all_frames is t meaning search all frames, | 887 /* Now all_frames is t meaning search all frames, |
884 nil meaning search just current frame, | 888 nil meaning search just current frame, |
885 or a window, meaning search the frame that window belongs to. */ | 889 or a window, meaning search the frame that window belongs to. */ |
952 the minibuffer does not count, only windows from WINDOW's frame\n\ | 956 the minibuffer does not count, only windows from WINDOW's frame\n\ |
953 count.\n\ | 957 count.\n\ |
954 \n\ | 958 \n\ |
955 Optional third arg ALL-FRAMES t means include windows on all frames.\n\ | 959 Optional third arg ALL-FRAMES t means include windows on all frames.\n\ |
956 ALL-FRAMES nil or omitted means cycle within the frames as specified\n\ | 960 ALL-FRAMES nil or omitted means cycle within the frames as specified\n\ |
957 above. If neither nil nor t, restrict to WINDOW's frame.\n\ | 961 above. ALL-FRAMES = `visible' means include windows on all visible frames.\n\ |
962 Anything else means restrict to WINDOW's frame.\n\ | |
958 \n\ | 963 \n\ |
959 If you use consistent values for MINIBUF and ALL-FRAMES, you can use\n\ | 964 If you use consistent values for MINIBUF and ALL-FRAMES, you can use\n\ |
960 `previous-window' to iterate through the entire cycle of acceptable\n\ | 965 `previous-window' to iterate through the entire cycle of acceptable\n\ |
961 windows, eventually ending up back at the window you started with.\n\ | 966 windows, eventually ending up back at the window you started with.\n\ |
962 `next-window' traverses the same cycle, in the reverse order.") | 967 `next-window' traverses the same cycle, in the reverse order.") |
990 ? (FRAME_MINIBUF_WINDOW | 995 ? (FRAME_MINIBUF_WINDOW |
991 (XFRAME | 996 (XFRAME |
992 (WINDOW_FRAME | 997 (WINDOW_FRAME |
993 (XWINDOW (window))))) | 998 (XWINDOW (window))))) |
994 : Qnil); | 999 : Qnil); |
1000 else if (EQ (all_frames, Qvisible)) | |
1001 ; | |
995 else if (! EQ (all_frames, Qt)) | 1002 else if (! EQ (all_frames, Qt)) |
996 all_frames = Qnil; | 1003 all_frames = Qnil; |
997 /* Now all_frames is t meaning search all frames, | 1004 /* Now all_frames is t meaning search all frames, |
998 nil meaning search just current frame, | 1005 nil meaning search just current frame, |
999 or a window, meaning search the frame that window belongs to. */ | 1006 or a window, meaning search the frame that window belongs to. */ |
1093 | 1100 |
1094 /* Look at all windows, performing an operation specified by TYPE | 1101 /* Look at all windows, performing an operation specified by TYPE |
1095 with argument OBJ. | 1102 with argument OBJ. |
1096 If FRAMES is Qt, look at all frames; | 1103 If FRAMES is Qt, look at all frames; |
1097 Qnil, look at just the selected frame; | 1104 Qnil, look at just the selected frame; |
1105 Qvisible, look at visible frames; | |
1098 a frame, just look at windows on that frame. | 1106 a frame, just look at windows on that frame. |
1099 If MINI is non-zero, perform the operation on minibuffer windows too. | 1107 If MINI is non-zero, perform the operation on minibuffer windows too. |
1100 */ | 1108 */ |
1101 | 1109 |
1102 enum window_loop | 1110 enum window_loop |
1119 register Lisp_Object w; | 1127 register Lisp_Object w; |
1120 register Lisp_Object best_window; | 1128 register Lisp_Object best_window; |
1121 register Lisp_Object next_window; | 1129 register Lisp_Object next_window; |
1122 register Lisp_Object last_window; | 1130 register Lisp_Object last_window; |
1123 FRAME_PTR frame; | 1131 FRAME_PTR frame; |
1132 Lisp_Object frame_arg; | |
1133 frame_arg = Qt; | |
1124 | 1134 |
1125 #ifdef MULTI_FRAME | 1135 #ifdef MULTI_FRAME |
1126 /* If we're only looping through windows on a particular frame, | 1136 /* If we're only looping through windows on a particular frame, |
1127 frame points to that frame. If we're looping through windows | 1137 frame points to that frame. If we're looping through windows |
1128 on all frames, frame is 0. */ | 1138 on all frames, frame is 0. */ |
1130 frame = XFRAME (frames); | 1140 frame = XFRAME (frames); |
1131 else if (NILP (frames)) | 1141 else if (NILP (frames)) |
1132 frame = selected_frame; | 1142 frame = selected_frame; |
1133 else | 1143 else |
1134 frame = 0; | 1144 frame = 0; |
1145 if (frame) | |
1146 frame_arg = Qlambda; | |
1147 else if (EQ (frames, Qvisible)) | |
1148 frame_arg = frames; | |
1135 #else | 1149 #else |
1136 frame = 0; | 1150 frame = 0; |
1137 #endif | 1151 #endif |
1152 | |
1153 /* frame_arg is Qlambda to stick to one frame, | |
1154 Qvisible to consider all visible frames, | |
1155 or Qt otherwise. */ | |
1138 | 1156 |
1139 /* Pick a window to start with. */ | 1157 /* Pick a window to start with. */ |
1140 if (XTYPE (obj) == Lisp_Window) | 1158 if (XTYPE (obj) == Lisp_Window) |
1141 w = obj; | 1159 w = obj; |
1142 else if (frame) | 1160 else if (frame) |
1149 ring, we can just use Fprevious_window to find the last one. | 1167 ring, we can just use Fprevious_window to find the last one. |
1150 | 1168 |
1151 We can't just wait until we hit the first window again, because | 1169 We can't just wait until we hit the first window again, because |
1152 it might be deleted. */ | 1170 it might be deleted. */ |
1153 | 1171 |
1154 #ifdef MULTI_FRAME | 1172 last_window = Fprevious_window (w, mini ? Qt : Qnil, frame_arg); |
1155 if (frame) | |
1156 last_window = Fprevious_window (w, (mini ? Qt : Qnil), Qlambda); | |
1157 else | |
1158 #endif /* MULTI_FRAME */ | |
1159 /* We know frame is 0, so we're looping through all frames. | |
1160 Or we know this isn't a MULTI_FRAME Emacs, so who cares? */ | |
1161 last_window = Fprevious_window (w, mini ? Qt : Qnil, Qt); | |
1162 | 1173 |
1163 best_window = Qnil; | 1174 best_window = Qnil; |
1164 for (;;) | 1175 for (;;) |
1165 { | 1176 { |
1166 FRAME_PTR w_frame = XFRAME (WINDOW_FRAME (XWINDOW (w))); | 1177 FRAME_PTR w_frame = XFRAME (WINDOW_FRAME (XWINDOW (w))); |
1167 | 1178 |
1168 /* Pick the next window now, since some operations will delete | 1179 /* Pick the next window now, since some operations will delete |
1169 the current window. */ | 1180 the current window. */ |
1181 next_window = Fnext_window (w, mini ? Qt : Qnil, frame_arg); | |
1182 | |
1170 #ifdef MULTI_FRAME | 1183 #ifdef MULTI_FRAME |
1171 if (frame) | 1184 if (frame != 0 && EQ (frames, Qt) |
1172 next_window = Fnext_window (w, (mini ? Qt : Qnil), Qlambda); | 1185 && FRAME_VISIBLE_P (w_frame)) |
1173 else | 1186 continue; |
1174 #endif /* MULTI_FRAME */ | 1187 #endif |
1175 /* We know frame is 0, so we're looping through all frames. | |
1176 Or we know this isn't a MULTI_FRAME Emacs, so who cares? */ | |
1177 next_window = Fnext_window (w, mini ? Qt : Qnil, Qt); | |
1178 | |
1179 if (! MINI_WINDOW_P (XWINDOW (w)) | 1188 if (! MINI_WINDOW_P (XWINDOW (w)) |
1180 || (mini && minibuf_level > 0)) | 1189 || (mini && minibuf_level > 0)) |
1181 switch (type) | 1190 switch (type) |
1182 { | 1191 { |
1183 case GET_BUFFER_WINDOW: | 1192 case GET_BUFFER_WINDOW: |
1281 return best_window; | 1290 return best_window; |
1282 } | 1291 } |
1283 | 1292 |
1284 DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 1, 0, | 1293 DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 1, 0, |
1285 "Return the window least recently selected or used for display.\n\ | 1294 "Return the window least recently selected or used for display.\n\ |
1286 If optional argument FRAMES is t, search all frames. If FRAME is a\n\ | 1295 If optional argument FRAME is `visible', search all visible frames.\n\ |
1287 frame, search only that frame.\n") | 1296 If FRAME is t, search all frames.\n\ |
1288 (frames) | 1297 If FRAME is nil, search only the selected frame.\n\ |
1289 Lisp_Object frames; | 1298 If FRAME is a frame, search only that frame.") |
1299 (frame) | |
1300 Lisp_Object frame; | |
1290 { | 1301 { |
1291 register Lisp_Object w; | 1302 register Lisp_Object w; |
1292 /* First try for a window that is full-width */ | 1303 /* First try for a window that is full-width */ |
1293 w = window_loop (GET_LRU_WINDOW, Qt, 0, frames); | 1304 w = window_loop (GET_LRU_WINDOW, Qt, 0, frame); |
1294 if (!NILP (w) && !EQ (w, selected_window)) | 1305 if (!NILP (w) && !EQ (w, selected_window)) |
1295 return w; | 1306 return w; |
1296 /* If none of them, try the rest */ | 1307 /* If none of them, try the rest */ |
1297 return window_loop (GET_LRU_WINDOW, Qnil, 0, frames); | 1308 return window_loop (GET_LRU_WINDOW, Qnil, 0, frame); |
1298 } | 1309 } |
1299 | 1310 |
1300 DEFUN ("get-largest-window", Fget_largest_window, Sget_largest_window, 0, 1, 0, | 1311 DEFUN ("get-largest-window", Fget_largest_window, Sget_largest_window, 0, 1, 0, |
1301 "Return the largest window in area.\n\ | 1312 "Return the largest window in area.\n\ |
1302 If optional argument FRAMES is t, search all frames. If FRAME is a\n\ | 1313 If optional argument FRAME is `visible', search all visible frames.\n\ |
1303 frame, search only that frame.\n") | 1314 If FRAME is t, search all frames.\n\ |
1315 If FRAME is nil, search only the selected frame.\n\ | |
1316 If FRAME is a frame, search only that frame.") | |
1304 (frame) | 1317 (frame) |
1305 Lisp_Object frame; | 1318 Lisp_Object frame; |
1306 { | 1319 { |
1307 return window_loop (GET_LARGEST_WINDOW, Qnil, 0, | 1320 return window_loop (GET_LARGEST_WINDOW, Qnil, 0, |
1308 frame); | 1321 frame); |
1309 } | 1322 } |
1310 | 1323 |
1311 DEFUN ("get-buffer-window", Fget_buffer_window, Sget_buffer_window, 1, 2, 0, | 1324 DEFUN ("get-buffer-window", Fget_buffer_window, Sget_buffer_window, 1, 2, 0, |
1312 "Return a window currently displaying BUFFER, or nil if none.\n\ | 1325 "Return a window currently displaying BUFFER, or nil if none.\n\ |
1313 If optional argument FRAME is t, search all visible frames.\n\ | 1326 If optional argument FRAME is `visible', search all visible frames.\n\ |
1327 If FRAME is t, search all frames.\n\ | |
1314 If FRAME is nil, search only the selected frame.\n\ | 1328 If FRAME is nil, search only the selected frame.\n\ |
1315 If FRAME is a frame, search only that frame.\n") | 1329 If FRAME is a frame, search only that frame.") |
1316 (buffer, frame) | 1330 (buffer, frame) |
1317 Lisp_Object buffer, frame; | 1331 Lisp_Object buffer, frame; |
1318 { | 1332 { |
1319 buffer = Fget_buffer (buffer); | 1333 buffer = Fget_buffer (buffer); |
1320 if (XTYPE (buffer) == Lisp_Buffer) | 1334 if (XTYPE (buffer) == Lisp_Buffer) |
1368 1, 2, "bDelete windows on (buffer): ", | 1382 1, 2, "bDelete windows on (buffer): ", |
1369 "Delete all windows showing BUFFER.\n\ | 1383 "Delete all windows showing BUFFER.\n\ |
1370 Optional second argument FRAME controls which frames are affected.\n\ | 1384 Optional second argument FRAME controls which frames are affected.\n\ |
1371 If nil or omitted, delete all windows showing BUFFER in any frame.\n\ | 1385 If nil or omitted, delete all windows showing BUFFER in any frame.\n\ |
1372 If t, delete only windows showing BUFFER in the selected frame.\n\ | 1386 If t, delete only windows showing BUFFER in the selected frame.\n\ |
1387 If `visible', delete all windows showing BUFFER in any visible frame.\n\ | |
1373 If a frame, delete only windows showing BUFFER in that frame.") | 1388 If a frame, delete only windows showing BUFFER in that frame.") |
1374 (buffer, frame) | 1389 (buffer, frame) |
1375 Lisp_Object buffer, frame; | 1390 Lisp_Object buffer, frame; |
1376 { | 1391 { |
1377 #ifdef MULTI_FRAME | 1392 #ifdef MULTI_FRAME |