# HG changeset patch # User Richard M. Stallman # Date 908030968 0 # Node ID 02cc44ea2455f3675871b27a1886ce5baefba491 # Parent b9c1f9b1dac9bce902680ebcb8de22ab28a48804 (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. diff -r b9c1f9b1dac9 -r 02cc44ea2455 src/window.c --- a/src/window.c Sat Oct 10 14:06:14 1998 +0000 +++ b/src/window.c Sat Oct 10 14:49:28 1998 +0000 @@ -35,7 +35,7 @@ #include "xterm.h" #endif -Lisp_Object Qwindowp, Qwindow_live_p; +Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p; static struct window *decode_window P_ ((Lisp_Object)); @@ -1307,7 +1307,8 @@ DELETE_OTHER_WINDOWS, /* Arg is window not to delete */ DELETE_BUFFER_WINDOWS, /* Arg is buffer */ GET_LARGEST_WINDOW, - UNSHOW_BUFFER /* Arg is buffer */ + UNSHOW_BUFFER, /* Arg is buffer */ + CHECK_ALL_WINDOWS }; static Lisp_Object @@ -1516,6 +1517,12 @@ } } break; + + /* Check for a window that has a killed buffer. */ + case CHECK_ALL_WINDOWS: + if (! NILP (XWINDOW (w)->buffer) + && NILP (XBUFFER (XWINDOW (w)->buffer)->name)) + abort (); } if (EQ (w, last_window)) @@ -1527,6 +1534,13 @@ return best_window; } +/* Used for debugging. Abort if any window has a dead buffer. */ + +check_all_windows () +{ + window_loop (CHECK_ALL_WINDOWS, Qnil, 1, Qt); +} + 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 FRAME is `visible', search all visible frames.\n\ @@ -3278,12 +3292,31 @@ return Qnil; } +DEFUN ("window-configuration-frame", Fwindow_configuration_frame, Swindow_configuration_frame, 1, 1, 0, + "Return the frame that CONFIG, a window-configuration object, is about.") + (config) + Lisp_Object config; +{ + register struct save_window_data *data; + struct Lisp_Vector *saved_windows; + + if (! WINDOW_CONFIGURATIONP (config)) + wrong_type_argument (Qwindow_configuration_p, config); + + data = (struct save_window_data *) XVECTOR (config); + saved_windows = XVECTOR (data->saved_windows); + return XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window)->frame; +} + DEFUN ("set-window-configuration", Fset_window_configuration, Sset_window_configuration, 1, 1, 0, "Set the configuration of windows and buffers as specified by CONFIGURATION.\n\ CONFIGURATION must be a value previously returned\n\ -by `current-window-configuration' (which see).") - (configuration) +by `current-window-configuration' (which see).\n\ +If CONFIGURATION was made from a frame that is now deleted,\n\ +only frame-independent values can be restored. In this case,\n\ +the return value is nil. Otherwise the value is t.") + (configuration) Lisp_Object configuration; { register struct save_window_data *data; @@ -3294,10 +3327,7 @@ int old_point = -1; while (!WINDOW_CONFIGURATIONP (configuration)) - { - configuration = wrong_type_argument (intern ("window-configuration-p"), - configuration); - } + wrong_type_argument (Qwindow_configuration_p, configuration); data = (struct save_window_data *) XVECTOR (configuration); saved_windows = XVECTOR (data->saved_windows); @@ -3529,7 +3559,7 @@ Vminibuf_scroll_window = data->minibuf_scroll_window; - return Qnil; + return (FRAME_LIVE_P (f) ? Qt : Qnil); } /* Mark all windows now on frame as deleted @@ -3857,6 +3887,9 @@ Qwindowp = intern ("windowp"); staticpro (&Qwindowp); + Qwindow_configuration_p = intern ("window-configuration-p"); + staticpro (&Qwindow_configuration_p); + Qwindow_live_p = intern ("window-live-p"); staticpro (&Qwindow_live_p); @@ -4061,6 +4094,7 @@ defsubr (&Srecenter); defsubr (&Smove_to_window_line); defsubr (&Swindow_configuration_p); + defsubr (&Swindow_configuration_frame); defsubr (&Sset_window_configuration); defsubr (&Scurrent_window_configuration); defsubr (&Ssave_window_excursion);