aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1998-10-10 14:49:28 +0000
committerRichard M. Stallman1998-10-10 14:49:28 +0000
commit3f8ab7bddcdfc06efaa4640047377eb783766ad8 (patch)
treee84ad6df58fd646c6d880689f86804062461a7c9 /src
parent7163b71c975286b0c98ffb9b5fd7e5709cde7990 (diff)
downloademacs-3f8ab7bddcdfc06efaa4640047377eb783766ad8.tar.gz
emacs-3f8ab7bddcdfc06efaa4640047377eb783766ad8.zip
(window_loop): New alternative CHECK_ALL_WINDOWS.
(check_all_windows): New function for debugging tests. (syms_of_window): Initialize it. (Qwindow_configuration_p): New variable. (Fwindow_configuration_frame): New function. (syms_of_window): defsubr it. (Fset_window_configuration): Return t if frame is live. Use Qwindow_configuration_p.
Diffstat (limited to 'src')
-rw-r--r--src/window.c52
1 files changed, 43 insertions, 9 deletions
diff --git a/src/window.c b/src/window.c
index bd0668dd0bf..41bb492ffdc 100644
--- a/src/window.c
+++ b/src/window.c
@@ -35,7 +35,7 @@ Boston, MA 02111-1307, USA. */
35#include "xterm.h" 35#include "xterm.h"
36#endif 36#endif
37 37
38Lisp_Object Qwindowp, Qwindow_live_p; 38Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p;
39 39
40static struct window *decode_window P_ ((Lisp_Object)); 40static struct window *decode_window P_ ((Lisp_Object));
41 41
@@ -1307,7 +1307,8 @@ enum window_loop
1307 DELETE_OTHER_WINDOWS, /* Arg is window not to delete */ 1307 DELETE_OTHER_WINDOWS, /* Arg is window not to delete */
1308 DELETE_BUFFER_WINDOWS, /* Arg is buffer */ 1308 DELETE_BUFFER_WINDOWS, /* Arg is buffer */
1309 GET_LARGEST_WINDOW, 1309 GET_LARGEST_WINDOW,
1310 UNSHOW_BUFFER /* Arg is buffer */ 1310 UNSHOW_BUFFER, /* Arg is buffer */
1311 CHECK_ALL_WINDOWS
1311}; 1312};
1312 1313
1313static Lisp_Object 1314static Lisp_Object
@@ -1516,6 +1517,12 @@ window_loop (type, obj, mini, frames)
1516 } 1517 }
1517 } 1518 }
1518 break; 1519 break;
1520
1521 /* Check for a window that has a killed buffer. */
1522 case CHECK_ALL_WINDOWS:
1523 if (! NILP (XWINDOW (w)->buffer)
1524 && NILP (XBUFFER (XWINDOW (w)->buffer)->name))
1525 abort ();
1519 } 1526 }
1520 1527
1521 if (EQ (w, last_window)) 1528 if (EQ (w, last_window))
@@ -1527,6 +1534,13 @@ window_loop (type, obj, mini, frames)
1527 return best_window; 1534 return best_window;
1528} 1535}
1529 1536
1537/* Used for debugging. Abort if any window has a dead buffer. */
1538
1539check_all_windows ()
1540{
1541 window_loop (CHECK_ALL_WINDOWS, Qnil, 1, Qt);
1542}
1543
1530DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 1, 0, 1544DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 1, 0,
1531 "Return the window least recently selected or used for display.\n\ 1545 "Return the window least recently selected or used for display.\n\
1532If optional argument FRAME is `visible', search all visible frames.\n\ 1546If optional argument FRAME is `visible', search all visible frames.\n\
@@ -3278,12 +3292,31 @@ DEFUN ("window-configuration-p", Fwindow_configuration_p, Swindow_configuration_
3278 return Qnil; 3292 return Qnil;
3279} 3293}
3280 3294
3295DEFUN ("window-configuration-frame", Fwindow_configuration_frame, Swindow_configuration_frame, 1, 1, 0,
3296 "Return the frame that CONFIG, a window-configuration object, is about.")
3297 (config)
3298 Lisp_Object config;
3299{
3300 register struct save_window_data *data;
3301 struct Lisp_Vector *saved_windows;
3302
3303 if (! WINDOW_CONFIGURATIONP (config))
3304 wrong_type_argument (Qwindow_configuration_p, config);
3305
3306 data = (struct save_window_data *) XVECTOR (config);
3307 saved_windows = XVECTOR (data->saved_windows);
3308 return XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window)->frame;
3309}
3310
3281DEFUN ("set-window-configuration", Fset_window_configuration, 3311DEFUN ("set-window-configuration", Fset_window_configuration,
3282 Sset_window_configuration, 1, 1, 0, 3312 Sset_window_configuration, 1, 1, 0,
3283 "Set the configuration of windows and buffers as specified by CONFIGURATION.\n\ 3313 "Set the configuration of windows and buffers as specified by CONFIGURATION.\n\
3284CONFIGURATION must be a value previously returned\n\ 3314CONFIGURATION must be a value previously returned\n\
3285by `current-window-configuration' (which see).") 3315by `current-window-configuration' (which see).\n\
3286 (configuration) 3316If CONFIGURATION was made from a frame that is now deleted,\n\
3317only frame-independent values can be restored. In this case,\n\
3318the return value is nil. Otherwise the value is t.")
3319 (configuration)
3287 Lisp_Object configuration; 3320 Lisp_Object configuration;
3288{ 3321{
3289 register struct save_window_data *data; 3322 register struct save_window_data *data;
@@ -3294,10 +3327,7 @@ by `current-window-configuration' (which see).")
3294 int old_point = -1; 3327 int old_point = -1;
3295 3328
3296 while (!WINDOW_CONFIGURATIONP (configuration)) 3329 while (!WINDOW_CONFIGURATIONP (configuration))
3297 { 3330 wrong_type_argument (Qwindow_configuration_p, configuration);
3298 configuration = wrong_type_argument (intern ("window-configuration-p"),
3299 configuration);
3300 }
3301 3331
3302 data = (struct save_window_data *) XVECTOR (configuration); 3332 data = (struct save_window_data *) XVECTOR (configuration);
3303 saved_windows = XVECTOR (data->saved_windows); 3333 saved_windows = XVECTOR (data->saved_windows);
@@ -3529,7 +3559,7 @@ by `current-window-configuration' (which see).")
3529 3559
3530 Vminibuf_scroll_window = data->minibuf_scroll_window; 3560 Vminibuf_scroll_window = data->minibuf_scroll_window;
3531 3561
3532 return Qnil; 3562 return (FRAME_LIVE_P (f) ? Qt : Qnil);
3533} 3563}
3534 3564
3535/* Mark all windows now on frame as deleted 3565/* Mark all windows now on frame as deleted
@@ -3857,6 +3887,9 @@ syms_of_window ()
3857 Qwindowp = intern ("windowp"); 3887 Qwindowp = intern ("windowp");
3858 staticpro (&Qwindowp); 3888 staticpro (&Qwindowp);
3859 3889
3890 Qwindow_configuration_p = intern ("window-configuration-p");
3891 staticpro (&Qwindow_configuration_p);
3892
3860 Qwindow_live_p = intern ("window-live-p"); 3893 Qwindow_live_p = intern ("window-live-p");
3861 staticpro (&Qwindow_live_p); 3894 staticpro (&Qwindow_live_p);
3862 3895
@@ -4061,6 +4094,7 @@ The selected frame is the one whose configuration has changed.");
4061 defsubr (&Srecenter); 4094 defsubr (&Srecenter);
4062 defsubr (&Smove_to_window_line); 4095 defsubr (&Smove_to_window_line);
4063 defsubr (&Swindow_configuration_p); 4096 defsubr (&Swindow_configuration_p);
4097 defsubr (&Swindow_configuration_frame);
4064 defsubr (&Sset_window_configuration); 4098 defsubr (&Sset_window_configuration);
4065 defsubr (&Scurrent_window_configuration); 4099 defsubr (&Scurrent_window_configuration);
4066 defsubr (&Ssave_window_excursion); 4100 defsubr (&Ssave_window_excursion);