summaryrefslogtreecommitdiff
path: root/src/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c60
1 files changed, 50 insertions, 10 deletions
diff --git a/src/window.c b/src/window.c
index 0fc4f622995..7eb532f78cf 100644
--- a/src/window.c
+++ b/src/window.c
@@ -42,6 +42,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#ifdef MSDOS
#include "msdos.h"
#endif
+#include "pdumper.h"
static ptrdiff_t count_windows (struct window *);
static ptrdiff_t get_leaf_windows (struct window *, struct window **,
@@ -7876,10 +7877,59 @@ and scrolling positions. */)
return Qnil;
}
+
+static void init_window_once_for_pdumper (void);
+
void
init_window_once (void)
{
+ minibuf_window = Qnil;
+ staticpro (&minibuf_window);
+
+ selected_window = Qnil;
+ staticpro (&selected_window);
+
+ Vwindow_list = Qnil;
+ staticpro (&Vwindow_list);
+
+ minibuf_selected_window = Qnil;
+ staticpro (&minibuf_selected_window);
+
+ pdumper_do_now_and_after_load (init_window_once_for_pdumper);
+}
+
+static void init_window_once_for_pdumper (void)
+{
+ window_scroll_pixel_based_preserve_x = -1;
+ window_scroll_pixel_based_preserve_y = -1;
+ window_scroll_preserve_hpos = -1;
+ window_scroll_preserve_vpos = -1;
+ PDUMPER_IGNORE (sequence_number);
+
+ PDUMPER_RESET_LV (minibuf_window, Qnil);
+ PDUMPER_RESET_LV (selected_window, Qnil);
+ PDUMPER_RESET_LV (Vwindow_list, Qnil);
+ PDUMPER_RESET_LV (minibuf_selected_window, Qnil);
+
+ /* Hack: if mode_line_in_non_selected_windows is true (which it may
+ be, if we're restoring from a dump) the guts of
+ make_initial_frame will try to access selected_window, which is
+ invalid at this point, and lose. For the purposes of creating
+ the initial frame and window, this variable must be false. */
+ bool old_mode_line_in_non_selected_windows;
+
+ /* Snapshot dumped_with_pdumper to suppress compiler warning. */
+ bool saved_dumped_with_pdumper = dumped_with_pdumper_p ();
+ if (saved_dumped_with_pdumper)
+ {
+ old_mode_line_in_non_selected_windows
+ = mode_line_in_non_selected_windows;
+ mode_line_in_non_selected_windows = false;
+ }
struct frame *f = make_initial_frame ();
+ if (saved_dumped_with_pdumper)
+ mode_line_in_non_selected_windows =
+ old_mode_line_in_non_selected_windows;
XSETFRAME (selected_frame, f);
old_selected_frame = Vterminal_frame = selected_frame;
minibuf_window = f->minibuffer_window;
@@ -7932,16 +7982,6 @@ syms_of_window (void)
DEFSYM (Qmode_line_format, "mode-line-format");
DEFSYM (Qheader_line_format, "header-line-format");
- staticpro (&Vwindow_list);
-
- minibuf_selected_window = Qnil;
- staticpro (&minibuf_selected_window);
-
- window_scroll_pixel_based_preserve_x = -1;
- window_scroll_pixel_based_preserve_y = -1;
- window_scroll_preserve_hpos = -1;
- window_scroll_preserve_vpos = -1;
-
DEFVAR_LISP ("temp-buffer-show-function", Vtemp_buffer_show_function,
doc: /* Non-nil means call as function to display a help buffer.
The function is called with one argument, the buffer to be displayed.