aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDmitry Antipov2012-08-01 09:11:36 +0400
committerDmitry Antipov2012-08-01 09:11:36 +0400
commit3a45383a47009a5e6a15a4005ad95ecf63539182 (patch)
tree77f59be478e92b130263034efa3ca94e203cee38 /src
parentc1dbc63c93c5702da44ef7e3cc281ac3bb7941ce (diff)
downloademacs-3a45383a47009a5e6a15a4005ad95ecf63539182.tar.gz
emacs-3a45383a47009a5e6a15a4005ad95ecf63539182.zip
Use INTERNAL_FIELD for windows.
* src/window.h (WVAR): New macro. (struct window): Change Lisp_Object members to INTERNAL_FIELD. * src/alloc.c, src/buffer.c, src/composite.c, src/dispextern.h: * src/dispnew.c, src/editfns.c, src/fileio.c, src/font.c, src/fontset.c: * src/frame.c, src/frame.h, src/fringe.c, src/indent.c, src/insdel.c: * src/keyboard.c, src/keymap.c, src/lisp.h, src/minibuf.c, src/nsterm.m: * src/print.c, src/textprop.c, src/w32fns.c, src/w32menu.c, src/w32term.c: * src/window.c, src/xdisp.c, src/xfaces.c, src/xfns.c, src/xmenu.c: * src/xterm.c: Users changed. * admin/coccinelle/window.cocci: Semantic patch to replace direct access to Lisp_Object members of struct window to WVAR.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog17
-rw-r--r--src/alloc.c3
-rw-r--r--src/buffer.c19
-rw-r--r--src/composite.c4
-rw-r--r--src/dispextern.h15
-rw-r--r--src/dispnew.c261
-rw-r--r--src/editfns.c8
-rw-r--r--src/fileio.c4
-rw-r--r--src/font.c4
-rw-r--r--src/fontset.c2
-rw-r--r--src/frame.c64
-rw-r--r--src/frame.h2
-rw-r--r--src/fringe.c14
-rw-r--r--src/indent.c31
-rw-r--r--src/insdel.c2
-rw-r--r--src/keyboard.c32
-rw-r--r--src/keymap.c6
-rw-r--r--src/lisp.h3
-rw-r--r--src/minibuf.c8
-rw-r--r--src/nsterm.m6
-rw-r--r--src/print.c5
-rw-r--r--src/textprop.c2
-rw-r--r--src/w32fns.c16
-rw-r--r--src/w32menu.c2
-rw-r--r--src/w32term.c30
-rw-r--r--src/window.c1203
-rw-r--r--src/window.h142
-rw-r--r--src/xdisp.c660
-rw-r--r--src/xfaces.c12
-rw-r--r--src/xfns.c18
-rw-r--r--src/xmenu.c2
-rw-r--r--src/xterm.c42
32 files changed, 1347 insertions, 1292 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 6c4e57e6905..c82dfd6060b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,14 @@
12012-08-01 Dmitry Antipov <dmantipov@yandex.ru>
2
3 Use INTERNAL_FIELD for windows.
4 * window.h (WVAR): New macro.
5 (struct window): Change Lisp_Object members to INTERNAL_FIELD.
6 * alloc.c, buffer.c, composite.c, dispextern.h, dispnew.c, editfns.c:
7 * fileio.c, font.c, fontset.c, frame.c, frame.h, fringe.c, indent.c:
8 * insdel.c, keyboard.c, keymap.c, lisp.h, minibuf.c, nsterm.m, print.c:
9 * textprop.c, w32fns.c, w32menu.c, w32term.c, window.c, xdisp.c:
10 * xfaces.c, xfns.c, xmenu.c, xterm.c: Users changed.
11
12012-08-01 Paul Eggert <eggert@cs.ucla.edu> 122012-08-01 Paul Eggert <eggert@cs.ucla.edu>
2 13
3 * coding.h (CODING_ATTR_FLUSHING): Remove; unused and wouldn't work. 14 * coding.h (CODING_ATTR_FLUSHING): Remove; unused and wouldn't work.
@@ -63,9 +74,9 @@
63 (KVAR): Change to use INTERNAL_FIELD. 74 (KVAR): Change to use INTERNAL_FIELD.
64 * frame.h (FVAR): New macro. 75 * frame.h (FVAR): New macro.
65 (struct frame): Use INTERNAL_FIELD for all Lisp_Object fields. 76 (struct frame): Use INTERNAL_FIELD for all Lisp_Object fields.
66 * alloc.c, buffer.c, data.c, dispnew.c, dosfns.c, eval.c, frame.c 77 * alloc.c, buffer.c, data.c, dispnew.c, dosfns.c, eval.c, frame.c:
67 * fringe.c, gtkutil.c, minibuf.c, nsfns.m, nsterm.m, print.c 78 * fringe.c, gtkutil.c, minibuf.c, nsfns.m, nsterm.m, print.c:
68 * term.c, w32fns.c, w32menu.c, w32term.c, window.c, window.h, 79 * term.c, w32fns.c, w32menu.c, w32term.c, window.c, window.h:
69 * xdisp.c, xfaces.c, xfns.c, xmenu.c, xterm.c: Users changed. 80 * xdisp.c, xfaces.c, xfns.c, xmenu.c, xterm.c: Users changed.
70 81
712012-07-31 Dmitry Antipov <dmantipov@yandex.ru> 822012-07-31 Dmitry Antipov <dmantipov@yandex.ru>
diff --git a/src/alloc.c b/src/alloc.c
index f04f3c05134..d824a6a491e 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -6020,7 +6020,8 @@ mark_object (Lisp_Object arg)
6020 /* Mark glyphs for leaf windows. Marking window 6020 /* Mark glyphs for leaf windows. Marking window
6021 matrices is sufficient because frame matrices 6021 matrices is sufficient because frame matrices
6022 use the same glyph memory. */ 6022 use the same glyph memory. */
6023 if (NILP (w->hchild) && NILP (w->vchild) && w->current_matrix) 6023 if (NILP (WVAR (w, hchild)) && NILP (WVAR (w, vchild))
6024 && w->current_matrix)
6024 { 6025 {
6025 mark_glyph_matrix (w->current_matrix); 6026 mark_glyph_matrix (w->current_matrix);
6026 mark_glyph_matrix (w->desired_matrix); 6027 mark_glyph_matrix (w->desired_matrix);
diff --git a/src/buffer.c b/src/buffer.c
index 4168fa8f027..e70360f5173 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1557,7 +1557,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1557 since anything can happen within do_yes_or_no_p. */ 1557 since anything can happen within do_yes_or_no_p. */
1558 1558
1559 /* Don't kill the minibuffer now current. */ 1559 /* Don't kill the minibuffer now current. */
1560 if (EQ (buffer, XWINDOW (minibuf_window)->buffer)) 1560 if (EQ (buffer, WVAR (XWINDOW (minibuf_window), buffer)))
1561 return Qnil; 1561 return Qnil;
1562 1562
1563 /* When we kill an ordinary buffer which shares it's buffer text 1563 /* When we kill an ordinary buffer which shares it's buffer text
@@ -1608,7 +1608,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1608 /* If the buffer now current is shown in the minibuffer and our buffer 1608 /* If the buffer now current is shown in the minibuffer and our buffer
1609 is the sole other buffer give up. */ 1609 is the sole other buffer give up. */
1610 XSETBUFFER (tem, current_buffer); 1610 XSETBUFFER (tem, current_buffer);
1611 if (EQ (tem, XWINDOW (minibuf_window)->buffer) 1611 if (EQ (tem, WVAR (XWINDOW (minibuf_window), buffer))
1612 && EQ (buffer, Fother_buffer (buffer, Qnil, Qnil))) 1612 && EQ (buffer, Fother_buffer (buffer, Qnil, Qnil)))
1613 return Qnil; 1613 return Qnil;
1614 1614
@@ -2190,12 +2190,13 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
2190 while (NILP (Fmemq (w, ws))) 2190 while (NILP (Fmemq (w, ws)))
2191 { 2191 {
2192 ws = Fcons (w, ws); 2192 ws = Fcons (w, ws);
2193 if (MARKERP (XWINDOW (w)->pointm) 2193 if (MARKERP (WVAR (XWINDOW (w), pointm))
2194 && (EQ (XWINDOW (w)->buffer, buf1) 2194 && (EQ (WVAR (XWINDOW (w), buffer), buf1)
2195 || EQ (XWINDOW (w)->buffer, buf2))) 2195 || EQ (WVAR (XWINDOW (w), buffer), buf2)))
2196 Fset_marker (XWINDOW (w)->pointm, 2196 Fset_marker (WVAR (XWINDOW (w), pointm),
2197 make_number (BUF_BEGV (XBUFFER (XWINDOW (w)->buffer))), 2197 make_number
2198 XWINDOW (w)->buffer); 2198 (BUF_BEGV (XBUFFER (WVAR (XWINDOW (w), buffer)))),
2199 WVAR (XWINDOW (w), buffer));
2199 w = Fnext_window (w, Qt, Qt); 2200 w = Fnext_window (w, Qt, Qt);
2200 } 2201 }
2201 } 2202 }
@@ -3671,7 +3672,7 @@ modify_overlay (struct buffer *buf, ptrdiff_t start, ptrdiff_t end)
3671 3672
3672 /* If this is a buffer not in the selected window, 3673 /* If this is a buffer not in the selected window,
3673 we must do other windows. */ 3674 we must do other windows. */
3674 if (buf != XBUFFER (XWINDOW (selected_window)->buffer)) 3675 if (buf != XBUFFER (WVAR (XWINDOW (selected_window), buffer)))
3675 windows_or_buffers_changed = 1; 3676 windows_or_buffers_changed = 1;
3676 /* If multiple windows show this buffer, we must do other windows. */ 3677 /* If multiple windows show this buffer, we must do other windows. */
3677 else if (buffer_shared > 1) 3678 else if (buffer_shared > 1)
diff --git a/src/composite.c b/src/composite.c
index 62ab3d04948..485e51467ca 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -906,7 +906,7 @@ static Lisp_Object
906autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t limit, struct window *win, struct face *face, Lisp_Object string) 906autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t limit, struct window *win, struct face *face, Lisp_Object string)
907{ 907{
908 ptrdiff_t count = SPECPDL_INDEX (); 908 ptrdiff_t count = SPECPDL_INDEX ();
909 FRAME_PTR f = XFRAME (win->frame); 909 FRAME_PTR f = XFRAME (WVAR (win, frame));
910 Lisp_Object pos = make_number (charpos); 910 Lisp_Object pos = make_number (charpos);
911 ptrdiff_t to; 911 ptrdiff_t to;
912 ptrdiff_t pt = PT, pt_byte = PT_BYTE; 912 ptrdiff_t pt = PT, pt_byte = PT_BYTE;
@@ -942,7 +942,7 @@ autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t
942 } 942 }
943 else 943 else
944#endif /* not HAVE_WINDOW_SYSTEM */ 944#endif /* not HAVE_WINDOW_SYSTEM */
945 font_object = win->frame; 945 font_object = WVAR (win, frame);
946 lgstring = Fcomposition_get_gstring (pos, make_number (to), font_object, 946 lgstring = Fcomposition_get_gstring (pos, make_number (to), font_object,
947 string); 947 string);
948 if (NILP (LGSTRING_ID (lgstring))) 948 if (NILP (LGSTRING_ID (lgstring)))
diff --git a/src/dispextern.h b/src/dispextern.h
index 5bdf943466b..add228e0088 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1374,7 +1374,7 @@ struct glyph_string
1374 ? current_mode_line_height \ 1374 ? current_mode_line_height \
1375 : (MATRIX_MODE_LINE_HEIGHT ((W)->current_matrix) \ 1375 : (MATRIX_MODE_LINE_HEIGHT ((W)->current_matrix) \
1376 ? MATRIX_MODE_LINE_HEIGHT ((W)->current_matrix) \ 1376 ? MATRIX_MODE_LINE_HEIGHT ((W)->current_matrix) \
1377 : estimate_mode_line_height (XFRAME ((W)->frame), \ 1377 : estimate_mode_line_height (XFRAME (WVAR (W, frame)), \
1378 CURRENT_MODE_LINE_FACE_ID (W)))) 1378 CURRENT_MODE_LINE_FACE_ID (W))))
1379 1379
1380/* Return the current height of the header line of window W. If not 1380/* Return the current height of the header line of window W. If not
@@ -1387,7 +1387,7 @@ struct glyph_string
1387 ? current_header_line_height \ 1387 ? current_header_line_height \
1388 : (MATRIX_HEADER_LINE_HEIGHT ((W)->current_matrix) \ 1388 : (MATRIX_HEADER_LINE_HEIGHT ((W)->current_matrix) \
1389 ? MATRIX_HEADER_LINE_HEIGHT ((W)->current_matrix) \ 1389 ? MATRIX_HEADER_LINE_HEIGHT ((W)->current_matrix) \
1390 : estimate_mode_line_height (XFRAME ((W)->frame), \ 1390 : estimate_mode_line_height (XFRAME (WVAR (W, frame)),\
1391 HEADER_LINE_FACE_ID))) 1391 HEADER_LINE_FACE_ID)))
1392 1392
1393/* Return the height of the desired mode line of window W. */ 1393/* Return the height of the desired mode line of window W. */
@@ -1406,8 +1406,8 @@ struct glyph_string
1406 (!MINI_WINDOW_P ((W)) \ 1406 (!MINI_WINDOW_P ((W)) \
1407 && !(W)->pseudo_window_p \ 1407 && !(W)->pseudo_window_p \
1408 && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \ 1408 && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \
1409 && BUFFERP ((W)->buffer) \ 1409 && BUFFERP (WVAR (W, buffer)) \
1410 && !NILP (BVAR (XBUFFER ((W)->buffer), mode_line_format)) \ 1410 && !NILP (BVAR (XBUFFER (WVAR (W, buffer)), mode_line_format)) \
1411 && WINDOW_TOTAL_LINES (W) > 1) 1411 && WINDOW_TOTAL_LINES (W) > 1)
1412 1412
1413/* Value is non-zero if window W wants a header line. */ 1413/* Value is non-zero if window W wants a header line. */
@@ -1416,9 +1416,10 @@ struct glyph_string
1416 (!MINI_WINDOW_P ((W)) \ 1416 (!MINI_WINDOW_P ((W)) \
1417 && !(W)->pseudo_window_p \ 1417 && !(W)->pseudo_window_p \
1418 && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \ 1418 && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \
1419 && BUFFERP ((W)->buffer) \ 1419 && BUFFERP (WVAR (W, buffer)) \
1420 && !NILP (BVAR (XBUFFER ((W)->buffer), header_line_format)) \ 1420 && !NILP (BVAR (XBUFFER (WVAR (W, buffer)), header_line_format)) \
1421 && WINDOW_TOTAL_LINES (W) > 1 + !NILP (BVAR (XBUFFER ((W)->buffer), mode_line_format))) 1421 && WINDOW_TOTAL_LINES (W) > 1 \
1422 + !NILP (BVAR (XBUFFER (WVAR (W, buffer)), mode_line_format)))
1422 1423
1423 1424
1424/* Return proper value to be used as baseline offset of font that has 1425/* Return proper value to be used as baseline offset of font that has
diff --git a/src/dispnew.c b/src/dispnew.c
index af3e0981d5c..f6b5e426071 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -265,9 +265,9 @@ add_window_display_history (struct window *w, const char *msg, int paused_p)
265 "%"pMu": window %p (`%s')%s\n%s", 265 "%"pMu": window %p (`%s')%s\n%s",
266 history_tick++, 266 history_tick++,
267 w, 267 w,
268 ((BUFFERP (w->buffer) 268 ((BUFFERP (WVAR (w, buffer))
269 && STRINGP (BVAR (XBUFFER (w->buffer), name))) 269 && STRINGP (BVAR (XBUFFER (WVAR (w, buffer)), name)))
270 ? SSDATA (BVAR (XBUFFER (w->buffer), name)) 270 ? SSDATA (BVAR (XBUFFER (WVAR (w, buffer)), name))
271 : "???"), 271 : "???"),
272 paused_p ? " ***paused***" : "", 272 paused_p ? " ***paused***" : "",
273 msg); 273 msg);
@@ -405,7 +405,7 @@ margin_glyphs_to_reserve (struct window *w, int total_glyphs, Lisp_Object margin
405 405
406 if (NUMBERP (margin)) 406 if (NUMBERP (margin))
407 { 407 {
408 int width = XFASTINT (w->total_cols); 408 int width = XFASTINT (WVAR (w, total_cols));
409 double d = max (0, XFLOATINT (margin)); 409 double d = max (0, XFLOATINT (margin));
410 d = min (width / 2 - 1, d); 410 d = min (width / 2 - 1, d);
411 n = (int) ((double) total_glyphs / width * d); 411 n = (int) ((double) total_glyphs / width * d);
@@ -475,8 +475,8 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y
475 the matrix means preventing redisplay. */ 475 the matrix means preventing redisplay. */
476 if (matrix->pool == NULL) 476 if (matrix->pool == NULL)
477 { 477 {
478 left = margin_glyphs_to_reserve (w, dim.width, w->left_margin_cols); 478 left = margin_glyphs_to_reserve (w, dim.width, WVAR (w, left_margin_cols));
479 right = margin_glyphs_to_reserve (w, dim.width, w->right_margin_cols); 479 right = margin_glyphs_to_reserve (w, dim.width, WVAR (w, right_margin_cols));
480 eassert (left >= 0 && right >= 0); 480 eassert (left >= 0 && right >= 0);
481 marginal_areas_changed_p = (left != matrix->left_margin_glyphs 481 marginal_areas_changed_p = (left != matrix->left_margin_glyphs
482 || right != matrix->right_margin_glyphs); 482 || right != matrix->right_margin_glyphs);
@@ -515,9 +515,9 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y
515 if (w) 515 if (w)
516 { 516 {
517 left = margin_glyphs_to_reserve (w, dim.width, 517 left = margin_glyphs_to_reserve (w, dim.width,
518 w->left_margin_cols); 518 WVAR (w, left_margin_cols));
519 right = margin_glyphs_to_reserve (w, dim.width, 519 right = margin_glyphs_to_reserve (w, dim.width,
520 w->right_margin_cols); 520 WVAR (w, right_margin_cols));
521 } 521 }
522 else 522 else
523 left = right = 0; 523 left = right = 0;
@@ -640,9 +640,9 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y
640 640
641 /* Window end is invalid, if inside of the rows that 641 /* Window end is invalid, if inside of the rows that
642 are invalidated below. */ 642 are invalidated below. */
643 if (INTEGERP (w->window_end_vpos) 643 if (INTEGERP (WVAR (w, window_end_vpos))
644 && XFASTINT (w->window_end_vpos) >= i) 644 && XFASTINT (WVAR (w, window_end_vpos)) >= i)
645 w->window_end_valid = Qnil; 645 WVAR (w, window_end_valid) = Qnil;
646 646
647 while (i < matrix->nrows) 647 while (i < matrix->nrows)
648 matrix->rows[i++].enabled_p = 0; 648 matrix->rows[i++].enabled_p = 0;
@@ -882,15 +882,15 @@ clear_window_matrices (struct window *w, int desired_p)
882{ 882{
883 while (w) 883 while (w)
884 { 884 {
885 if (!NILP (w->hchild)) 885 if (!NILP (WVAR (w, hchild)))
886 { 886 {
887 eassert (WINDOWP (w->hchild)); 887 eassert (WINDOWP (WVAR (w, hchild)));
888 clear_window_matrices (XWINDOW (w->hchild), desired_p); 888 clear_window_matrices (XWINDOW (WVAR (w, hchild)), desired_p);
889 } 889 }
890 else if (!NILP (w->vchild)) 890 else if (!NILP (WVAR (w, vchild)))
891 { 891 {
892 eassert (WINDOWP (w->vchild)); 892 eassert (WINDOWP (WVAR (w, vchild)));
893 clear_window_matrices (XWINDOW (w->vchild), desired_p); 893 clear_window_matrices (XWINDOW (WVAR (w, vchild)), desired_p);
894 } 894 }
895 else 895 else
896 { 896 {
@@ -899,11 +899,11 @@ clear_window_matrices (struct window *w, int desired_p)
899 else 899 else
900 { 900 {
901 clear_glyph_matrix (w->current_matrix); 901 clear_glyph_matrix (w->current_matrix);
902 w->window_end_valid = Qnil; 902 WVAR (w, window_end_valid) = Qnil;
903 } 903 }
904 } 904 }
905 905
906 w = NILP (w->next) ? 0 : XWINDOW (w->next); 906 w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next));
907 } 907 }
908} 908}
909 909
@@ -967,7 +967,7 @@ blank_row (struct window *w, struct glyph_row *row, int y)
967 clear_glyph_row (row); 967 clear_glyph_row (row);
968 row->y = y; 968 row->y = y;
969 row->ascent = row->phys_ascent = 0; 969 row->ascent = row->phys_ascent = 0;
970 row->height = row->phys_height = FRAME_LINE_HEIGHT (XFRAME (w->frame)); 970 row->height = row->phys_height = FRAME_LINE_HEIGHT (XFRAME (WVAR (w, frame)));
971 row->visible_height = row->height; 971 row->visible_height = row->height;
972 972
973 if (row->y < min_y) 973 if (row->y < min_y)
@@ -1513,7 +1513,7 @@ check_matrix_invariants (struct window *w)
1513 struct glyph_row *row = matrix->rows; 1513 struct glyph_row *row = matrix->rows;
1514 struct glyph_row *last_text_row = NULL; 1514 struct glyph_row *last_text_row = NULL;
1515 struct buffer *saved = current_buffer; 1515 struct buffer *saved = current_buffer;
1516 struct buffer *buffer = XBUFFER (w->buffer); 1516 struct buffer *buffer = XBUFFER (WVAR (w, buffer));
1517 int c; 1517 int c;
1518 1518
1519 /* This can sometimes happen for a fresh window. */ 1519 /* This can sometimes happen for a fresh window. */
@@ -1676,8 +1676,8 @@ allocate_matrices_for_frame_redisplay (Lisp_Object window, int x, int y,
1676 points to the mini-buffer window, if any, which is arranged 1676 points to the mini-buffer window, if any, which is arranged
1677 vertically below other windows. */ 1677 vertically below other windows. */
1678 in_horz_combination_p 1678 in_horz_combination_p
1679 = (!NILP (XWINDOW (window)->parent) 1679 = (!NILP (WVAR (XWINDOW (window), parent))
1680 && !NILP (XWINDOW (XWINDOW (window)->parent)->hchild)); 1680 && !NILP (WVAR (XWINDOW (WVAR (XWINDOW (window), parent)), hchild)));
1681 1681
1682 /* For WINDOW and all windows on the same level. */ 1682 /* For WINDOW and all windows on the same level. */
1683 do 1683 do
@@ -1686,12 +1686,12 @@ allocate_matrices_for_frame_redisplay (Lisp_Object window, int x, int y,
1686 1686
1687 /* Get the dimension of the window sub-matrix for W, depending 1687 /* Get the dimension of the window sub-matrix for W, depending
1688 on whether this is a combination or a leaf window. */ 1688 on whether this is a combination or a leaf window. */
1689 if (!NILP (w->hchild)) 1689 if (!NILP (WVAR (w, hchild)))
1690 dim = allocate_matrices_for_frame_redisplay (w->hchild, x, y, 1690 dim = allocate_matrices_for_frame_redisplay (WVAR (w, hchild), x, y,
1691 dim_only_p, 1691 dim_only_p,
1692 window_change_flags); 1692 window_change_flags);
1693 else if (!NILP (w->vchild)) 1693 else if (!NILP (WVAR (w, vchild)))
1694 dim = allocate_matrices_for_frame_redisplay (w->vchild, x, y, 1694 dim = allocate_matrices_for_frame_redisplay (WVAR (w, vchild), x, y,
1695 dim_only_p, 1695 dim_only_p,
1696 window_change_flags); 1696 window_change_flags);
1697 else 1697 else
@@ -1715,10 +1715,10 @@ allocate_matrices_for_frame_redisplay (Lisp_Object window, int x, int y,
1715 || dim.width != w->desired_matrix->matrix_w 1715 || dim.width != w->desired_matrix->matrix_w
1716 || dim.height != w->desired_matrix->matrix_h 1716 || dim.height != w->desired_matrix->matrix_h
1717 || (margin_glyphs_to_reserve (w, dim.width, 1717 || (margin_glyphs_to_reserve (w, dim.width,
1718 w->left_margin_cols) 1718 WVAR (w, left_margin_cols))
1719 != w->desired_matrix->left_margin_glyphs) 1719 != w->desired_matrix->left_margin_glyphs)
1720 || (margin_glyphs_to_reserve (w, dim.width, 1720 || (margin_glyphs_to_reserve (w, dim.width,
1721 w->right_margin_cols) 1721 WVAR (w, right_margin_cols))
1722 != w->desired_matrix->right_margin_glyphs)) 1722 != w->desired_matrix->right_margin_glyphs))
1723 *window_change_flags |= CHANGED_LEAF_MATRIX; 1723 *window_change_flags |= CHANGED_LEAF_MATRIX;
1724 1724
@@ -1747,7 +1747,7 @@ allocate_matrices_for_frame_redisplay (Lisp_Object window, int x, int y,
1747 hmax = max (hmax, dim.height); 1747 hmax = max (hmax, dim.height);
1748 1748
1749 /* Next window on same level. */ 1749 /* Next window on same level. */
1750 window = w->next; 1750 window = WVAR (w, next);
1751 } 1751 }
1752 while (!NILP (window)); 1752 while (!NILP (window));
1753 1753
@@ -1778,7 +1778,7 @@ static int
1778required_matrix_height (struct window *w) 1778required_matrix_height (struct window *w)
1779{ 1779{
1780#ifdef HAVE_WINDOW_SYSTEM 1780#ifdef HAVE_WINDOW_SYSTEM
1781 struct frame *f = XFRAME (w->frame); 1781 struct frame *f = XFRAME (WVAR (w, frame));
1782 1782
1783 if (FRAME_WINDOW_P (f)) 1783 if (FRAME_WINDOW_P (f))
1784 { 1784 {
@@ -1804,7 +1804,7 @@ static int
1804required_matrix_width (struct window *w) 1804required_matrix_width (struct window *w)
1805{ 1805{
1806#ifdef HAVE_WINDOW_SYSTEM 1806#ifdef HAVE_WINDOW_SYSTEM
1807 struct frame *f = XFRAME (w->frame); 1807 struct frame *f = XFRAME (WVAR (w, frame));
1808 if (FRAME_WINDOW_P (f)) 1808 if (FRAME_WINDOW_P (f))
1809 { 1809 {
1810 int ch_width = FRAME_SMALLEST_CHAR_WIDTH (f); 1810 int ch_width = FRAME_SMALLEST_CHAR_WIDTH (f);
@@ -1821,7 +1821,7 @@ required_matrix_width (struct window *w)
1821 } 1821 }
1822#endif /* HAVE_WINDOW_SYSTEM */ 1822#endif /* HAVE_WINDOW_SYSTEM */
1823 1823
1824 return XINT (w->total_cols); 1824 return XINT (WVAR (w, total_cols));
1825} 1825}
1826 1826
1827 1827
@@ -1833,10 +1833,10 @@ allocate_matrices_for_window_redisplay (struct window *w)
1833{ 1833{
1834 while (w) 1834 while (w)
1835 { 1835 {
1836 if (!NILP (w->vchild)) 1836 if (!NILP (WVAR (w, vchild)))
1837 allocate_matrices_for_window_redisplay (XWINDOW (w->vchild)); 1837 allocate_matrices_for_window_redisplay (XWINDOW (WVAR (w, vchild)));
1838 else if (!NILP (w->hchild)) 1838 else if (!NILP (WVAR (w, hchild)))
1839 allocate_matrices_for_window_redisplay (XWINDOW (w->hchild)); 1839 allocate_matrices_for_window_redisplay (XWINDOW (WVAR (w, hchild)));
1840 else 1840 else
1841 { 1841 {
1842 /* W is a leaf window. */ 1842 /* W is a leaf window. */
@@ -1855,7 +1855,7 @@ allocate_matrices_for_window_redisplay (struct window *w)
1855 adjust_glyph_matrix (w, w->current_matrix, 0, 0, dim); 1855 adjust_glyph_matrix (w, w->current_matrix, 0, 0, dim);
1856 } 1856 }
1857 1857
1858 w = NILP (w->next) ? NULL : XWINDOW (w->next); 1858 w = NILP (WVAR (w, next)) ? NULL : XWINDOW (WVAR (w, next));
1859 } 1859 }
1860} 1860}
1861 1861
@@ -1902,20 +1902,20 @@ adjust_frame_glyphs_initially (void)
1902{ 1902{
1903 struct frame *sf = SELECTED_FRAME (); 1903 struct frame *sf = SELECTED_FRAME ();
1904 struct window *root = XWINDOW (FVAR (sf, root_window)); 1904 struct window *root = XWINDOW (FVAR (sf, root_window));
1905 struct window *mini = XWINDOW (root->next); 1905 struct window *mini = XWINDOW (WVAR (root, next));
1906 int frame_lines = FRAME_LINES (sf); 1906 int frame_lines = FRAME_LINES (sf);
1907 int frame_cols = FRAME_COLS (sf); 1907 int frame_cols = FRAME_COLS (sf);
1908 int top_margin = FRAME_TOP_MARGIN (sf); 1908 int top_margin = FRAME_TOP_MARGIN (sf);
1909 1909
1910 /* Do it for the root window. */ 1910 /* Do it for the root window. */
1911 XSETFASTINT (root->top_line, top_margin); 1911 XSETFASTINT (WVAR (root, top_line), top_margin);
1912 XSETFASTINT (root->total_lines, frame_lines - 1 - top_margin); 1912 XSETFASTINT (WVAR (root, total_lines), frame_lines - 1 - top_margin);
1913 XSETFASTINT (root->total_cols, frame_cols); 1913 XSETFASTINT (WVAR (root, total_cols), frame_cols);
1914 1914
1915 /* Do it for the mini-buffer window. */ 1915 /* Do it for the mini-buffer window. */
1916 XSETFASTINT (mini->top_line, frame_lines - 1); 1916 XSETFASTINT (WVAR (mini, top_line), frame_lines - 1);
1917 XSETFASTINT (mini->total_lines, 1); 1917 XSETFASTINT (WVAR (mini, total_lines), 1);
1918 XSETFASTINT (mini->total_cols, frame_cols); 1918 XSETFASTINT (WVAR (mini, total_cols), frame_cols);
1919 1919
1920 adjust_frame_glyphs (sf); 1920 adjust_frame_glyphs (sf);
1921 glyphs_initialized_initially_p = 1; 1921 glyphs_initialized_initially_p = 1;
@@ -1947,21 +1947,21 @@ showing_window_margins_p (struct window *w)
1947{ 1947{
1948 while (w) 1948 while (w)
1949 { 1949 {
1950 if (!NILP (w->hchild)) 1950 if (!NILP (WVAR (w, hchild)))
1951 { 1951 {
1952 if (showing_window_margins_p (XWINDOW (w->hchild))) 1952 if (showing_window_margins_p (XWINDOW (WVAR (w, hchild))))
1953 return 1; 1953 return 1;
1954 } 1954 }
1955 else if (!NILP (w->vchild)) 1955 else if (!NILP (WVAR (w, vchild)))
1956 { 1956 {
1957 if (showing_window_margins_p (XWINDOW (w->vchild))) 1957 if (showing_window_margins_p (XWINDOW (WVAR (w, vchild))))
1958 return 1; 1958 return 1;
1959 } 1959 }
1960 else if (!NILP (w->left_margin_cols) 1960 else if (!NILP (WVAR (w, left_margin_cols))
1961 || !NILP (w->right_margin_cols)) 1961 || !NILP (WVAR (w, right_margin_cols)))
1962 return 1; 1962 return 1;
1963 1963
1964 w = NILP (w->next) ? 0 : XWINDOW (w->next); 1964 w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next));
1965 } 1965 }
1966 return 0; 1966 return 0;
1967} 1967}
@@ -1975,18 +1975,18 @@ fake_current_matrices (Lisp_Object window)
1975{ 1975{
1976 struct window *w; 1976 struct window *w;
1977 1977
1978 for (; !NILP (window); window = w->next) 1978 for (; !NILP (window); window = WVAR (w, next))
1979 { 1979 {
1980 w = XWINDOW (window); 1980 w = XWINDOW (window);
1981 1981
1982 if (!NILP (w->hchild)) 1982 if (!NILP (WVAR (w, hchild)))
1983 fake_current_matrices (w->hchild); 1983 fake_current_matrices (WVAR (w, hchild));
1984 else if (!NILP (w->vchild)) 1984 else if (!NILP (WVAR (w, vchild)))
1985 fake_current_matrices (w->vchild); 1985 fake_current_matrices (WVAR (w, vchild));
1986 else 1986 else
1987 { 1987 {
1988 int i; 1988 int i;
1989 struct frame *f = XFRAME (w->frame); 1989 struct frame *f = XFRAME (WVAR (w, frame));
1990 struct glyph_matrix *m = w->current_matrix; 1990 struct glyph_matrix *m = w->current_matrix;
1991 struct glyph_matrix *fm = f->current_matrix; 1991 struct glyph_matrix *fm = f->current_matrix;
1992 1992
@@ -2188,7 +2188,7 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f)
2188 { 2188 {
2189 FVAR (f, menu_bar_window) = make_window (); 2189 FVAR (f, menu_bar_window) = make_window ();
2190 w = XWINDOW (FVAR (f, menu_bar_window)); 2190 w = XWINDOW (FVAR (f, menu_bar_window));
2191 XSETFRAME (w->frame, f); 2191 XSETFRAME (WVAR (w, frame), f);
2192 w->pseudo_window_p = 1; 2192 w->pseudo_window_p = 1;
2193 } 2193 }
2194 else 2194 else
@@ -2196,10 +2196,10 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f)
2196 2196
2197 /* Set window dimensions to frame dimensions and allocate or 2197 /* Set window dimensions to frame dimensions and allocate or
2198 adjust glyph matrices of W. */ 2198 adjust glyph matrices of W. */
2199 XSETFASTINT (w->top_line, 0); 2199 XSETFASTINT (WVAR (w, top_line), 0);
2200 XSETFASTINT (w->left_col, 0); 2200 XSETFASTINT (WVAR (w, left_col), 0);
2201 XSETFASTINT (w->total_lines, FRAME_MENU_BAR_LINES (f)); 2201 XSETFASTINT (WVAR (w, total_lines), FRAME_MENU_BAR_LINES (f));
2202 XSETFASTINT (w->total_cols, FRAME_TOTAL_COLS (f)); 2202 XSETFASTINT (WVAR (w, total_cols), FRAME_TOTAL_COLS (f));
2203 allocate_matrices_for_window_redisplay (w); 2203 allocate_matrices_for_window_redisplay (w);
2204 } 2204 }
2205#endif /* not USE_X_TOOLKIT && not USE_GTK */ 2205#endif /* not USE_X_TOOLKIT && not USE_GTK */
@@ -2214,16 +2214,16 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f)
2214 { 2214 {
2215 FVAR (f, tool_bar_window) = make_window (); 2215 FVAR (f, tool_bar_window) = make_window ();
2216 w = XWINDOW (FVAR (f, tool_bar_window)); 2216 w = XWINDOW (FVAR (f, tool_bar_window));
2217 XSETFRAME (w->frame, f); 2217 XSETFRAME (WVAR (w, frame), f);
2218 w->pseudo_window_p = 1; 2218 w->pseudo_window_p = 1;
2219 } 2219 }
2220 else 2220 else
2221 w = XWINDOW (FVAR (f, tool_bar_window)); 2221 w = XWINDOW (FVAR (f, tool_bar_window));
2222 2222
2223 XSETFASTINT (w->top_line, FRAME_MENU_BAR_LINES (f)); 2223 XSETFASTINT (WVAR (w, top_line), FRAME_MENU_BAR_LINES (f));
2224 XSETFASTINT (w->left_col, 0); 2224 XSETFASTINT (WVAR (w, left_col), 0);
2225 XSETFASTINT (w->total_lines, FRAME_TOOL_BAR_LINES (f)); 2225 XSETFASTINT (WVAR (w, total_lines), FRAME_TOOL_BAR_LINES (f));
2226 XSETFASTINT (w->total_cols, FRAME_TOTAL_COLS (f)); 2226 XSETFASTINT (WVAR (w, total_cols), FRAME_TOTAL_COLS (f));
2227 allocate_matrices_for_window_redisplay (w); 2227 allocate_matrices_for_window_redisplay (w);
2228 } 2228 }
2229#endif 2229#endif
@@ -2333,10 +2333,10 @@ free_window_matrices (struct window *w)
2333{ 2333{
2334 while (w) 2334 while (w)
2335 { 2335 {
2336 if (!NILP (w->hchild)) 2336 if (!NILP (WVAR (w, hchild)))
2337 free_window_matrices (XWINDOW (w->hchild)); 2337 free_window_matrices (XWINDOW (WVAR (w, hchild)));
2338 else if (!NILP (w->vchild)) 2338 else if (!NILP (WVAR (w, vchild)))
2339 free_window_matrices (XWINDOW (w->vchild)); 2339 free_window_matrices (XWINDOW (WVAR (w, vchild)));
2340 else 2340 else
2341 { 2341 {
2342 /* This is a leaf window. Free its memory and reset fields 2342 /* This is a leaf window. Free its memory and reset fields
@@ -2348,7 +2348,7 @@ free_window_matrices (struct window *w)
2348 } 2348 }
2349 2349
2350 /* Next window on same level. */ 2350 /* Next window on same level. */
2351 w = NILP (w->next) ? 0 : XWINDOW (w->next); 2351 w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next));
2352 } 2352 }
2353} 2353}
2354 2354
@@ -2469,14 +2469,14 @@ build_frame_matrix_from_window_tree (struct glyph_matrix *matrix, struct window
2469{ 2469{
2470 while (w) 2470 while (w)
2471 { 2471 {
2472 if (!NILP (w->hchild)) 2472 if (!NILP (WVAR (w, hchild)))
2473 build_frame_matrix_from_window_tree (matrix, XWINDOW (w->hchild)); 2473 build_frame_matrix_from_window_tree (matrix, XWINDOW (WVAR (w, hchild)));
2474 else if (!NILP (w->vchild)) 2474 else if (!NILP (WVAR (w, vchild)))
2475 build_frame_matrix_from_window_tree (matrix, XWINDOW (w->vchild)); 2475 build_frame_matrix_from_window_tree (matrix, XWINDOW (WVAR (w, vchild)));
2476 else 2476 else
2477 build_frame_matrix_from_leaf_window (matrix, w); 2477 build_frame_matrix_from_leaf_window (matrix, w);
2478 2478
2479 w = NILP (w->next) ? 0 : XWINDOW (w->next); 2479 w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next));
2480 } 2480 }
2481} 2481}
2482 2482
@@ -2615,7 +2615,7 @@ spec_glyph_lookup_face (struct window *w, GLYPH *glyph)
2615 /* Convert the glyph's specified face to a realized (cache) face. */ 2615 /* Convert the glyph's specified face to a realized (cache) face. */
2616 if (lface_id > 0) 2616 if (lface_id > 0)
2617 { 2617 {
2618 int face_id = merge_faces (XFRAME (w->frame), 2618 int face_id = merge_faces (XFRAME (WVAR (w, frame)),
2619 Qt, lface_id, DEFAULT_FACE_ID); 2619 Qt, lface_id, DEFAULT_FACE_ID);
2620 SET_GLYPH_FACE (*glyph, face_id); 2620 SET_GLYPH_FACE (*glyph, face_id);
2621 } 2621 }
@@ -2736,10 +2736,10 @@ mirror_make_current (struct window *w, int frame_row)
2736{ 2736{
2737 while (w) 2737 while (w)
2738 { 2738 {
2739 if (!NILP (w->hchild)) 2739 if (!NILP (WVAR (w, hchild)))
2740 mirror_make_current (XWINDOW (w->hchild), frame_row); 2740 mirror_make_current (XWINDOW (WVAR (w, hchild)), frame_row);
2741 else if (!NILP (w->vchild)) 2741 else if (!NILP (WVAR (w, vchild)))
2742 mirror_make_current (XWINDOW (w->vchild), frame_row); 2742 mirror_make_current (XWINDOW (WVAR (w, vchild)), frame_row);
2743 else 2743 else
2744 { 2744 {
2745 /* Row relative to window W. Don't use FRAME_TO_WINDOW_VPOS 2745 /* Row relative to window W. Don't use FRAME_TO_WINDOW_VPOS
@@ -2772,7 +2772,7 @@ mirror_make_current (struct window *w, int frame_row)
2772 } 2772 }
2773 } 2773 }
2774 2774
2775 w = NILP (w->next) ? 0 : XWINDOW (w->next); 2775 w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next));
2776 } 2776 }
2777} 2777}
2778 2778
@@ -2831,16 +2831,16 @@ mirrored_line_dance (struct glyph_matrix *matrix, int unchanged_at_top, int nlin
2831static void 2831static void
2832sync_window_with_frame_matrix_rows (struct window *w) 2832sync_window_with_frame_matrix_rows (struct window *w)
2833{ 2833{
2834 struct frame *f = XFRAME (w->frame); 2834 struct frame *f = XFRAME (WVAR (w, frame));
2835 struct glyph_row *window_row, *window_row_end, *frame_row; 2835 struct glyph_row *window_row, *window_row_end, *frame_row;
2836 int left, right, x, width; 2836 int left, right, x, width;
2837 2837
2838 /* Preconditions: W must be a leaf window on a tty frame. */ 2838 /* Preconditions: W must be a leaf window on a tty frame. */
2839 eassert (NILP (w->hchild) && NILP (w->vchild)); 2839 eassert (NILP (WVAR (w, hchild)) && NILP (WVAR (w, vchild)));
2840 eassert (!FRAME_WINDOW_P (f)); 2840 eassert (!FRAME_WINDOW_P (f));
2841 2841
2842 left = margin_glyphs_to_reserve (w, 1, w->left_margin_cols); 2842 left = margin_glyphs_to_reserve (w, 1, WVAR (w, left_margin_cols));
2843 right = margin_glyphs_to_reserve (w, 1, w->right_margin_cols); 2843 right = margin_glyphs_to_reserve (w, 1, WVAR (w, right_margin_cols));
2844 x = w->current_matrix->matrix_x; 2844 x = w->current_matrix->matrix_x;
2845 width = w->current_matrix->matrix_w; 2845 width = w->current_matrix->matrix_w;
2846 2846
@@ -2872,15 +2872,15 @@ frame_row_to_window (struct window *w, int row)
2872 2872
2873 while (w && !found) 2873 while (w && !found)
2874 { 2874 {
2875 if (!NILP (w->hchild)) 2875 if (!NILP (WVAR (w, hchild)))
2876 found = frame_row_to_window (XWINDOW (w->hchild), row); 2876 found = frame_row_to_window (XWINDOW (WVAR (w, hchild)), row);
2877 else if (!NILP (w->vchild)) 2877 else if (!NILP (WVAR (w, vchild)))
2878 found = frame_row_to_window (XWINDOW (w->vchild), row); 2878 found = frame_row_to_window (XWINDOW (WVAR (w, vchild)), row);
2879 else if (row >= WINDOW_TOP_EDGE_LINE (w) 2879 else if (row >= WINDOW_TOP_EDGE_LINE (w)
2880 && row < WINDOW_BOTTOM_EDGE_LINE (w)) 2880 && row < WINDOW_BOTTOM_EDGE_LINE (w))
2881 found = w; 2881 found = w;
2882 2882
2883 w = NILP (w->next) ? 0 : XWINDOW (w->next); 2883 w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next));
2884 } 2884 }
2885 2885
2886 return found; 2886 return found;
@@ -2903,11 +2903,11 @@ mirror_line_dance (struct window *w, int unchanged_at_top, int nlines, int *copy
2903{ 2903{
2904 while (w) 2904 while (w)
2905 { 2905 {
2906 if (!NILP (w->hchild)) 2906 if (!NILP (WVAR (w, hchild)))
2907 mirror_line_dance (XWINDOW (w->hchild), unchanged_at_top, 2907 mirror_line_dance (XWINDOW (WVAR (w, hchild)), unchanged_at_top,
2908 nlines, copy_from, retained_p); 2908 nlines, copy_from, retained_p);
2909 else if (!NILP (w->vchild)) 2909 else if (!NILP (WVAR (w, vchild)))
2910 mirror_line_dance (XWINDOW (w->vchild), unchanged_at_top, 2910 mirror_line_dance (XWINDOW (WVAR (w, vchild)), unchanged_at_top,
2911 nlines, copy_from, retained_p); 2911 nlines, copy_from, retained_p);
2912 else 2912 else
2913 { 2913 {
@@ -2963,7 +2963,7 @@ mirror_line_dance (struct window *w, int unchanged_at_top, int nlines, int *copy
2963 { 2963 {
2964 /* A copy between windows. This is an infrequent 2964 /* A copy between windows. This is an infrequent
2965 case not worth optimizing. */ 2965 case not worth optimizing. */
2966 struct frame *f = XFRAME (w->frame); 2966 struct frame *f = XFRAME (WVAR (w, frame));
2967 struct window *root = XWINDOW (FRAME_ROOT_WINDOW (f)); 2967 struct window *root = XWINDOW (FRAME_ROOT_WINDOW (f));
2968 struct window *w2; 2968 struct window *w2;
2969 struct glyph_matrix *m2; 2969 struct glyph_matrix *m2;
@@ -3000,7 +3000,7 @@ mirror_line_dance (struct window *w, int unchanged_at_top, int nlines, int *copy
3000 } 3000 }
3001 3001
3002 /* Next window on same level. */ 3002 /* Next window on same level. */
3003 w = NILP (w->next) ? 0 : XWINDOW (w->next); 3003 w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next));
3004 } 3004 }
3005} 3005}
3006 3006
@@ -3018,18 +3018,18 @@ check_window_matrix_pointers (struct window *w)
3018{ 3018{
3019 while (w) 3019 while (w)
3020 { 3020 {
3021 if (!NILP (w->hchild)) 3021 if (!NILP (WVAR (w, hchild)))
3022 check_window_matrix_pointers (XWINDOW (w->hchild)); 3022 check_window_matrix_pointers (XWINDOW (WVAR (w, hchild)));
3023 else if (!NILP (w->vchild)) 3023 else if (!NILP (WVAR (w, vchild)))
3024 check_window_matrix_pointers (XWINDOW (w->vchild)); 3024 check_window_matrix_pointers (XWINDOW (WVAR (w, vchild)));
3025 else 3025 else
3026 { 3026 {
3027 struct frame *f = XFRAME (w->frame); 3027 struct frame *f = XFRAME (WVAR (w, frame));
3028 check_matrix_pointers (w->desired_matrix, f->desired_matrix); 3028 check_matrix_pointers (w->desired_matrix, f->desired_matrix);
3029 check_matrix_pointers (w->current_matrix, f->current_matrix); 3029 check_matrix_pointers (w->current_matrix, f->current_matrix);
3030 } 3030 }
3031 3031
3032 w = NILP (w->next) ? 0 : XWINDOW (w->next); 3032 w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next));
3033 } 3033 }
3034} 3034}
3035 3035
@@ -3077,10 +3077,10 @@ check_matrix_pointers (struct glyph_matrix *window_matrix,
3077static int 3077static int
3078window_to_frame_vpos (struct window *w, int vpos) 3078window_to_frame_vpos (struct window *w, int vpos)
3079{ 3079{
3080 eassert (!FRAME_WINDOW_P (XFRAME (w->frame))); 3080 eassert (!FRAME_WINDOW_P (XFRAME (WVAR (w, frame))));
3081 eassert (vpos >= 0 && vpos <= w->desired_matrix->nrows); 3081 eassert (vpos >= 0 && vpos <= w->desired_matrix->nrows);
3082 vpos += WINDOW_TOP_EDGE_LINE (w); 3082 vpos += WINDOW_TOP_EDGE_LINE (w);
3083 eassert (vpos >= 0 && vpos <= FRAME_LINES (XFRAME (w->frame))); 3083 eassert (vpos >= 0 && vpos <= FRAME_LINES (XFRAME (WVAR (w, frame))));
3084 return vpos; 3084 return vpos;
3085} 3085}
3086 3086
@@ -3091,7 +3091,7 @@ window_to_frame_vpos (struct window *w, int vpos)
3091static int 3091static int
3092window_to_frame_hpos (struct window *w, int hpos) 3092window_to_frame_hpos (struct window *w, int hpos)
3093{ 3093{
3094 eassert (!FRAME_WINDOW_P (XFRAME (w->frame))); 3094 eassert (!FRAME_WINDOW_P (XFRAME (WVAR (w, frame))));
3095 hpos += WINDOW_LEFT_EDGE_COL (w); 3095 hpos += WINDOW_LEFT_EDGE_COL (w);
3096 return hpos; 3096 return hpos;
3097} 3097}
@@ -3311,14 +3311,14 @@ update_window_tree (struct window *w, int force_p)
3311 3311
3312 while (w && !paused_p) 3312 while (w && !paused_p)
3313 { 3313 {
3314 if (!NILP (w->hchild)) 3314 if (!NILP (WVAR (w, hchild)))
3315 paused_p |= update_window_tree (XWINDOW (w->hchild), force_p); 3315 paused_p |= update_window_tree (XWINDOW (WVAR (w, hchild)), force_p);
3316 else if (!NILP (w->vchild)) 3316 else if (!NILP (WVAR (w, vchild)))
3317 paused_p |= update_window_tree (XWINDOW (w->vchild), force_p); 3317 paused_p |= update_window_tree (XWINDOW (WVAR (w, vchild)), force_p);
3318 else if (w->must_be_updated_p) 3318 else if (w->must_be_updated_p)
3319 paused_p |= update_window (w, force_p); 3319 paused_p |= update_window (w, force_p);
3320 3320
3321 w = NILP (w->next) ? 0 : XWINDOW (w->next); 3321 w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next));
3322 } 3322 }
3323 3323
3324 return paused_p; 3324 return paused_p;
@@ -3806,7 +3806,7 @@ update_text_area (struct window *w, int vpos)
3806 struct glyph *glyph = &current_row->glyphs[TEXT_AREA][i - 1]; 3806 struct glyph *glyph = &current_row->glyphs[TEXT_AREA][i - 1];
3807 int left, right; 3807 int left, right;
3808 3808
3809 rif->get_glyph_overhangs (glyph, XFRAME (w->frame), 3809 rif->get_glyph_overhangs (glyph, XFRAME (WVAR (w, frame)),
3810 &left, &right); 3810 &left, &right);
3811 can_skip_p = (right == 0 && !abort_skipping); 3811 can_skip_p = (right == 0 && !abort_skipping);
3812 } 3812 }
@@ -3838,7 +3838,8 @@ update_text_area (struct window *w, int vpos)
3838 { 3838 {
3839 int left, right; 3839 int left, right;
3840 3840
3841 rif->get_glyph_overhangs (current_glyph, XFRAME (w->frame), 3841 rif->get_glyph_overhangs (current_glyph,
3842 XFRAME (WVAR (w, frame)),
3842 &left, &right); 3843 &left, &right);
3843 while (left > 0 && i > 0) 3844 while (left > 0 && i > 0)
3844 { 3845 {
@@ -3981,7 +3982,7 @@ update_window_line (struct window *w, int vpos, int *mouse_face_overwritten_p)
3981 3982
3982 /* Update display of the left margin area, if there is one. */ 3983 /* Update display of the left margin area, if there is one. */
3983 if (!desired_row->full_width_p 3984 if (!desired_row->full_width_p
3984 && !NILP (w->left_margin_cols)) 3985 && !NILP (WVAR (w, left_margin_cols)))
3985 { 3986 {
3986 changed_p = 1; 3987 changed_p = 1;
3987 update_marginal_area (w, LEFT_MARGIN_AREA, vpos); 3988 update_marginal_area (w, LEFT_MARGIN_AREA, vpos);
@@ -3997,7 +3998,7 @@ update_window_line (struct window *w, int vpos, int *mouse_face_overwritten_p)
3997 3998
3998 /* Update display of the right margin area, if there is one. */ 3999 /* Update display of the right margin area, if there is one. */
3999 if (!desired_row->full_width_p 4000 if (!desired_row->full_width_p
4000 && !NILP (w->right_margin_cols)) 4001 && !NILP (WVAR (w, right_margin_cols)))
4001 { 4002 {
4002 changed_p = 1; 4003 changed_p = 1;
4003 update_marginal_area (w, RIGHT_MARGIN_AREA, vpos); 4004 update_marginal_area (w, RIGHT_MARGIN_AREA, vpos);
@@ -4030,7 +4031,7 @@ update_window_line (struct window *w, int vpos, int *mouse_face_overwritten_p)
4030static void 4031static void
4031set_window_cursor_after_update (struct window *w) 4032set_window_cursor_after_update (struct window *w)
4032{ 4033{
4033 struct frame *f = XFRAME (w->frame); 4034 struct frame *f = XFRAME (WVAR (w, frame));
4034 struct redisplay_interface *rif = FRAME_RIF (f); 4035 struct redisplay_interface *rif = FRAME_RIF (f);
4035 int cx, cy, vpos, hpos; 4036 int cx, cy, vpos, hpos;
4036 4037
@@ -4116,14 +4117,14 @@ set_window_update_flags (struct window *w, int on_p)
4116{ 4117{
4117 while (w) 4118 while (w)
4118 { 4119 {
4119 if (!NILP (w->hchild)) 4120 if (!NILP (WVAR (w, hchild)))
4120 set_window_update_flags (XWINDOW (w->hchild), on_p); 4121 set_window_update_flags (XWINDOW (WVAR (w, hchild)), on_p);
4121 else if (!NILP (w->vchild)) 4122 else if (!NILP (WVAR (w, vchild)))
4122 set_window_update_flags (XWINDOW (w->vchild), on_p); 4123 set_window_update_flags (XWINDOW (WVAR (w, vchild)), on_p);
4123 else 4124 else
4124 w->must_be_updated_p = on_p; 4125 w->must_be_updated_p = on_p;
4125 4126
4126 w = NILP (w->next) ? 0 : XWINDOW (w->next); 4127 w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next));
4127 } 4128 }
4128} 4129}
4129 4130
@@ -4806,8 +4807,8 @@ update_frame_1 (struct frame *f, int force_p, int inhibit_id_p)
4806 int x = WINDOW_TO_FRAME_HPOS (w, w->cursor.hpos); 4807 int x = WINDOW_TO_FRAME_HPOS (w, w->cursor.hpos);
4807 int y = WINDOW_TO_FRAME_VPOS (w, w->cursor.vpos); 4808 int y = WINDOW_TO_FRAME_VPOS (w, w->cursor.vpos);
4808 4809
4809 if (INTEGERP (w->left_margin_cols)) 4810 if (INTEGERP (WVAR (w, left_margin_cols)))
4810 x += XFASTINT (w->left_margin_cols); 4811 x += XFASTINT (WVAR (w, left_margin_cols));
4811 4812
4812 /* x = max (min (x, FRAME_TOTAL_COLS (f) - 1), 0); */ 4813 /* x = max (min (x, FRAME_TOTAL_COLS (f) - 1), 0); */
4813 cursor_to (f, y, x); 4814 cursor_to (f, y, x);
@@ -5297,9 +5298,9 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p
5297 5298
5298 /* We used to set current_buffer directly here, but that does the 5299 /* We used to set current_buffer directly here, but that does the
5299 wrong thing with `face-remapping-alist' (bug#2044). */ 5300 wrong thing with `face-remapping-alist' (bug#2044). */
5300 Fset_buffer (w->buffer); 5301 Fset_buffer (WVAR (w, buffer));
5301 itdata = bidi_shelve_cache (); 5302 itdata = bidi_shelve_cache ();
5302 SET_TEXT_POS_FROM_MARKER (startp, w->start); 5303 SET_TEXT_POS_FROM_MARKER (startp, WVAR (w, start));
5303 CHARPOS (startp) = min (ZV, max (BEGV, CHARPOS (startp))); 5304 CHARPOS (startp) = min (ZV, max (BEGV, CHARPOS (startp)));
5304 BYTEPOS (startp) = min (ZV_BYTE, max (BEGV_BYTE, BYTEPOS (startp))); 5305 BYTEPOS (startp) = min (ZV_BYTE, max (BEGV_BYTE, BYTEPOS (startp)));
5305 start_display (&it, w, startp); 5306 start_display (&it, w, startp);
@@ -5343,7 +5344,7 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p
5343 *dx = x0 + it.first_visible_x - it.current_x; 5344 *dx = x0 + it.first_visible_x - it.current_x;
5344 *dy = *y - it.current_y; 5345 *dy = *y - it.current_y;
5345 5346
5346 string = w->buffer; 5347 string = WVAR (w, buffer);
5347 if (STRINGP (it.string)) 5348 if (STRINGP (it.string))
5348 string = it.string; 5349 string = it.string;
5349 *pos = it.current; 5350 *pos = it.current;
@@ -5361,7 +5362,7 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p
5361 if (STRINGP (it.string)) 5362 if (STRINGP (it.string))
5362 BYTEPOS (pos->pos) = string_char_to_byte (string, CHARPOS (pos->pos)); 5363 BYTEPOS (pos->pos) = string_char_to_byte (string, CHARPOS (pos->pos));
5363 else 5364 else
5364 BYTEPOS (pos->pos) = buf_charpos_to_bytepos (XBUFFER (w->buffer), 5365 BYTEPOS (pos->pos) = buf_charpos_to_bytepos (XBUFFER (WVAR (w, buffer)),
5365 CHARPOS (pos->pos)); 5366 CHARPOS (pos->pos));
5366 } 5367 }
5367 5368
@@ -5761,7 +5762,7 @@ change_frame_size_1 (register struct frame *f, int newheight, int newwidth, int
5761 FrameCols (FRAME_TTY (f)) = newwidth; 5762 FrameCols (FRAME_TTY (f)) = newwidth;
5762 5763
5763 if (WINDOWP (FVAR (f, tool_bar_window))) 5764 if (WINDOWP (FVAR (f, tool_bar_window)))
5764 XSETFASTINT (XWINDOW (FVAR (f, tool_bar_window))->total_cols, newwidth); 5765 XSETFASTINT (WVAR (XWINDOW (FVAR (f, tool_bar_window)), total_cols), newwidth);
5765 } 5766 }
5766 5767
5767 FRAME_LINES (f) = newheight; 5768 FRAME_LINES (f) = newheight;
diff --git a/src/editfns.c b/src/editfns.c
index dda6371369d..e657b3ec532 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -366,7 +366,7 @@ get_pos_property (Lisp_Object position, register Lisp_Object prop, Lisp_Object o
366 if (NILP (object)) 366 if (NILP (object))
367 XSETBUFFER (object, current_buffer); 367 XSETBUFFER (object, current_buffer);
368 else if (WINDOWP (object)) 368 else if (WINDOWP (object))
369 object = XWINDOW (object)->buffer; 369 object = WVAR (XWINDOW (object), buffer);
370 370
371 if (!BUFFERP (object)) 371 if (!BUFFERP (object))
372 /* pos-property only makes sense in buffers right now, since strings 372 /* pos-property only makes sense in buffers right now, since strings
@@ -821,7 +821,7 @@ This function does not move point. */)
821Lisp_Object 821Lisp_Object
822save_excursion_save (void) 822save_excursion_save (void)
823{ 823{
824 int visible = (XBUFFER (XWINDOW (selected_window)->buffer) 824 int visible = (XBUFFER (WVAR (XWINDOW (selected_window), buffer))
825 == current_buffer); 825 == current_buffer);
826 826
827 return Fcons (Fpoint_marker (), 827 return Fcons (Fpoint_marker (),
@@ -874,7 +874,7 @@ save_excursion_restore (Lisp_Object info)
874 and cleaner never to alter the window/buffer connections. */ 874 and cleaner never to alter the window/buffer connections. */
875 tem1 = Fcar (tem); 875 tem1 = Fcar (tem);
876 if (!NILP (tem1) 876 if (!NILP (tem1)
877 && current_buffer != XBUFFER (XWINDOW (selected_window)->buffer)) 877 && current_buffer != XBUFFER (WVAR (XWINDOW (selected_window), buffer)))
878 Fswitch_to_buffer (Fcurrent_buffer (), Qnil); 878 Fswitch_to_buffer (Fcurrent_buffer (), Qnil);
879#endif /* 0 */ 879#endif /* 0 */
880 880
@@ -907,7 +907,7 @@ save_excursion_restore (Lisp_Object info)
907 tem = XCDR (info); 907 tem = XCDR (info);
908 if (visible_p 908 if (visible_p
909 && !EQ (tem, selected_window) 909 && !EQ (tem, selected_window)
910 && (tem1 = XWINDOW (tem)->buffer, 910 && (tem1 = WVAR (XWINDOW (tem), buffer),
911 (/* Window is live... */ 911 (/* Window is live... */
912 BUFFERP (tem1) 912 BUFFERP (tem1)
913 /* ...and it shows the current buffer. */ 913 /* ...and it shows the current buffer. */
diff --git a/src/fileio.c b/src/fileio.c
index a13fe94e416..44710323192 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3731,7 +3731,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3731 3731
3732 /* If display currently starts at beginning of line, 3732 /* If display currently starts at beginning of line,
3733 keep it that way. */ 3733 keep it that way. */
3734 if (XBUFFER (XWINDOW (selected_window)->buffer) == current_buffer) 3734 if (XBUFFER (WVAR (XWINDOW (selected_window), buffer)) == current_buffer)
3735 XWINDOW (selected_window)->start_at_line_beg = !NILP (Fbolp ()); 3735 XWINDOW (selected_window)->start_at_line_beg = !NILP (Fbolp ());
3736 3736
3737 replace_handled = 1; 3737 replace_handled = 1;
@@ -3888,7 +3888,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3888 3888
3889 /* If display currently starts at beginning of line, 3889 /* If display currently starts at beginning of line,
3890 keep it that way. */ 3890 keep it that way. */
3891 if (XBUFFER (XWINDOW (selected_window)->buffer) == current_buffer) 3891 if (XBUFFER (WVAR (XWINDOW (selected_window), buffer)) == current_buffer)
3892 XWINDOW (selected_window)->start_at_line_beg = !NILP (Fbolp ()); 3892 XWINDOW (selected_window)->start_at_line_beg = !NILP (Fbolp ());
3893 3893
3894 /* Replace the chars that we need to replace, 3894 /* Replace the chars that we need to replace,
diff --git a/src/font.c b/src/font.c
index 2c0296aa8c5..db454dd6a23 100644
--- a/src/font.c
+++ b/src/font.c
@@ -3665,7 +3665,7 @@ font_at (int c, ptrdiff_t pos, struct face *face, struct window *w,
3665 } 3665 }
3666 } 3666 }
3667 3667
3668 f = XFRAME (w->frame); 3668 f = XFRAME (WVAR (w, frame));
3669 if (! FRAME_WINDOW_P (f)) 3669 if (! FRAME_WINDOW_P (f))
3670 return Qnil; 3670 return Qnil;
3671 if (! face) 3671 if (! face)
@@ -3723,7 +3723,7 @@ font_range (ptrdiff_t pos, ptrdiff_t *limit, struct window *w, struct face *face
3723 3723
3724 face_id = face_at_buffer_position (w, pos, 0, 0, &ignore, 3724 face_id = face_at_buffer_position (w, pos, 0, 0, &ignore,
3725 *limit, 0, -1); 3725 *limit, 0, -1);
3726 face = FACE_FROM_ID (XFRAME (w->frame), face_id); 3726 face = FACE_FROM_ID (XFRAME (WVAR (w, frame)), face_id);
3727 } 3727 }
3728 } 3728 }
3729 else 3729 else
diff --git a/src/fontset.c b/src/fontset.c
index 1efcc3ee4ec..858a2e3cd3b 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -1841,7 +1841,7 @@ DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 2, 0,
1841 if (NILP (window)) 1841 if (NILP (window))
1842 return Qnil; 1842 return Qnil;
1843 w = XWINDOW (window); 1843 w = XWINDOW (window);
1844 f = XFRAME (w->frame); 1844 f = XFRAME (WVAR (w, frame));
1845 face_id = face_at_buffer_position (w, pos, -1, -1, &dummy, 1845 face_id = face_at_buffer_position (w, pos, -1, -1, &dummy,
1846 pos + 100, 0, -1); 1846 pos + 100, 0, -1);
1847 } 1847 }
diff --git a/src/frame.c b/src/frame.c
index 9a1628e4ade..9389eccb6f2 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -132,15 +132,15 @@ set_menu_bar_lines_1 (Lisp_Object window, int n)
132 struct window *w = XWINDOW (window); 132 struct window *w = XWINDOW (window);
133 133
134 w->last_modified = 0; 134 w->last_modified = 0;
135 XSETFASTINT (w->top_line, XFASTINT (w->top_line) + n); 135 XSETFASTINT (WVAR (w, top_line), XFASTINT (WVAR (w, top_line)) + n);
136 XSETFASTINT (w->total_lines, XFASTINT (w->total_lines) - n); 136 XSETFASTINT (WVAR (w, total_lines), XFASTINT (WVAR (w, total_lines)) - n);
137 137
138 /* Handle just the top child in a vertical split. */ 138 /* Handle just the top child in a vertical split. */
139 if (!NILP (w->vchild)) 139 if (!NILP (WVAR (w, vchild)))
140 set_menu_bar_lines_1 (w->vchild, n); 140 set_menu_bar_lines_1 (WVAR (w, vchild), n);
141 141
142 /* Adjust all children in a horizontal split. */ 142 /* Adjust all children in a horizontal split. */
143 for (window = w->hchild; !NILP (window); window = w->next) 143 for (window = WVAR (w, hchild); !NILP (window); window = WVAR (w, next))
144 { 144 {
145 w = XWINDOW (window); 145 w = XWINDOW (window);
146 set_menu_bar_lines_1 (window, n); 146 set_menu_bar_lines_1 (window, n);
@@ -289,20 +289,20 @@ make_frame (int mini_p)
289 if (mini_p) 289 if (mini_p)
290 { 290 {
291 mini_window = make_window (); 291 mini_window = make_window ();
292 XWINDOW (root_window)->next = mini_window; 292 WVAR (XWINDOW (root_window), next) = mini_window;
293 XWINDOW (mini_window)->prev = root_window; 293 WVAR (XWINDOW (mini_window), prev) = root_window;
294 XWINDOW (mini_window)->mini = 1; 294 XWINDOW (mini_window)->mini = 1;
295 XWINDOW (mini_window)->frame = frame; 295 WVAR (XWINDOW (mini_window), frame) = frame;
296 FVAR (f, minibuffer_window) = mini_window; 296 FVAR (f, minibuffer_window) = mini_window;
297 } 297 }
298 else 298 else
299 { 299 {
300 mini_window = Qnil; 300 mini_window = Qnil;
301 XWINDOW (root_window)->next = Qnil; 301 WVAR (XWINDOW (root_window), next) = Qnil;
302 FVAR (f, minibuffer_window) = Qnil; 302 FVAR (f, minibuffer_window) = Qnil;
303 } 303 }
304 304
305 XWINDOW (root_window)->frame = frame; 305 WVAR (XWINDOW (root_window), frame) = frame;
306 306
307 /* 10 is arbitrary, 307 /* 10 is arbitrary,
308 just so that there is "something there." 308 just so that there is "something there."
@@ -311,21 +311,21 @@ make_frame (int mini_p)
311 SET_FRAME_COLS (f, 10); 311 SET_FRAME_COLS (f, 10);
312 FRAME_LINES (f) = 10; 312 FRAME_LINES (f) = 10;
313 313
314 XSETFASTINT (XWINDOW (root_window)->total_cols, 10); 314 XSETFASTINT (WVAR (XWINDOW (root_window), total_cols), 10);
315 XSETFASTINT (XWINDOW (root_window)->total_lines, (mini_p ? 9 : 10)); 315 XSETFASTINT (WVAR (XWINDOW (root_window), total_lines), (mini_p ? 9 : 10));
316 316
317 if (mini_p) 317 if (mini_p)
318 { 318 {
319 XSETFASTINT (XWINDOW (mini_window)->total_cols, 10); 319 XSETFASTINT (WVAR (XWINDOW (mini_window), total_cols), 10);
320 XSETFASTINT (XWINDOW (mini_window)->top_line, 9); 320 XSETFASTINT (WVAR (XWINDOW (mini_window), top_line), 9);
321 XSETFASTINT (XWINDOW (mini_window)->total_lines, 1); 321 XSETFASTINT (WVAR (XWINDOW (mini_window), total_lines), 1);
322 } 322 }
323 323
324 /* Choose a buffer for the frame's root window. */ 324 /* Choose a buffer for the frame's root window. */
325 { 325 {
326 Lisp_Object buf; 326 Lisp_Object buf;
327 327
328 XWINDOW (root_window)->buffer = Qt; 328 WVAR (XWINDOW (root_window), buffer) = Qt;
329 buf = Fcurrent_buffer (); 329 buf = Fcurrent_buffer ();
330 /* If buf is a 'hidden' buffer (i.e. one whose name starts with 330 /* If buf is a 'hidden' buffer (i.e. one whose name starts with
331 a space), try to find another one. */ 331 a space), try to find another one. */
@@ -344,7 +344,7 @@ make_frame (int mini_p)
344 344
345 if (mini_p) 345 if (mini_p)
346 { 346 {
347 XWINDOW (mini_window)->buffer = Qt; 347 WVAR (XWINDOW (mini_window), buffer) = Qt;
348 set_window_buffer (mini_window, 348 set_window_buffer (mini_window,
349 (NILP (Vminibuffer_list) 349 (NILP (Vminibuffer_list)
350 ? get_minibuffer (0) 350 ? get_minibuffer (0)
@@ -376,7 +376,7 @@ make_frame_without_minibuffer (register Lisp_Object mini_window, KBOARD *kb, Lis
376 CHECK_LIVE_WINDOW (mini_window); 376 CHECK_LIVE_WINDOW (mini_window);
377 377
378 if (!NILP (mini_window) 378 if (!NILP (mini_window)
379 && FRAME_KBOARD (XFRAME (XWINDOW (mini_window)->frame)) != kb) 379 && FRAME_KBOARD (XFRAME (WVAR (XWINDOW (mini_window), frame))) != kb)
380 error ("Frame and minibuffer must be on the same terminal"); 380 error ("Frame and minibuffer must be on the same terminal");
381 381
382 /* Make a frame containing just a root window. */ 382 /* Make a frame containing just a root window. */
@@ -406,7 +406,7 @@ make_frame_without_minibuffer (register Lisp_Object mini_window, KBOARD *kb, Lis
406 406
407 /* Make the chosen minibuffer window display the proper minibuffer, 407 /* Make the chosen minibuffer window display the proper minibuffer,
408 unless it is already showing a minibuffer. */ 408 unless it is already showing a minibuffer. */
409 if (NILP (Fmemq (XWINDOW (mini_window)->buffer, Vminibuffer_list))) 409 if (NILP (Fmemq (WVAR (XWINDOW (mini_window), buffer), Vminibuffer_list)))
410 Fset_window_buffer (mini_window, 410 Fset_window_buffer (mini_window,
411 (NILP (Vminibuffer_list) 411 (NILP (Vminibuffer_list)
412 ? get_minibuffer (0) 412 ? get_minibuffer (0)
@@ -439,9 +439,9 @@ make_minibuffer_frame (void)
439 439
440 mini_window = FVAR (f, minibuffer_window) = FVAR (f, root_window); 440 mini_window = FVAR (f, minibuffer_window) = FVAR (f, root_window);
441 XWINDOW (mini_window)->mini = 1; 441 XWINDOW (mini_window)->mini = 1;
442 XWINDOW (mini_window)->next = Qnil; 442 WVAR (XWINDOW (mini_window), next) = Qnil;
443 XWINDOW (mini_window)->prev = Qnil; 443 WVAR (XWINDOW (mini_window), prev) = Qnil;
444 XWINDOW (mini_window)->frame = frame; 444 WVAR (XWINDOW (mini_window), frame) = frame;
445 445
446 /* Put the proper buffer in that window. */ 446 /* Put the proper buffer in that window. */
447 447
@@ -1241,7 +1241,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
1241 if (EQ (FVAR (f, minibuffer_window), minibuf_window)) 1241 if (EQ (FVAR (f, minibuffer_window), minibuf_window))
1242 { 1242 {
1243 Fset_window_buffer (FVAR (sf, minibuffer_window), 1243 Fset_window_buffer (FVAR (sf, minibuffer_window),
1244 XWINDOW (minibuf_window)->buffer, Qnil); 1244 WVAR (XWINDOW (minibuf_window), buffer), Qnil);
1245 minibuf_window = FVAR (sf, minibuffer_window); 1245 minibuf_window = FVAR (sf, minibuffer_window);
1246 1246
1247 /* If the dying minibuffer window was selected, 1247 /* If the dying minibuffer window was selected,
@@ -1672,17 +1672,17 @@ make_frame_visible_1 (Lisp_Object window)
1672{ 1672{
1673 struct window *w; 1673 struct window *w;
1674 1674
1675 for (;!NILP (window); window = w->next) 1675 for (;!NILP (window); window = WVAR (w, next))
1676 { 1676 {
1677 w = XWINDOW (window); 1677 w = XWINDOW (window);
1678 1678
1679 if (!NILP (w->buffer)) 1679 if (!NILP (WVAR (w, buffer)))
1680 BVAR (XBUFFER (w->buffer), display_time) = Fcurrent_time (); 1680 BVAR (XBUFFER (WVAR (w, buffer)), display_time) = Fcurrent_time ();
1681 1681
1682 if (!NILP (w->vchild)) 1682 if (!NILP (WVAR (w, vchild)))
1683 make_frame_visible_1 (w->vchild); 1683 make_frame_visible_1 (WVAR (w, vchild));
1684 if (!NILP (w->hchild)) 1684 if (!NILP (WVAR (w, hchild)))
1685 make_frame_visible_1 (w->hchild); 1685 make_frame_visible_1 (WVAR (w, hchild));
1686 } 1686 }
1687} 1687}
1688 1688
@@ -1714,7 +1714,7 @@ displayed in the terminal. */)
1714 { 1714 {
1715 struct frame *sf = XFRAME (selected_frame); 1715 struct frame *sf = XFRAME (selected_frame);
1716 Fset_window_buffer (FVAR (sf, minibuffer_window), 1716 Fset_window_buffer (FVAR (sf, minibuffer_window),
1717 XWINDOW (minibuf_window)->buffer, Qnil); 1717 WVAR (XWINDOW (minibuf_window), buffer), Qnil);
1718 minibuf_window = FVAR (sf, minibuffer_window); 1718 minibuf_window = FVAR (sf, minibuffer_window);
1719 } 1719 }
1720 1720
@@ -1752,7 +1752,7 @@ If omitted, FRAME defaults to the currently selected frame. */)
1752 { 1752 {
1753 struct frame *sf = XFRAME (selected_frame); 1753 struct frame *sf = XFRAME (selected_frame);
1754 Fset_window_buffer (FVAR (sf, minibuffer_window), 1754 Fset_window_buffer (FVAR (sf, minibuffer_window),
1755 XWINDOW (minibuf_window)->buffer, Qnil); 1755 WVAR (XWINDOW (minibuf_window), buffer), Qnil);
1756 minibuf_window = FVAR (sf, minibuffer_window); 1756 minibuf_window = FVAR (sf, minibuffer_window);
1757 } 1757 }
1758 1758
diff --git a/src/frame.h b/src/frame.h
index 1a1f8873348..22c0125ace9 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -511,7 +511,7 @@ typedef struct frame *FRAME_PTR;
511#define XSETFRAME(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FRAME)) 511#define XSETFRAME(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FRAME))
512 512
513/* Given a window, return its frame as a Lisp_Object. */ 513/* Given a window, return its frame as a Lisp_Object. */
514#define WINDOW_FRAME(w) (w)->frame 514#define WINDOW_FRAME(w) WVAR (w, frame)
515 515
516/* Test a frame for particular kinds of display methods. */ 516/* Test a frame for particular kinds of display methods. */
517#define FRAME_INITIAL_P(f) ((f)->output_method == output_initial) 517#define FRAME_INITIAL_P(f) ((f)->output_method == output_initial)
diff --git a/src/fringe.c b/src/fringe.c
index 8ee4ae7bf1e..374522989f6 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -692,7 +692,7 @@ get_logical_cursor_bitmap (struct window *w, Lisp_Object cursor)
692{ 692{
693 Lisp_Object cmap, bm = Qnil; 693 Lisp_Object cmap, bm = Qnil;
694 694
695 if ((cmap = BVAR (XBUFFER (w->buffer), fringe_cursor_alist)), !NILP (cmap)) 695 if ((cmap = BVAR (XBUFFER (WVAR (w, buffer)), fringe_cursor_alist)), !NILP (cmap))
696 { 696 {
697 bm = Fassq (cursor, cmap); 697 bm = Fassq (cursor, cmap);
698 if (CONSP (bm)) 698 if (CONSP (bm))
@@ -729,7 +729,7 @@ get_logical_fringe_bitmap (struct window *w, Lisp_Object bitmap, int right_p, in
729 If partial, lookup partial bitmap in default value if not found here. 729 If partial, lookup partial bitmap in default value if not found here.
730 If not partial, or no partial spec is present, use non-partial bitmap. */ 730 If not partial, or no partial spec is present, use non-partial bitmap. */
731 731
732 if ((cmap = BVAR (XBUFFER (w->buffer), fringe_indicator_alist)), !NILP (cmap)) 732 if ((cmap = BVAR (XBUFFER (WVAR (w, buffer)), fringe_indicator_alist)), !NILP (cmap))
733 { 733 {
734 bm1 = Fassq (bitmap, cmap); 734 bm1 = Fassq (bitmap, cmap);
735 if (CONSP (bm1)) 735 if (CONSP (bm1))
@@ -956,7 +956,7 @@ update_window_fringes (struct window *w, int keep_current_p)
956 return 0; 956 return 0;
957 957
958 if (!MINI_WINDOW_P (w) 958 if (!MINI_WINDOW_P (w)
959 && (ind = BVAR (XBUFFER (w->buffer), indicate_buffer_boundaries), !NILP (ind))) 959 && (ind = BVAR (XBUFFER (WVAR (w, buffer)), indicate_buffer_boundaries), !NILP (ind)))
960 { 960 {
961 if (EQ (ind, Qleft) || EQ (ind, Qright)) 961 if (EQ (ind, Qleft) || EQ (ind, Qright))
962 boundary_top = boundary_bot = arrow_top = arrow_bot = ind; 962 boundary_top = boundary_bot = arrow_top = arrow_bot = ind;
@@ -997,7 +997,7 @@ update_window_fringes (struct window *w, int keep_current_p)
997 { 997 {
998 if (top_ind_rn < 0 && row->visible_height > 0) 998 if (top_ind_rn < 0 && row->visible_height > 0)
999 { 999 {
1000 if (MATRIX_ROW_START_CHARPOS (row) <= BUF_BEGV (XBUFFER (w->buffer)) 1000 if (MATRIX_ROW_START_CHARPOS (row) <= BUF_BEGV (XBUFFER (WVAR (w, buffer)))
1001 && !MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P (w, row)) 1001 && !MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P (w, row))
1002 row->indicate_bob_p = !NILP (boundary_top); 1002 row->indicate_bob_p = !NILP (boundary_top);
1003 else 1003 else
@@ -1007,7 +1007,7 @@ update_window_fringes (struct window *w, int keep_current_p)
1007 1007
1008 if (bot_ind_rn < 0) 1008 if (bot_ind_rn < 0)
1009 { 1009 {
1010 if (MATRIX_ROW_END_CHARPOS (row) >= BUF_ZV (XBUFFER (w->buffer)) 1010 if (MATRIX_ROW_END_CHARPOS (row) >= BUF_ZV (XBUFFER (WVAR (w, buffer)))
1011 && !MATRIX_ROW_PARTIALLY_VISIBLE_AT_BOTTOM_P (w, row)) 1011 && !MATRIX_ROW_PARTIALLY_VISIBLE_AT_BOTTOM_P (w, row))
1012 row->indicate_eob_p = !NILP (boundary_bot), bot_ind_rn = rn; 1012 row->indicate_eob_p = !NILP (boundary_bot), bot_ind_rn = rn;
1013 else if (y + row->height >= yb) 1013 else if (y + row->height >= yb)
@@ -1017,7 +1017,7 @@ update_window_fringes (struct window *w, int keep_current_p)
1017 } 1017 }
1018 } 1018 }
1019 1019
1020 empty_pos = BVAR (XBUFFER (w->buffer), indicate_empty_lines); 1020 empty_pos = BVAR (XBUFFER (WVAR (w, buffer)), indicate_empty_lines);
1021 if (!NILP (empty_pos) && !EQ (empty_pos, Qright)) 1021 if (!NILP (empty_pos) && !EQ (empty_pos, Qright))
1022 empty_pos = WINDOW_LEFT_FRINGE_WIDTH (w) == 0 ? Qright : Qleft; 1022 empty_pos = WINDOW_LEFT_FRINGE_WIDTH (w) == 0 ? Qright : Qleft;
1023 1023
@@ -1740,7 +1740,7 @@ Return nil if POS is not visible in WINDOW. */)
1740 else if (w == XWINDOW (selected_window)) 1740 else if (w == XWINDOW (selected_window))
1741 textpos = PT; 1741 textpos = PT;
1742 else 1742 else
1743 textpos = XMARKER (w->pointm)->charpos; 1743 textpos = XMARKER (WVAR (w, pointm))->charpos;
1744 1744
1745 row = MATRIX_FIRST_TEXT_ROW (w->current_matrix); 1745 row = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
1746 row = row_containing_pos (w, textpos, row, NULL, 0); 1746 row = row_containing_pos (w, textpos, row, NULL, 0);
diff --git a/src/indent.c b/src/indent.c
index 38772bb384b..a6a9a9a0073 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -258,7 +258,7 @@ skip_invisible (ptrdiff_t pos, ptrdiff_t *next_boundary_p, ptrdiff_t to, Lisp_Ob
258 the next property change */ 258 the next property change */
259 prop = Fget_char_property (position, Qinvisible, 259 prop = Fget_char_property (position, Qinvisible,
260 (!NILP (window) 260 (!NILP (window)
261 && EQ (XWINDOW (window)->buffer, buffer)) 261 && EQ (WVAR (XWINDOW (window), buffer), buffer))
262 ? window : buffer); 262 ? window : buffer);
263 inv_p = TEXT_PROP_MEANS_INVISIBLE (prop); 263 inv_p = TEXT_PROP_MEANS_INVISIBLE (prop);
264 /* When counting columns (window == nil), don't skip over ellipsis text. */ 264 /* When counting columns (window == nil), don't skip over ellipsis text. */
@@ -1173,14 +1173,14 @@ compute_motion (ptrdiff_t from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
1173 width = window_body_cols (win); 1173 width = window_body_cols (win);
1174 /* We must make room for continuation marks if we don't have fringes. */ 1174 /* We must make room for continuation marks if we don't have fringes. */
1175#ifdef HAVE_WINDOW_SYSTEM 1175#ifdef HAVE_WINDOW_SYSTEM
1176 if (!FRAME_WINDOW_P (XFRAME (win->frame))) 1176 if (!FRAME_WINDOW_P (XFRAME (WVAR (win, frame))))
1177#endif 1177#endif
1178 width -= 1; 1178 width -= 1;
1179 } 1179 }
1180 1180
1181 continuation_glyph_width = 1; 1181 continuation_glyph_width = 1;
1182#ifdef HAVE_WINDOW_SYSTEM 1182#ifdef HAVE_WINDOW_SYSTEM
1183 if (FRAME_WINDOW_P (XFRAME (win->frame))) 1183 if (FRAME_WINDOW_P (XFRAME (WVAR (win, frame))))
1184 continuation_glyph_width = 0; /* In the fringe. */ 1184 continuation_glyph_width = 0; /* In the fringe. */
1185#endif 1185#endif
1186 1186
@@ -1787,7 +1787,7 @@ visible section of the buffer, and pass LINE and COL as TOPOS. */)
1787 ? (window_body_cols (w) 1787 ? (window_body_cols (w)
1788 - ( 1788 - (
1789#ifdef HAVE_WINDOW_SYSTEM 1789#ifdef HAVE_WINDOW_SYSTEM
1790 FRAME_WINDOW_P (XFRAME (w->frame)) ? 0 : 1790 FRAME_WINDOW_P (XFRAME (WVAR (w, frame))) ? 0 :
1791#endif 1791#endif
1792 1)) 1792 1))
1793 : XINT (XCAR (topos))), 1793 : XINT (XCAR (topos))),
@@ -1837,7 +1837,7 @@ vmotion (register ptrdiff_t from, register EMACS_INT vtarget, struct window *w)
1837 1837
1838 /* If the window contains this buffer, use it for getting text properties. 1838 /* If the window contains this buffer, use it for getting text properties.
1839 Otherwise use the current buffer as arg for doing that. */ 1839 Otherwise use the current buffer as arg for doing that. */
1840 if (EQ (w->buffer, Fcurrent_buffer ())) 1840 if (EQ (WVAR (w, buffer), Fcurrent_buffer ()))
1841 text_prop_object = window; 1841 text_prop_object = window;
1842 else 1842 else
1843 text_prop_object = Fcurrent_buffer (); 1843 text_prop_object = Fcurrent_buffer ();
@@ -1998,15 +1998,15 @@ whether or not it is currently displayed in some window. */)
1998 1998
1999 old_buffer = Qnil; 1999 old_buffer = Qnil;
2000 GCPRO3 (old_buffer, old_charpos, old_bytepos); 2000 GCPRO3 (old_buffer, old_charpos, old_bytepos);
2001 if (XBUFFER (w->buffer) != current_buffer) 2001 if (XBUFFER (WVAR (w, buffer)) != current_buffer)
2002 { 2002 {
2003 /* Set the window's buffer temporarily to the current buffer. */ 2003 /* Set the window's buffer temporarily to the current buffer. */
2004 old_buffer = w->buffer; 2004 old_buffer = WVAR (w, buffer);
2005 old_charpos = XMARKER (w->pointm)->charpos; 2005 old_charpos = XMARKER (WVAR (w, pointm))->charpos;
2006 old_bytepos = XMARKER (w->pointm)->bytepos; 2006 old_bytepos = XMARKER (WVAR (w, pointm))->bytepos;
2007 XSETBUFFER (w->buffer, current_buffer); 2007 XSETBUFFER (WVAR (w, buffer), current_buffer);
2008 set_marker_both 2008 set_marker_both (WVAR (w, pointm), WVAR (w, buffer),
2009 (w->pointm, w->buffer, BUF_PT (current_buffer), BUF_PT_BYTE (current_buffer)); 2009 BUF_PT (current_buffer), BUF_PT_BYTE (current_buffer));
2010 } 2010 }
2011 2011
2012 if (noninteractive) 2012 if (noninteractive)
@@ -2137,7 +2137,7 @@ whether or not it is currently displayed in some window. */)
2137 } 2137 }
2138 move_it_in_display_line 2138 move_it_in_display_line
2139 (&it, ZV, 2139 (&it, ZV,
2140 (int)(cols * FRAME_COLUMN_WIDTH (XFRAME (w->frame)) + 0.5), 2140 (int)(cols * FRAME_COLUMN_WIDTH (XFRAME (WVAR (w, frame))) + 0.5),
2141 MOVE_TO_X); 2141 MOVE_TO_X);
2142 } 2142 }
2143 2143
@@ -2147,8 +2147,9 @@ whether or not it is currently displayed in some window. */)
2147 2147
2148 if (BUFFERP (old_buffer)) 2148 if (BUFFERP (old_buffer))
2149 { 2149 {
2150 w->buffer = old_buffer; 2150 WVAR (w, buffer) = old_buffer;
2151 set_marker_both (w->pointm, w->buffer, old_charpos, old_bytepos); 2151 set_marker_both (WVAR (w, pointm), WVAR (w, buffer),
2152 old_charpos, old_bytepos);
2152 } 2153 }
2153 2154
2154 RETURN_UNGCPRO (make_number (it.vpos)); 2155 RETURN_UNGCPRO (make_number (it.vpos));
diff --git a/src/insdel.c b/src/insdel.c
index 9646507bc4b..705cd77dc0d 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -1820,7 +1820,7 @@ prepare_to_modify_buffer (ptrdiff_t start, ptrdiff_t end,
1820 1820
1821 /* Let redisplay consider other windows than selected_window 1821 /* Let redisplay consider other windows than selected_window
1822 if modifying another buffer. */ 1822 if modifying another buffer. */
1823 if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) 1823 if (XBUFFER (WVAR (XWINDOW (selected_window), buffer)) != current_buffer)
1824 ++windows_or_buffers_changed; 1824 ++windows_or_buffers_changed;
1825 1825
1826 if (BUF_INTERVALS (current_buffer) != 0) 1826 if (BUF_INTERVALS (current_buffer) != 0)
diff --git a/src/keyboard.c b/src/keyboard.c
index d8533b796c3..a8e7beddbc1 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -800,7 +800,7 @@ This function is called by the editor initialization to begin editing. */)
800 update_mode_lines = 1; 800 update_mode_lines = 1;
801 801
802 if (command_loop_level 802 if (command_loop_level
803 && current_buffer != XBUFFER (XWINDOW (selected_window)->buffer)) 803 && current_buffer != XBUFFER (WVAR (XWINDOW (selected_window), buffer)))
804 buffer = Fcurrent_buffer (); 804 buffer = Fcurrent_buffer ();
805 else 805 else
806 buffer = Qnil; 806 buffer = Qnil;
@@ -1382,8 +1382,8 @@ command_loop_1 (void)
1382 Fkill_emacs (Qnil); 1382 Fkill_emacs (Qnil);
1383 1383
1384 /* Make sure the current window's buffer is selected. */ 1384 /* Make sure the current window's buffer is selected. */
1385 if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) 1385 if (XBUFFER (WVAR (XWINDOW (selected_window), buffer)) != current_buffer)
1386 set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer)); 1386 set_buffer_internal (XBUFFER (WVAR (XWINDOW (selected_window), buffer)));
1387 1387
1388 /* Display any malloc warning that just came out. Use while because 1388 /* Display any malloc warning that just came out. Use while because
1389 displaying one warning can cause another. */ 1389 displaying one warning can cause another. */
@@ -1452,8 +1452,8 @@ command_loop_1 (void)
1452 /* A filter may have run while we were reading the input. */ 1452 /* A filter may have run while we were reading the input. */
1453 if (! FRAME_LIVE_P (XFRAME (selected_frame))) 1453 if (! FRAME_LIVE_P (XFRAME (selected_frame)))
1454 Fkill_emacs (Qnil); 1454 Fkill_emacs (Qnil);
1455 if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) 1455 if (XBUFFER (WVAR (XWINDOW (selected_window), buffer)) != current_buffer)
1456 set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer)); 1456 set_buffer_internal (XBUFFER (WVAR (XWINDOW (selected_window), buffer)));
1457 1457
1458 ++num_input_keys; 1458 ++num_input_keys;
1459 1459
@@ -1484,7 +1484,7 @@ command_loop_1 (void)
1484 { 1484 {
1485 struct buffer *b; 1485 struct buffer *b;
1486 XWINDOW (selected_window)->force_start = 0; 1486 XWINDOW (selected_window)->force_start = 0;
1487 b = XBUFFER (XWINDOW (selected_window)->buffer); 1487 b = XBUFFER (WVAR (XWINDOW (selected_window), buffer));
1488 BUF_BEG_UNCHANGED (b) = BUF_END_UNCHANGED (b) = 0; 1488 BUF_BEG_UNCHANGED (b) = BUF_END_UNCHANGED (b) = 0;
1489 } 1489 }
1490 1490
@@ -5174,8 +5174,8 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
5174 if (STRINGP (string)) 5174 if (STRINGP (string))
5175 string_info = Fcons (string, make_number (charpos)); 5175 string_info = Fcons (string, make_number (charpos));
5176 textpos = (w == XWINDOW (selected_window) 5176 textpos = (w == XWINDOW (selected_window)
5177 && current_buffer == XBUFFER (w->buffer)) 5177 && current_buffer == XBUFFER (WVAR (w, buffer)))
5178 ? PT : XMARKER (w->pointm)->charpos; 5178 ? PT : XMARKER (WVAR (w, pointm))->charpos;
5179 5179
5180 xret = wx; 5180 xret = wx;
5181 yret = wy; 5181 yret = wy;
@@ -5563,7 +5563,7 @@ make_lispy_event (struct input_event *event)
5563 int fuzz; 5563 int fuzz;
5564 5564
5565 if (WINDOWP (event->frame_or_window)) 5565 if (WINDOWP (event->frame_or_window))
5566 f = XFRAME (XWINDOW (event->frame_or_window)->frame); 5566 f = XFRAME (WVAR (XWINDOW (event->frame_or_window), frame));
5567 else if (FRAMEP (event->frame_or_window)) 5567 else if (FRAMEP (event->frame_or_window))
5568 f = XFRAME (event->frame_or_window); 5568 f = XFRAME (event->frame_or_window);
5569 else 5569 else
@@ -5731,7 +5731,7 @@ make_lispy_event (struct input_event *event)
5731 int is_double; 5731 int is_double;
5732 5732
5733 if (WINDOWP (event->frame_or_window)) 5733 if (WINDOWP (event->frame_or_window))
5734 fr = XFRAME (XWINDOW (event->frame_or_window)->frame); 5734 fr = XFRAME (WVAR (XWINDOW (event->frame_or_window), frame));
5735 else if (FRAMEP (event->frame_or_window)) 5735 else if (FRAMEP (event->frame_or_window))
5736 fr = XFRAME (event->frame_or_window); 5736 fr = XFRAME (event->frame_or_window);
5737 else 5737 else
@@ -9395,8 +9395,8 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9395 { 9395 {
9396 if (! FRAME_LIVE_P (XFRAME (selected_frame))) 9396 if (! FRAME_LIVE_P (XFRAME (selected_frame)))
9397 Fkill_emacs (Qnil); 9397 Fkill_emacs (Qnil);
9398 if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) 9398 if (XBUFFER (WVAR (XWINDOW (selected_window), buffer)) != current_buffer)
9399 Fset_buffer (XWINDOW (selected_window)->buffer); 9399 Fset_buffer (WVAR (XWINDOW (selected_window), buffer));
9400 } 9400 }
9401 9401
9402 orig_local_map = get_local_map (PT, current_buffer, Qlocal_map); 9402 orig_local_map = get_local_map (PT, current_buffer, Qlocal_map);
@@ -9488,8 +9488,8 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9488 not the current buffer. If we're at the 9488 not the current buffer. If we're at the
9489 beginning of a key sequence, switch buffers. */ 9489 beginning of a key sequence, switch buffers. */
9490 if (WINDOWP (window) 9490 if (WINDOWP (window)
9491 && BUFFERP (XWINDOW (window)->buffer) 9491 && BUFFERP (WVAR (XWINDOW (window), buffer))
9492 && XBUFFER (XWINDOW (window)->buffer) != current_buffer) 9492 && XBUFFER (WVAR (XWINDOW (window), buffer)) != current_buffer)
9493 { 9493 {
9494 ASET (raw_keybuf, raw_keybuf_count, key); 9494 ASET (raw_keybuf, raw_keybuf_count, key);
9495 raw_keybuf_count++; 9495 raw_keybuf_count++;
@@ -9510,7 +9510,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9510 9510
9511 if (! FRAME_LIVE_P (XFRAME (selected_frame))) 9511 if (! FRAME_LIVE_P (XFRAME (selected_frame)))
9512 Fkill_emacs (Qnil); 9512 Fkill_emacs (Qnil);
9513 set_buffer_internal (XBUFFER (XWINDOW (window)->buffer)); 9513 set_buffer_internal (XBUFFER (WVAR (XWINDOW (window), buffer)));
9514 orig_local_map = get_local_map (PT, current_buffer, 9514 orig_local_map = get_local_map (PT, current_buffer,
9515 Qlocal_map); 9515 Qlocal_map);
9516 orig_keymap = get_local_map (PT, current_buffer, 9516 orig_keymap = get_local_map (PT, current_buffer,
@@ -11194,7 +11194,7 @@ The `posn-' functions access elements of such lists. */)
11194 ? window_box_left_offset (w, TEXT_AREA) 11194 ? window_box_left_offset (w, TEXT_AREA)
11195 : 0))); 11195 : 0)));
11196 XSETINT (y, WINDOW_TO_FRAME_PIXEL_Y (w, XINT (y))); 11196 XSETINT (y, WINDOW_TO_FRAME_PIXEL_Y (w, XINT (y)));
11197 frame_or_window = w->frame; 11197 frame_or_window = WVAR (w, frame);
11198 } 11198 }
11199 11199
11200 CHECK_LIVE_FRAME (frame_or_window); 11200 CHECK_LIVE_FRAME (frame_or_window);
diff --git a/src/keymap.c b/src/keymap.c
index 3c5d45b0680..ed8542249e5 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1560,8 +1560,8 @@ like in the respective argument of `key-binding'. */)
1560 window = POSN_WINDOW (position); 1560 window = POSN_WINDOW (position);
1561 1561
1562 if (WINDOWP (window) 1562 if (WINDOWP (window)
1563 && BUFFERP (XWINDOW (window)->buffer) 1563 && BUFFERP (WVAR (XWINDOW (window), buffer))
1564 && XBUFFER (XWINDOW (window)->buffer) != current_buffer) 1564 && XBUFFER (WVAR (XWINDOW (window), buffer)) != current_buffer)
1565 { 1565 {
1566 /* Arrange to go back to the original buffer once we're done 1566 /* Arrange to go back to the original buffer once we're done
1567 processing the key sequence. We don't use 1567 processing the key sequence. We don't use
@@ -1573,7 +1573,7 @@ like in the respective argument of `key-binding'. */)
1573 1573
1574 record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); 1574 record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
1575 1575
1576 set_buffer_internal (XBUFFER (XWINDOW (window)->buffer)); 1576 set_buffer_internal (XBUFFER (WVAR (XWINDOW (window), buffer)));
1577 } 1577 }
1578 } 1578 }
1579 1579
diff --git a/src/lisp.h b/src/lisp.h
index 55f8677f9a5..e1c0cc18d6d 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1748,7 +1748,8 @@ typedef struct {
1748 vchild, and hchild members are all nil. */ 1748 vchild, and hchild members are all nil. */
1749 1749
1750#define CHECK_LIVE_WINDOW(x) \ 1750#define CHECK_LIVE_WINDOW(x) \
1751 CHECK_TYPE (WINDOWP (x) && !NILP (XWINDOW (x)->buffer), Qwindow_live_p, x) 1751 CHECK_TYPE (WINDOWP (x) && !NILP (WVAR (XWINDOW (x), buffer)), \
1752 Qwindow_live_p, x)
1752 1753
1753#define CHECK_PROCESS(x) \ 1754#define CHECK_PROCESS(x) \
1754 CHECK_TYPE (PROCESSP (x), Qprocessp, x) 1755 CHECK_TYPE (PROCESSP (x), Qprocessp, x)
diff --git a/src/minibuf.c b/src/minibuf.c
index 5ece9d5d0dd..4b9c0a32f85 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -115,7 +115,7 @@ choose_minibuf_frame (void)
115 /* Under X, we come here with minibuf_window being the 115 /* Under X, we come here with minibuf_window being the
116 minibuffer window of the unused termcap window created in 116 minibuffer window of the unused termcap window created in
117 init_window_once. That window doesn't have a buffer. */ 117 init_window_once. That window doesn't have a buffer. */
118 buffer = XWINDOW (minibuf_window)->buffer; 118 buffer = WVAR (XWINDOW (minibuf_window), buffer);
119 if (BUFFERP (buffer)) 119 if (BUFFERP (buffer))
120 Fset_window_buffer (FVAR (sf, minibuffer_window), buffer, Qnil); 120 Fset_window_buffer (FVAR (sf, minibuffer_window), buffer, Qnil);
121 minibuf_window = FVAR (sf, minibuffer_window); 121 minibuf_window = FVAR (sf, minibuffer_window);
@@ -612,7 +612,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
612 FOR_EACH_FRAME (dummy, frame) 612 FOR_EACH_FRAME (dummy, frame)
613 { 613 {
614 Lisp_Object root_window = Fframe_root_window (frame); 614 Lisp_Object root_window = Fframe_root_window (frame);
615 Lisp_Object mini_window = XWINDOW (root_window)->next; 615 Lisp_Object mini_window = WVAR (XWINDOW (root_window), next);
616 616
617 if (! NILP (mini_window) && ! EQ (mini_window, minibuf_window) 617 if (! NILP (mini_window) && ! EQ (mini_window, minibuf_window)
618 && !NILP (Fwindow_minibuffer_p (mini_window))) 618 && !NILP (Fwindow_minibuffer_p (mini_window)))
@@ -687,7 +687,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
687 XWINDOW (minibuf_window)->must_be_updated_p = 1; 687 XWINDOW (minibuf_window)->must_be_updated_p = 1;
688 update_frame (XFRAME (selected_frame), 1, 1); 688 update_frame (XFRAME (selected_frame), 1, 1);
689 { 689 {
690 struct frame *f = XFRAME (XWINDOW (minibuf_window)->frame); 690 struct frame *f = XFRAME (WVAR (XWINDOW (minibuf_window), frame));
691 struct redisplay_interface *rif = FRAME_RIF (f); 691 struct redisplay_interface *rif = FRAME_RIF (f);
692 if (rif && rif->flush_display) 692 if (rif && rif->flush_display)
693 rif->flush_display (f); 693 rif->flush_display (f);
@@ -844,7 +844,7 @@ read_minibuf_unwind (Lisp_Object data)
844 window = minibuf_window; 844 window = minibuf_window;
845 /* To keep things predictable, in case it matters, let's be in the 845 /* To keep things predictable, in case it matters, let's be in the
846 minibuffer when we reset the relevant variables. */ 846 minibuffer when we reset the relevant variables. */
847 Fset_buffer (XWINDOW (window)->buffer); 847 Fset_buffer (WVAR (XWINDOW (window), buffer));
848 848
849 /* Restore prompt, etc, from outer minibuffer level. */ 849 /* Restore prompt, etc, from outer minibuffer level. */
850 minibuf_prompt = Fcar (minibuf_save_list); 850 minibuf_prompt = Fcar (minibuf_save_list);
diff --git a/src/nsterm.m b/src/nsterm.m
index f8557aaf3f1..f13ec2795ea 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -669,7 +669,7 @@ ns_update_window_end (struct window *w, int cursor_on_p,
669 external (RIF) call; for one window called before update_end 669 external (RIF) call; for one window called before update_end
670 -------------------------------------------------------------------------- */ 670 -------------------------------------------------------------------------- */
671{ 671{
672 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); 672 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (WVAR (w, frame)));
673 673
674 /* note: this fn is nearly identical in all terms */ 674 /* note: this fn is nearly identical in all terms */
675 if (!w->pseudo_window_p) 675 if (!w->pseudo_window_p)
@@ -2037,7 +2037,7 @@ ns_scroll_run (struct window *w, struct run *run)
2037 External (RIF): Insert or delete n lines at line vpos 2037 External (RIF): Insert or delete n lines at line vpos
2038 -------------------------------------------------------------------------- */ 2038 -------------------------------------------------------------------------- */
2039{ 2039{
2040 struct frame *f = XFRAME (w->frame); 2040 struct frame *f = XFRAME (WVAR (w, frame));
2041 int x, y, width, height, from_y, to_y, bottom_y; 2041 int x, y, width, height, from_y, to_y, bottom_y;
2042 2042
2043 NSTRACE (ns_scroll_run); 2043 NSTRACE (ns_scroll_run);
@@ -2116,7 +2116,7 @@ ns_after_update_window_line (struct glyph_row *desired_row)
2116 full-width rows stays visible in the internal border. 2116 full-width rows stays visible in the internal border.
2117 Under NS this is drawn inside the fringes. */ 2117 Under NS this is drawn inside the fringes. */
2118 if (windows_or_buffers_changed 2118 if (windows_or_buffers_changed
2119 && (f = XFRAME (w->frame), 2119 && (f = XFRAME (WVAR (w, frame)),
2120 width = FRAME_INTERNAL_BORDER_WIDTH (f), 2120 width = FRAME_INTERNAL_BORDER_WIDTH (f),
2121 width != 0) 2121 width != 0)
2122 && (height = desired_row->visible_height, 2122 && (height = desired_row->visible_height,
diff --git a/src/print.c b/src/print.c
index 0734245c248..5effec7fd44 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1775,10 +1775,11 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1775 strout ("#<window ", -1, -1, printcharfun); 1775 strout ("#<window ", -1, -1, printcharfun);
1776 len = sprintf (buf, "%d", XWINDOW (obj)->sequence_number); 1776 len = sprintf (buf, "%d", XWINDOW (obj)->sequence_number);
1777 strout (buf, len, len, printcharfun); 1777 strout (buf, len, len, printcharfun);
1778 if (!NILP (XWINDOW (obj)->buffer)) 1778 if (!NILP (WVAR (XWINDOW (obj), buffer)))
1779 { 1779 {
1780 strout (" on ", -1, -1, printcharfun); 1780 strout (" on ", -1, -1, printcharfun);
1781 print_string (BVAR (XBUFFER (XWINDOW (obj)->buffer), name), printcharfun); 1781 print_string (BVAR (XBUFFER (WVAR (XWINDOW (obj), buffer)), name),
1782 printcharfun);
1782 } 1783 }
1783 PRINTCHAR ('>'); 1784 PRINTCHAR ('>');
1784 } 1785 }
diff --git a/src/textprop.c b/src/textprop.c
index 8aa52bebe5b..ee5d82fa170 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -587,7 +587,7 @@ get_char_property_and_overlay (Lisp_Object position, register Lisp_Object prop,
587 if (WINDOWP (object)) 587 if (WINDOWP (object))
588 { 588 {
589 w = XWINDOW (object); 589 w = XWINDOW (object);
590 object = w->buffer; 590 object = WVAR (w, buffer);
591 } 591 }
592 if (BUFFERP (object)) 592 if (BUFFERP (object))
593 { 593 {
diff --git a/src/w32fns.c b/src/w32fns.c
index 57d3c732246..bbcda21adee 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -5617,7 +5617,7 @@ Text larger than the specified size is clipped. */)
5617 5617
5618 /* Set up the frame's root window. */ 5618 /* Set up the frame's root window. */
5619 w = XWINDOW (FRAME_ROOT_WINDOW (f)); 5619 w = XWINDOW (FRAME_ROOT_WINDOW (f));
5620 w->left_col = w->top_line = make_number (0); 5620 WVAR (w, left_col) = WVAR (w, top_line) = make_number (0);
5621 5621
5622 if (CONSP (Vx_max_tooltip_size) 5622 if (CONSP (Vx_max_tooltip_size)
5623 && INTEGERP (XCAR (Vx_max_tooltip_size)) 5623 && INTEGERP (XCAR (Vx_max_tooltip_size))
@@ -5625,22 +5625,22 @@ Text larger than the specified size is clipped. */)
5625 && INTEGERP (XCDR (Vx_max_tooltip_size)) 5625 && INTEGERP (XCDR (Vx_max_tooltip_size))
5626 && XINT (XCDR (Vx_max_tooltip_size)) > 0) 5626 && XINT (XCDR (Vx_max_tooltip_size)) > 0)
5627 { 5627 {
5628 w->total_cols = XCAR (Vx_max_tooltip_size); 5628 WVAR (w, total_cols) = XCAR (Vx_max_tooltip_size);
5629 w->total_lines = XCDR (Vx_max_tooltip_size); 5629 WVAR (w, total_lines) = XCDR (Vx_max_tooltip_size);
5630 } 5630 }
5631 else 5631 else
5632 { 5632 {
5633 w->total_cols = make_number (80); 5633 WVAR (w, total_cols) = make_number (80);
5634 w->total_lines = make_number (40); 5634 WVAR (w, total_lines) = make_number (40);
5635 } 5635 }
5636 5636
5637 FRAME_TOTAL_COLS (f) = XINT (w->total_cols); 5637 FRAME_TOTAL_COLS (f) = XINT (WVAR (w, total_cols));
5638 adjust_glyphs (f); 5638 adjust_glyphs (f);
5639 w->pseudo_window_p = 1; 5639 w->pseudo_window_p = 1;
5640 5640
5641 /* Display the tooltip text in a temporary buffer. */ 5641 /* Display the tooltip text in a temporary buffer. */
5642 old_buffer = current_buffer; 5642 old_buffer = current_buffer;
5643 set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); 5643 set_buffer_internal_1 (XBUFFER (WVAR (XWINDOW (FRAME_ROOT_WINDOW (f)), buffer)));
5644 BVAR (current_buffer, truncate_lines) = Qnil; 5644 BVAR (current_buffer, truncate_lines) = Qnil;
5645 clear_glyph_matrix (w->desired_matrix); 5645 clear_glyph_matrix (w->desired_matrix);
5646 clear_glyph_matrix (w->current_matrix); 5646 clear_glyph_matrix (w->current_matrix);
@@ -5702,7 +5702,7 @@ Text larger than the specified size is clipped. */)
5702 /* w->total_cols and FRAME_TOTAL_COLS want the width in columns, 5702 /* w->total_cols and FRAME_TOTAL_COLS want the width in columns,
5703 not in pixels. */ 5703 not in pixels. */
5704 width /= WINDOW_FRAME_COLUMN_WIDTH (w); 5704 width /= WINDOW_FRAME_COLUMN_WIDTH (w);
5705 w->total_cols = make_number (width); 5705 WVAR (w, total_cols) = make_number (width);
5706 FRAME_TOTAL_COLS (f) = width; 5706 FRAME_TOTAL_COLS (f) = width;
5707 adjust_glyphs (f); 5707 adjust_glyphs (f);
5708 w->pseudo_window_p = 1; 5708 w->pseudo_window_p = 1;
diff --git a/src/w32menu.c b/src/w32menu.c
index 193a8182481..4545533c999 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -394,7 +394,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
394 if (! menubar_widget) 394 if (! menubar_widget)
395 previous_menu_items_used = 0; 395 previous_menu_items_used = 0;
396 396
397 buffer = XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer; 397 buffer = WVAR (XWINDOW (FRAME_SELECTED_WINDOW (f)), buffer);
398 specbind (Qinhibit_quit, Qt); 398 specbind (Qinhibit_quit, Qt);
399 /* Don't let the debugger step into this code 399 /* Don't let the debugger step into this code
400 because it is not reentrant. */ 400 because it is not reentrant. */
diff --git a/src/w32term.c b/src/w32term.c
index 9fc2cfb5ef7..6b87ca4e88c 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -649,7 +649,7 @@ static void
649x_update_window_end (struct window *w, int cursor_on_p, 649x_update_window_end (struct window *w, int cursor_on_p,
650 int mouse_face_overwritten_p) 650 int mouse_face_overwritten_p)
651{ 651{
652 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); 652 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (WVAR (w, frame)));
653 653
654 if (!w->pseudo_window_p) 654 if (!w->pseudo_window_p)
655 { 655 {
@@ -754,7 +754,7 @@ x_after_update_window_line (struct glyph_row *desired_row)
754 overhead is very small. */ 754 overhead is very small. */
755 if (windows_or_buffers_changed 755 if (windows_or_buffers_changed
756 && desired_row->full_width_p 756 && desired_row->full_width_p
757 && (f = XFRAME (w->frame), 757 && (f = XFRAME (WVAR (w, frame)),
758 width = FRAME_INTERNAL_BORDER_WIDTH (f), 758 width = FRAME_INTERNAL_BORDER_WIDTH (f),
759 width != 0) 759 width != 0)
760 && (height = desired_row->visible_height, 760 && (height = desired_row->visible_height,
@@ -2718,7 +2718,7 @@ x_ins_del_lines (struct frame *f, int vpos, int n)
2718static void 2718static void
2719x_scroll_run (struct window *w, struct run *run) 2719x_scroll_run (struct window *w, struct run *run)
2720{ 2720{
2721 struct frame *f = XFRAME (w->frame); 2721 struct frame *f = XFRAME (WVAR (w, frame));
2722 int x, y, width, height, from_y, to_y, bottom_y; 2722 int x, y, width, height, from_y, to_y, bottom_y;
2723 HWND hwnd = FRAME_W32_WINDOW (f); 2723 HWND hwnd = FRAME_W32_WINDOW (f);
2724 HRGN expect_dirty; 2724 HRGN expect_dirty;
@@ -3668,7 +3668,7 @@ x_scroll_bar_remove (struct scroll_bar *bar)
3668 my_destroy_window (f, SCROLL_BAR_W32_WINDOW (bar)); 3668 my_destroy_window (f, SCROLL_BAR_W32_WINDOW (bar));
3669 3669
3670 /* Dissociate this scroll bar from its window. */ 3670 /* Dissociate this scroll bar from its window. */
3671 XWINDOW (bar->window)->vertical_scroll_bar = Qnil; 3671 WVAR (XWINDOW (bar->window), vertical_scroll_bar) = Qnil;
3672 3672
3673 UNBLOCK_INPUT; 3673 UNBLOCK_INPUT;
3674} 3674}
@@ -3681,7 +3681,7 @@ static void
3681w32_set_vertical_scroll_bar (struct window *w, 3681w32_set_vertical_scroll_bar (struct window *w,
3682 int portion, int whole, int position) 3682 int portion, int whole, int position)
3683{ 3683{
3684 struct frame *f = XFRAME (w->frame); 3684 struct frame *f = XFRAME (WVAR (w, frame));
3685 struct scroll_bar *bar; 3685 struct scroll_bar *bar;
3686 int top, height, left, sb_left, width, sb_width; 3686 int top, height, left, sb_left, width, sb_width;
3687 int window_y, window_height; 3687 int window_y, window_height;
@@ -3721,7 +3721,7 @@ w32_set_vertical_scroll_bar (struct window *w,
3721 || WINDOW_RIGHT_MARGIN_COLS (w) == 0)); 3721 || WINDOW_RIGHT_MARGIN_COLS (w) == 0));
3722 3722
3723 /* Does the scroll bar exist yet? */ 3723 /* Does the scroll bar exist yet? */
3724 if (NILP (w->vertical_scroll_bar)) 3724 if (NILP (WVAR (w, vertical_scroll_bar)))
3725 { 3725 {
3726 HDC hdc; 3726 HDC hdc;
3727 BLOCK_INPUT; 3727 BLOCK_INPUT;
@@ -3743,7 +3743,7 @@ w32_set_vertical_scroll_bar (struct window *w,
3743 /* It may just need to be moved and resized. */ 3743 /* It may just need to be moved and resized. */
3744 HWND hwnd; 3744 HWND hwnd;
3745 3745
3746 bar = XSCROLL_BAR (w->vertical_scroll_bar); 3746 bar = XSCROLL_BAR (WVAR (w, vertical_scroll_bar));
3747 hwnd = SCROLL_BAR_W32_WINDOW (bar); 3747 hwnd = SCROLL_BAR_W32_WINDOW (bar);
3748 3748
3749 /* If already correctly positioned, do nothing. */ 3749 /* If already correctly positioned, do nothing. */
@@ -3805,7 +3805,7 @@ w32_set_vertical_scroll_bar (struct window *w,
3805 3805
3806 w32_set_scroll_bar_thumb (bar, portion, position, whole); 3806 w32_set_scroll_bar_thumb (bar, portion, position, whole);
3807 3807
3808 XSETVECTOR (w->vertical_scroll_bar, bar); 3808 XSETVECTOR (WVAR (w, vertical_scroll_bar), bar);
3809} 3809}
3810 3810
3811 3811
@@ -3849,10 +3849,10 @@ w32_redeem_scroll_bar (struct window *window)
3849 struct frame *f; 3849 struct frame *f;
3850 3850
3851 /* We can't redeem this window's scroll bar if it doesn't have one. */ 3851 /* We can't redeem this window's scroll bar if it doesn't have one. */
3852 if (NILP (window->vertical_scroll_bar)) 3852 if (NILP (WVAR (window, vertical_scroll_bar)))
3853 abort (); 3853 abort ();
3854 3854
3855 bar = XSCROLL_BAR (window->vertical_scroll_bar); 3855 bar = XSCROLL_BAR (WVAR (window, vertical_scroll_bar));
3856 3856
3857 /* Unlink it from the condemned list. */ 3857 /* Unlink it from the condemned list. */
3858 f = XFRAME (WINDOW_FRAME (window)); 3858 f = XFRAME (WINDOW_FRAME (window));
@@ -3860,11 +3860,11 @@ w32_redeem_scroll_bar (struct window *window)
3860 { 3860 {
3861 /* If the prev pointer is nil, it must be the first in one of 3861 /* If the prev pointer is nil, it must be the first in one of
3862 the lists. */ 3862 the lists. */
3863 if (EQ (FRAME_SCROLL_BARS (f), window->vertical_scroll_bar)) 3863 if (EQ (FRAME_SCROLL_BARS (f), WVAR (window, vertical_scroll_bar)))
3864 /* It's not condemned. Everything's fine. */ 3864 /* It's not condemned. Everything's fine. */
3865 return; 3865 return;
3866 else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f), 3866 else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f),
3867 window->vertical_scroll_bar)) 3867 WVAR (window, vertical_scroll_bar)))
3868 FRAME_CONDEMNED_SCROLL_BARS (f) = bar->next; 3868 FRAME_CONDEMNED_SCROLL_BARS (f) = bar->next;
3869 else 3869 else
3870 /* If its prev pointer is nil, it must be at the front of 3870 /* If its prev pointer is nil, it must be at the front of
@@ -4422,8 +4422,8 @@ w32_read_socket (struct terminal *terminal, int expected,
4422 create event iff we don't leave the 4422 create event iff we don't leave the
4423 selected frame. */ 4423 selected frame. */
4424 && (focus_follows_mouse 4424 && (focus_follows_mouse
4425 || (EQ (XWINDOW (window)->frame, 4425 || (EQ (WVAR (XWINDOW (window), frame),
4426 XWINDOW (selected_window)->frame)))) 4426 WVAR (XWINDOW (selected_window), frame)))))
4427 { 4427 {
4428 inev.kind = SELECT_WINDOW_EVENT; 4428 inev.kind = SELECT_WINDOW_EVENT;
4429 inev.frame_or_window = window; 4429 inev.frame_or_window = window;
@@ -5038,7 +5038,7 @@ static void
5038x_draw_bar_cursor (struct window *w, struct glyph_row *row, 5038x_draw_bar_cursor (struct window *w, struct glyph_row *row,
5039 int width, enum text_cursor_kinds kind) 5039 int width, enum text_cursor_kinds kind)
5040{ 5040{
5041 struct frame *f = XFRAME (w->frame); 5041 struct frame *f = XFRAME (WVAR (w, frame));
5042 struct glyph *cursor_glyph; 5042 struct glyph *cursor_glyph;
5043 5043
5044 /* If cursor is out of bounds, don't draw garbage. This can happen 5044 /* If cursor is out of bounds, don't draw garbage. This can happen
diff --git a/src/window.c b/src/window.c
index ae0aad7084f..beabc28cf6d 100644
--- a/src/window.c
+++ b/src/window.c
@@ -178,7 +178,7 @@ DEFUN ("window-frame", Fwindow_frame, Swindow_frame, 1, 1, 0,
178If WINDOW is omitted or nil, it defaults to the selected window. */) 178If WINDOW is omitted or nil, it defaults to the selected window. */)
179 (Lisp_Object window) 179 (Lisp_Object window)
180{ 180{
181 return decode_any_window (window)->frame; 181 return WVAR (decode_any_window (window), frame);
182} 182}
183 183
184DEFUN ("frame-root-window", Fframe_root_window, Sframe_root_window, 0, 1, 0, 184DEFUN ("frame-root-window", Fframe_root_window, Sframe_root_window, 0, 1, 0,
@@ -244,12 +244,12 @@ the first window of that frame. */)
244 window = FVAR (XFRAME (frame_or_window), root_window); 244 window = FVAR (XFRAME (frame_or_window), root_window);
245 } 245 }
246 246
247 while (NILP (XWINDOW (window)->buffer)) 247 while (NILP (WVAR (XWINDOW (window), buffer)))
248 { 248 {
249 if (! NILP (XWINDOW (window)->hchild)) 249 if (! NILP (WVAR (XWINDOW (window), hchild)))
250 window = XWINDOW (window)->hchild; 250 window = WVAR (XWINDOW (window), hchild);
251 else if (! NILP (XWINDOW (window)->vchild)) 251 else if (! NILP (WVAR (XWINDOW (window), vchild)))
252 window = XWINDOW (window)->vchild; 252 window = WVAR (XWINDOW (window), vchild);
253 else 253 else
254 abort (); 254 abort ();
255 } 255 }
@@ -338,7 +338,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
338 if (NILP (norecord)) 338 if (NILP (norecord))
339 { 339 {
340 w->use_time = ++window_select_count; 340 w->use_time = ++window_select_count;
341 record_buffer (w->buffer); 341 record_buffer (WVAR (w, buffer));
342 } 342 }
343 343
344 if (EQ (window, selected_window) && !inhibit_point_swap) 344 if (EQ (window, selected_window) && !inhibit_point_swap)
@@ -366,17 +366,17 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
366 if (!inhibit_point_swap) 366 if (!inhibit_point_swap)
367 { 367 {
368 ow = XWINDOW (selected_window); 368 ow = XWINDOW (selected_window);
369 if (! NILP (ow->buffer)) 369 if (! NILP (WVAR (ow, buffer)))
370 set_marker_both (ow->pointm, ow->buffer, 370 set_marker_both (WVAR (ow, pointm), WVAR (ow, buffer),
371 BUF_PT (XBUFFER (ow->buffer)), 371 BUF_PT (XBUFFER (WVAR (ow, buffer))),
372 BUF_PT_BYTE (XBUFFER (ow->buffer))); 372 BUF_PT_BYTE (XBUFFER (WVAR (ow, buffer))));
373 } 373 }
374 374
375 selected_window = window; 375 selected_window = window;
376 376
377 Fset_buffer (w->buffer); 377 Fset_buffer (WVAR (w, buffer));
378 378
379 BVAR (XBUFFER (w->buffer), last_selected_window) = window; 379 BVAR (XBUFFER (WVAR (w, buffer)), last_selected_window) = window;
380 380
381 /* Go to the point recorded in the window. 381 /* Go to the point recorded in the window.
382 This is important when the buffer is in more 382 This is important when the buffer is in more
@@ -384,7 +384,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
384 redisplay_window has altered point after scrolling, 384 redisplay_window has altered point after scrolling,
385 because it makes the change only in the window. */ 385 because it makes the change only in the window. */
386 { 386 {
387 register ptrdiff_t new_point = marker_position (w->pointm); 387 register ptrdiff_t new_point = marker_position (WVAR (w, pointm));
388 if (new_point < BEGV) 388 if (new_point < BEGV)
389 SET_PT (BEGV); 389 SET_PT (BEGV);
390 else if (new_point > ZV) 390 else if (new_point > ZV)
@@ -419,7 +419,7 @@ If WINDOW is omitted or nil, it defaults to the selected window.
419Return nil for an internal window or a deleted window. */) 419Return nil for an internal window or a deleted window. */)
420 (Lisp_Object window) 420 (Lisp_Object window)
421{ 421{
422 return decode_any_window (window)->buffer; 422 return WVAR (decode_any_window (window), buffer);
423} 423}
424 424
425DEFUN ("window-parent", Fwindow_parent, Swindow_parent, 0, 1, 0, 425DEFUN ("window-parent", Fwindow_parent, Swindow_parent, 0, 1, 0,
@@ -428,7 +428,7 @@ If WINDOW is omitted or nil, it defaults to the selected window.
428Return nil for a window with no parent (e.g. a root window). */) 428Return nil for a window with no parent (e.g. a root window). */)
429 (Lisp_Object window) 429 (Lisp_Object window)
430{ 430{
431 return decode_any_window (window)->parent; 431 return WVAR (decode_any_window (window), parent);
432} 432}
433 433
434DEFUN ("window-top-child", Fwindow_top_child, Swindow_top_child, 1, 1, 0, 434DEFUN ("window-top-child", Fwindow_top_child, Swindow_top_child, 1, 1, 0,
@@ -439,7 +439,7 @@ horizontal combination. */)
439 (Lisp_Object window) 439 (Lisp_Object window)
440{ 440{
441 CHECK_WINDOW (window); 441 CHECK_WINDOW (window);
442 return decode_any_window (window)->vchild; 442 return WVAR (decode_any_window (window), vchild);
443} 443}
444 444
445DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 1, 1, 0, 445DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 1, 1, 0,
@@ -450,7 +450,7 @@ vertical combination. */)
450 (Lisp_Object window) 450 (Lisp_Object window)
451{ 451{
452 CHECK_WINDOW (window); 452 CHECK_WINDOW (window);
453 return decode_any_window (window)->hchild; 453 return WVAR (decode_any_window (window), hchild);
454} 454}
455 455
456DEFUN ("window-next-sibling", Fwindow_next_sibling, Swindow_next_sibling, 0, 1, 0, 456DEFUN ("window-next-sibling", Fwindow_next_sibling, Swindow_next_sibling, 0, 1, 0,
@@ -459,7 +459,7 @@ If WINDOW is omitted or nil, it defaults to the selected window.
459Return nil if WINDOW has no next sibling. */) 459Return nil if WINDOW has no next sibling. */)
460 (Lisp_Object window) 460 (Lisp_Object window)
461{ 461{
462 return decode_any_window (window)->next; 462 return WVAR (decode_any_window (window), next);
463} 463}
464 464
465DEFUN ("window-prev-sibling", Fwindow_prev_sibling, Swindow_prev_sibling, 0, 1, 0, 465DEFUN ("window-prev-sibling", Fwindow_prev_sibling, Swindow_prev_sibling, 0, 1, 0,
@@ -468,7 +468,7 @@ If WINDOW is omitted or nil, it defaults to the selected window.
468Return nil if WINDOW has no previous sibling. */) 468Return nil if WINDOW has no previous sibling. */)
469 (Lisp_Object window) 469 (Lisp_Object window)
470{ 470{
471 return decode_any_window (window)->prev; 471 return WVAR (decode_any_window (window), prev);
472} 472}
473 473
474DEFUN ("window-combination-limit", Fwindow_combination_limit, Swindow_combination_limit, 1, 1, 0, 474DEFUN ("window-combination-limit", Fwindow_combination_limit, Swindow_combination_limit, 1, 1, 0,
@@ -478,7 +478,7 @@ WINDOW's siblings. A return value of t means that child windows of
478WINDOW are never \(re-)combined with WINDOW's siblings. */) 478WINDOW are never \(re-)combined with WINDOW's siblings. */)
479 (Lisp_Object window) 479 (Lisp_Object window)
480{ 480{
481 return decode_any_window (window)->combination_limit; 481 return WVAR (decode_any_window (window), combination_limit);
482} 482}
483 483
484DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_window_combination_limit, 2, 2, 0, 484DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_window_combination_limit, 2, 2, 0,
@@ -490,8 +490,8 @@ for future use. */)
490 (Lisp_Object window, Lisp_Object limit) 490 (Lisp_Object window, Lisp_Object limit)
491{ 491{
492 register struct window *w = decode_any_window (window); 492 register struct window *w = decode_any_window (window);
493 w->combination_limit = limit; 493 WVAR (w, combination_limit) = limit;
494 return w->combination_limit; 494 return WVAR (w, combination_limit);
495} 495}
496 496
497DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0, 497DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0,
@@ -517,7 +517,7 @@ On a graphical display, this total height is reported as an
517integer multiple of the default character height. */) 517integer multiple of the default character height. */)
518 (Lisp_Object window) 518 (Lisp_Object window)
519{ 519{
520 return decode_any_window (window)->total_lines; 520 return WVAR (decode_any_window (window), total_lines);
521} 521}
522 522
523DEFUN ("window-total-width", Fwindow_total_width, Swindow_total_width, 0, 1, 0, 523DEFUN ("window-total-width", Fwindow_total_width, Swindow_total_width, 0, 1, 0,
@@ -532,7 +532,7 @@ On a graphical display, this total width is reported as an
532integer multiple of the default character width. */) 532integer multiple of the default character width. */)
533 (Lisp_Object window) 533 (Lisp_Object window)
534{ 534{
535 return decode_any_window (window)->total_cols; 535 return WVAR (decode_any_window (window), total_cols);
536} 536}
537 537
538DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0, 538DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0,
@@ -540,7 +540,7 @@ DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0,
540If WINDOW is omitted or nil, it defaults to the selected window. */) 540If WINDOW is omitted or nil, it defaults to the selected window. */)
541 (Lisp_Object window) 541 (Lisp_Object window)
542{ 542{
543 return decode_any_window (window)->new_total; 543 return WVAR (decode_any_window (window), new_total);
544} 544}
545 545
546DEFUN ("window-normal-size", Fwindow_normal_size, Swindow_normal_size, 0, 2, 0, 546DEFUN ("window-normal-size", Fwindow_normal_size, Swindow_normal_size, 0, 2, 0,
@@ -550,9 +550,9 @@ If HORIZONTAL is non-nil, return the normal width of WINDOW. */)
550 (Lisp_Object window, Lisp_Object horizontal) 550 (Lisp_Object window, Lisp_Object horizontal)
551{ 551{
552 if (NILP (horizontal)) 552 if (NILP (horizontal))
553 return decode_any_window (window)->normal_lines; 553 return WVAR (decode_any_window (window), normal_lines);
554 else 554 else
555 return decode_any_window (window)->normal_cols; 555 return WVAR (decode_any_window (window), normal_cols);
556} 556}
557 557
558DEFUN ("window-new-normal", Fwindow_new_normal, Swindow_new_normal, 0, 1, 0, 558DEFUN ("window-new-normal", Fwindow_new_normal, Swindow_new_normal, 0, 1, 0,
@@ -560,7 +560,7 @@ DEFUN ("window-new-normal", Fwindow_new_normal, Swindow_new_normal, 0, 1, 0,
560If WINDOW is omitted or nil, it defaults to the selected window. */) 560If WINDOW is omitted or nil, it defaults to the selected window. */)
561 (Lisp_Object window) 561 (Lisp_Object window)
562{ 562{
563 return decode_any_window (window)->new_normal; 563 return WVAR (decode_any_window (window), new_normal);
564} 564}
565 565
566DEFUN ("window-left-column", Fwindow_left_column, Swindow_left_column, 0, 1, 0, 566DEFUN ("window-left-column", Fwindow_left_column, Swindow_left_column, 0, 1, 0,
@@ -572,7 +572,7 @@ value is 0 if there is no window to the left of WINDOW.
572If WINDOW is omitted or nil, it defaults to the selected window. */) 572If WINDOW is omitted or nil, it defaults to the selected window. */)
573 (Lisp_Object window) 573 (Lisp_Object window)
574{ 574{
575 return decode_any_window (window)->left_col; 575 return WVAR (decode_any_window (window), left_col);
576} 576}
577 577
578DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0, 578DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0,
@@ -584,7 +584,7 @@ there is no window above WINDOW.
584If WINDOW is omitted or nil, it defaults to the selected window. */) 584If WINDOW is omitted or nil, it defaults to the selected window. */)
585 (Lisp_Object window) 585 (Lisp_Object window)
586{ 586{
587 return decode_any_window (window)->top_line; 587 return WVAR (decode_any_window (window), top_line);
588} 588}
589 589
590/* Return the number of lines of W's body. Don't count any mode or 590/* Return the number of lines of W's body. Don't count any mode or
@@ -593,7 +593,7 @@ If WINDOW is omitted or nil, it defaults to the selected window. */)
593static int 593static int
594window_body_lines (struct window *w) 594window_body_lines (struct window *w)
595{ 595{
596 int height = XFASTINT (w->total_lines); 596 int height = XFASTINT (WVAR (w, total_lines));
597 597
598 if (!MINI_WINDOW_P (w)) 598 if (!MINI_WINDOW_P (w))
599 { 599 {
@@ -615,7 +615,7 @@ int
615window_body_cols (struct window *w) 615window_body_cols (struct window *w)
616{ 616{
617 struct frame *f = XFRAME (WINDOW_FRAME (w)); 617 struct frame *f = XFRAME (WINDOW_FRAME (w));
618 int width = XINT (w->total_cols); 618 int width = XINT (WVAR (w, total_cols));
619 619
620 if (WINDOW_HAS_VERTICAL_SCROLL_BAR (w)) 620 if (WINDOW_HAS_VERTICAL_SCROLL_BAR (w))
621 /* Scroll bars occupy a few columns. */ 621 /* Scroll bars occupy a few columns. */
@@ -690,7 +690,7 @@ set_window_hscroll (struct window *w, EMACS_INT hscroll)
690 690
691 /* Prevent redisplay shortcuts when changing the hscroll. */ 691 /* Prevent redisplay shortcuts when changing the hscroll. */
692 if (w->hscroll != new_hscroll) 692 if (w->hscroll != new_hscroll)
693 XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; 693 XBUFFER (WVAR (w, buffer))->prevent_redisplay_optimizations_p = 1;
694 694
695 w->hscroll = new_hscroll; 695 w->hscroll = new_hscroll;
696 return make_number (new_hscroll); 696 return make_number (new_hscroll);
@@ -719,7 +719,7 @@ WINDOW defaults to the selected window.
719See `set-window-redisplay-end-trigger' for more information. */) 719See `set-window-redisplay-end-trigger' for more information. */)
720 (Lisp_Object window) 720 (Lisp_Object window)
721{ 721{
722 return decode_window (window)->redisplay_end_trigger; 722 return WVAR (decode_window (window), redisplay_end_trigger);
723} 723}
724 724
725DEFUN ("set-window-redisplay-end-trigger", Fset_window_redisplay_end_trigger, 725DEFUN ("set-window-redisplay-end-trigger", Fset_window_redisplay_end_trigger,
@@ -735,7 +735,7 @@ Afterwards the end-trigger value is reset to nil. */)
735 register struct window *w; 735 register struct window *w;
736 736
737 w = decode_window (window); 737 w = decode_window (window);
738 w->redisplay_end_trigger = value; 738 WVAR (w, redisplay_end_trigger) = value;
739 return value; 739 return value;
740} 740}
741 741
@@ -785,7 +785,7 @@ of just the text area, use `window-inside-pixel-edges'. */)
785static void 785static void
786calc_absolute_offset (struct window *w, int *add_x, int *add_y) 786calc_absolute_offset (struct window *w, int *add_x, int *add_y)
787{ 787{
788 struct frame *f = XFRAME (w->frame); 788 struct frame *f = XFRAME (WVAR (w, frame));
789 *add_y = f->top_pos; 789 *add_y = f->top_pos;
790#ifdef FRAME_MENUBAR_HEIGHT 790#ifdef FRAME_MENUBAR_HEIGHT
791 *add_y += FRAME_MENUBAR_HEIGHT (f); 791 *add_y += FRAME_MENUBAR_HEIGHT (f);
@@ -1095,7 +1095,7 @@ If they are in the windows's left or right marginal areas, `left-margin'\n\
1095 1095
1096 CHECK_LIVE_WINDOW (window); 1096 CHECK_LIVE_WINDOW (window);
1097 w = XWINDOW (window); 1097 w = XWINDOW (window);
1098 f = XFRAME (w->frame); 1098 f = XFRAME (WVAR (w, frame));
1099 CHECK_CONS (coordinates); 1099 CHECK_CONS (coordinates);
1100 lx = Fcar (coordinates); 1100 lx = Fcar (coordinates);
1101 ly = Fcdr (coordinates); 1101 ly = Fcdr (coordinates);
@@ -1275,9 +1275,9 @@ But that is hard to define. */)
1275 register struct window *w = decode_window (window); 1275 register struct window *w = decode_window (window);
1276 1276
1277 if (w == XWINDOW (selected_window) 1277 if (w == XWINDOW (selected_window)
1278 && current_buffer == XBUFFER (w->buffer)) 1278 && current_buffer == XBUFFER (WVAR (w, buffer)))
1279 return Fpoint (); 1279 return Fpoint ();
1280 return Fmarker_position (w->pointm); 1280 return Fmarker_position (WVAR (w, pointm));
1281} 1281}
1282 1282
1283DEFUN ("window-start", Fwindow_start, Swindow_start, 0, 1, 0, 1283DEFUN ("window-start", Fwindow_start, Swindow_start, 0, 1, 0,
@@ -1286,7 +1286,7 @@ WINDOW must be a live window and defaults to the selected one.
1286This is updated by redisplay or by calling `set-window-start'. */) 1286This is updated by redisplay or by calling `set-window-start'. */)
1287 (Lisp_Object window) 1287 (Lisp_Object window)
1288{ 1288{
1289 return Fmarker_position (decode_window (window)->start); 1289 return Fmarker_position (WVAR (decode_window (window), start));
1290} 1290}
1291 1291
1292/* This is text temporarily removed from the doc string below. 1292/* This is text temporarily removed from the doc string below.
@@ -1317,7 +1317,7 @@ if it isn't already recorded. */)
1317 Lisp_Object buf; 1317 Lisp_Object buf;
1318 struct buffer *b; 1318 struct buffer *b;
1319 1319
1320 buf = w->buffer; 1320 buf = WVAR (w, buffer);
1321 CHECK_BUFFER (buf); 1321 CHECK_BUFFER (buf);
1322 b = XBUFFER (buf); 1322 b = XBUFFER (buf);
1323 1323
@@ -1326,12 +1326,12 @@ if it isn't already recorded. */)
1326 The user can compute it with vertical-motion if he wants to. 1326 The user can compute it with vertical-motion if he wants to.
1327 It would be nicer to do it automatically, 1327 It would be nicer to do it automatically,
1328 but that's so slow that it would probably bother people. */ 1328 but that's so slow that it would probably bother people. */
1329 if (NILP (w->window_end_valid)) 1329 if (NILP (WVAR (w, window_end_valid)))
1330 return Qnil; 1330 return Qnil;
1331#endif 1331#endif
1332 1332
1333 if (! NILP (update) 1333 if (! NILP (update)
1334 && ! (! NILP (w->window_end_valid) 1334 && ! (! NILP (WVAR (w, window_end_valid))
1335 && w->last_modified >= BUF_MODIFF (b) 1335 && w->last_modified >= BUF_MODIFF (b)
1336 && w->last_overlay_modified >= BUF_OVERLAY_MODIFF (b)) 1336 && w->last_overlay_modified >= BUF_OVERLAY_MODIFF (b))
1337 && !noninteractive) 1337 && !noninteractive)
@@ -1354,12 +1354,12 @@ if it isn't already recorded. */)
1354 `-l' containing a call to `rmail' with subsequent other 1354 `-l' containing a call to `rmail' with subsequent other
1355 commands. At the end, W->start happened to be BEG, while 1355 commands. At the end, W->start happened to be BEG, while
1356 rmail had already narrowed the buffer. */ 1356 rmail had already narrowed the buffer. */
1357 if (XMARKER (w->start)->charpos < BEGV) 1357 if (XMARKER (WVAR (w, start))->charpos < BEGV)
1358 SET_TEXT_POS (startp, BEGV, BEGV_BYTE); 1358 SET_TEXT_POS (startp, BEGV, BEGV_BYTE);
1359 else if (XMARKER (w->start)->charpos > ZV) 1359 else if (XMARKER (WVAR (w, start))->charpos > ZV)
1360 SET_TEXT_POS (startp, ZV, ZV_BYTE); 1360 SET_TEXT_POS (startp, ZV, ZV_BYTE);
1361 else 1361 else
1362 SET_TEXT_POS_FROM_MARKER (startp, w->start); 1362 SET_TEXT_POS_FROM_MARKER (startp, WVAR (w, start));
1363 1363
1364 itdata = bidi_shelve_cache (); 1364 itdata = bidi_shelve_cache ();
1365 start_display (&it, w, startp); 1365 start_display (&it, w, startp);
@@ -1373,7 +1373,7 @@ if it isn't already recorded. */)
1373 set_buffer_internal (old_buffer); 1373 set_buffer_internal (old_buffer);
1374 } 1374 }
1375 else 1375 else
1376 XSETINT (value, BUF_Z (b) - XFASTINT (w->window_end_pos)); 1376 XSETINT (value, BUF_Z (b) - XFASTINT (WVAR (w, window_end_pos)));
1377 1377
1378 return value; 1378 return value;
1379} 1379}
@@ -1387,10 +1387,10 @@ Return POS. */)
1387 1387
1388 CHECK_NUMBER_COERCE_MARKER (pos); 1388 CHECK_NUMBER_COERCE_MARKER (pos);
1389 if (w == XWINDOW (selected_window) 1389 if (w == XWINDOW (selected_window)
1390 && XBUFFER (w->buffer) == current_buffer) 1390 && XBUFFER (WVAR (w, buffer)) == current_buffer)
1391 Fgoto_char (pos); 1391 Fgoto_char (pos);
1392 else 1392 else
1393 set_marker_restricted (w->pointm, pos, w->buffer); 1393 set_marker_restricted (WVAR (w, pointm), pos, WVAR (w, buffer));
1394 1394
1395 /* We have to make sure that redisplay updates the window to show 1395 /* We have to make sure that redisplay updates the window to show
1396 the new value of point. */ 1396 the new value of point. */
@@ -1410,7 +1410,7 @@ overriding motion of point in order to display at this exact start. */)
1410 register struct window *w = decode_window (window); 1410 register struct window *w = decode_window (window);
1411 1411
1412 CHECK_NUMBER_COERCE_MARKER (pos); 1412 CHECK_NUMBER_COERCE_MARKER (pos);
1413 set_marker_restricted (w->start, pos, w->buffer); 1413 set_marker_restricted (WVAR (w, start), pos, WVAR (w, buffer));
1414 /* this is not right, but much easier than doing what is right. */ 1414 /* this is not right, but much easier than doing what is right. */
1415 w->start_at_line_beg = 0; 1415 w->start_at_line_beg = 0;
1416 if (NILP (noforce)) 1416 if (NILP (noforce))
@@ -1452,8 +1452,8 @@ display row, and VPOS is the row number (0-based) containing POS. */)
1452 int x, y; 1452 int x, y;
1453 1453
1454 w = decode_window (window); 1454 w = decode_window (window);
1455 buf = XBUFFER (w->buffer); 1455 buf = XBUFFER (WVAR (w, buffer));
1456 SET_TEXT_POS_FROM_MARKER (top, w->start); 1456 SET_TEXT_POS_FROM_MARKER (top, WVAR (w, start));
1457 1457
1458 if (EQ (pos, Qt)) 1458 if (EQ (pos, Qt))
1459 posint = -1; 1459 posint = -1;
@@ -1465,7 +1465,7 @@ display row, and VPOS is the row number (0-based) containing POS. */)
1465 else if (w == XWINDOW (selected_window)) 1465 else if (w == XWINDOW (selected_window))
1466 posint = PT; 1466 posint = PT;
1467 else 1467 else
1468 posint = XMARKER (w->pointm)->charpos; 1468 posint = XMARKER (WVAR (w, pointm))->charpos;
1469 1469
1470 /* If position is above window start or outside buffer boundaries, 1470 /* If position is above window start or outside buffer boundaries,
1471 or if window start is out of range, position is not visible. */ 1471 or if window start is out of range, position is not visible. */
@@ -1522,11 +1522,11 @@ Return nil if window display is not up-to-date. In that case, use
1522 if (noninteractive || w->pseudo_window_p) 1522 if (noninteractive || w->pseudo_window_p)
1523 return Qnil; 1523 return Qnil;
1524 1524
1525 CHECK_BUFFER (w->buffer); 1525 CHECK_BUFFER (WVAR (w, buffer));
1526 b = XBUFFER (w->buffer); 1526 b = XBUFFER (WVAR (w, buffer));
1527 1527
1528 /* Fail if current matrix is not up-to-date. */ 1528 /* Fail if current matrix is not up-to-date. */
1529 if (NILP (w->window_end_valid) 1529 if (NILP (WVAR (w, window_end_valid))
1530 || current_buffer->clip_changed 1530 || current_buffer->clip_changed
1531 || current_buffer->prevent_redisplay_optimizations_p 1531 || current_buffer->prevent_redisplay_optimizations_p
1532 || w->last_modified < BUF_MODIFF (b) 1532 || w->last_modified < BUF_MODIFF (b)
@@ -1619,7 +1619,7 @@ window, unless that window is "strongly" dedicated to its buffer, that
1619is the value returned by `window-dedicated-p' is t. */) 1619is the value returned by `window-dedicated-p' is t. */)
1620 (Lisp_Object window) 1620 (Lisp_Object window)
1621{ 1621{
1622 return decode_window (window)->dedicated; 1622 return WVAR (decode_window (window), dedicated);
1623} 1623}
1624 1624
1625DEFUN ("set-window-dedicated-p", Fset_window_dedicated_p, 1625DEFUN ("set-window-dedicated-p", Fset_window_dedicated_p,
@@ -1645,8 +1645,8 @@ window, it also makes sure that the window is no more dedicated. */)
1645{ 1645{
1646 register struct window *w = decode_window (window); 1646 register struct window *w = decode_window (window);
1647 1647
1648 w->dedicated = flag; 1648 WVAR (w, dedicated) = flag;
1649 return w->dedicated; 1649 return WVAR (w, dedicated);
1650} 1650}
1651 1651
1652DEFUN ("window-prev-buffers", Fwindow_prev_buffers, Swindow_prev_buffers, 1652DEFUN ("window-prev-buffers", Fwindow_prev_buffers, Swindow_prev_buffers,
@@ -1659,7 +1659,7 @@ where BUFFER is a buffer, WINDOW-START is the start position of the
1659window for that buffer, and POS is a window-specific point value. */) 1659window for that buffer, and POS is a window-specific point value. */)
1660 (Lisp_Object window) 1660 (Lisp_Object window)
1661{ 1661{
1662 return decode_window (window)->prev_buffers; 1662 return WVAR (decode_window (window), prev_buffers);
1663} 1663}
1664 1664
1665DEFUN ("set-window-prev-buffers", Fset_window_prev_buffers, 1665DEFUN ("set-window-prev-buffers", Fset_window_prev_buffers,
@@ -1672,7 +1672,7 @@ where BUFFER is a buffer, WINDOW-START is the start position of the
1672window for that buffer, and POS is a window-specific point value. */) 1672window for that buffer, and POS is a window-specific point value. */)
1673 (Lisp_Object window, Lisp_Object prev_buffers) 1673 (Lisp_Object window, Lisp_Object prev_buffers)
1674{ 1674{
1675 return decode_window (window)->prev_buffers = prev_buffers; 1675 return WVAR (decode_window (window), prev_buffers) = prev_buffers;
1676} 1676}
1677 1677
1678DEFUN ("window-next-buffers", Fwindow_next_buffers, Swindow_next_buffers, 1678DEFUN ("window-next-buffers", Fwindow_next_buffers, Swindow_next_buffers,
@@ -1681,7 +1681,7 @@ DEFUN ("window-next-buffers", Fwindow_next_buffers, Swindow_next_buffers,
1681WINDOW must be a live window and defaults to the selected one. */) 1681WINDOW must be a live window and defaults to the selected one. */)
1682 (Lisp_Object window) 1682 (Lisp_Object window)
1683{ 1683{
1684 return decode_window (window)->next_buffers; 1684 return WVAR (decode_window (window), next_buffers);
1685} 1685}
1686 1686
1687DEFUN ("set-window-next-buffers", Fset_window_next_buffers, 1687DEFUN ("set-window-next-buffers", Fset_window_next_buffers,
@@ -1691,7 +1691,7 @@ WINDOW must be a live window and defaults to the selected one.
1691NEXT-BUFFERS should be a list of buffers. */) 1691NEXT-BUFFERS should be a list of buffers. */)
1692 (Lisp_Object window, Lisp_Object next_buffers) 1692 (Lisp_Object window, Lisp_Object next_buffers)
1693{ 1693{
1694 return decode_window (window)->next_buffers = next_buffers; 1694 return WVAR (decode_window (window), next_buffers) = next_buffers;
1695} 1695}
1696 1696
1697DEFUN ("window-parameters", Fwindow_parameters, Swindow_parameters, 1697DEFUN ("window-parameters", Fwindow_parameters, Swindow_parameters,
@@ -1701,7 +1701,7 @@ WINDOW defaults to the selected window. The return value is a list of
1701elements of the form (PARAMETER . VALUE). */) 1701elements of the form (PARAMETER . VALUE). */)
1702 (Lisp_Object window) 1702 (Lisp_Object window)
1703{ 1703{
1704 return Fcopy_alist (decode_any_window (window)->window_parameters); 1704 return Fcopy_alist (WVAR (decode_any_window (window), window_parameters));
1705} 1705}
1706 1706
1707DEFUN ("window-parameter", Fwindow_parameter, Swindow_parameter, 1707DEFUN ("window-parameter", Fwindow_parameter, Swindow_parameter,
@@ -1712,7 +1712,8 @@ WINDOW defaults to the selected window. */)
1712{ 1712{
1713 Lisp_Object result; 1713 Lisp_Object result;
1714 1714
1715 result = Fassq (parameter, decode_any_window (window)->window_parameters); 1715 result = Fassq (parameter, WVAR (decode_any_window (window),
1716 window_parameters));
1716 return CDR_SAFE (result); 1717 return CDR_SAFE (result);
1717} 1718}
1718 1719
@@ -1725,9 +1726,10 @@ WINDOW defaults to the selected window. Return VALUE. */)
1725 register struct window *w = decode_any_window (window); 1726 register struct window *w = decode_any_window (window);
1726 Lisp_Object old_alist_elt; 1727 Lisp_Object old_alist_elt;
1727 1728
1728 old_alist_elt = Fassq (parameter, w->window_parameters); 1729 old_alist_elt = Fassq (parameter, WVAR (w, window_parameters));
1729 if (NILP (old_alist_elt)) 1730 if (NILP (old_alist_elt))
1730 w->window_parameters = Fcons (Fcons (parameter, value), w->window_parameters); 1731 WVAR (w, window_parameters)
1732 = Fcons (Fcons (parameter, value), WVAR (w, window_parameters));
1731 else 1733 else
1732 Fsetcdr (old_alist_elt, value); 1734 Fsetcdr (old_alist_elt, value);
1733 return value; 1735 return value;
@@ -1739,7 +1741,7 @@ DEFUN ("window-display-table", Fwindow_display_table, Swindow_display_table,
1739WINDOW defaults to the selected window. */) 1741WINDOW defaults to the selected window. */)
1740 (Lisp_Object window) 1742 (Lisp_Object window)
1741{ 1743{
1742 return decode_window (window)->display_table; 1744 return WVAR (decode_window (window), display_table);
1743} 1745}
1744 1746
1745/* Get the display table for use on window W. This is either W's 1747/* Get the display table for use on window W. This is either W's
@@ -1752,11 +1754,11 @@ window_display_table (struct window *w)
1752{ 1754{
1753 struct Lisp_Char_Table *dp = NULL; 1755 struct Lisp_Char_Table *dp = NULL;
1754 1756
1755 if (DISP_TABLE_P (w->display_table)) 1757 if (DISP_TABLE_P (WVAR (w, display_table)))
1756 dp = XCHAR_TABLE (w->display_table); 1758 dp = XCHAR_TABLE (WVAR (w, display_table));
1757 else if (BUFFERP (w->buffer)) 1759 else if (BUFFERP (WVAR (w, buffer)))
1758 { 1760 {
1759 struct buffer *b = XBUFFER (w->buffer); 1761 struct buffer *b = XBUFFER (WVAR (w, buffer));
1760 1762
1761 if (DISP_TABLE_P (BVAR (b, display_table))) 1763 if (DISP_TABLE_P (BVAR (b, display_table)))
1762 dp = XCHAR_TABLE (BVAR (b, display_table)); 1764 dp = XCHAR_TABLE (BVAR (b, display_table));
@@ -1774,7 +1776,7 @@ DEFUN ("set-window-display-table", Fset_window_display_table, Sset_window_displa
1774 register struct window *w; 1776 register struct window *w;
1775 1777
1776 w = decode_window (window); 1778 w = decode_window (window);
1777 w->display_table = table; 1779 WVAR (w, display_table) = table;
1778 return table; 1780 return table;
1779} 1781}
1780 1782
@@ -1786,14 +1788,14 @@ unshow_buffer (register struct window *w)
1786 Lisp_Object buf; 1788 Lisp_Object buf;
1787 struct buffer *b; 1789 struct buffer *b;
1788 1790
1789 buf = w->buffer; 1791 buf = WVAR (w, buffer);
1790 b = XBUFFER (buf); 1792 b = XBUFFER (buf);
1791 if (b != XMARKER (w->pointm)->buffer) 1793 if (b != XMARKER (WVAR (w, pointm))->buffer)
1792 abort (); 1794 abort ();
1793 1795
1794#if 0 1796#if 0
1795 if (w == XWINDOW (selected_window) 1797 if (w == XWINDOW (selected_window)
1796 || ! EQ (buf, XWINDOW (selected_window)->buffer)) 1798 || ! EQ (buf, WVAR (XWINDOW (selected_window), buffer)))
1797 /* Do this except when the selected window's buffer 1799 /* Do this except when the selected window's buffer
1798 is being removed from some other window. */ 1800 is being removed from some other window. */
1799#endif 1801#endif
@@ -1804,22 +1806,22 @@ unshow_buffer (register struct window *w)
1804 selected window, while last_window_start reflects another 1806 selected window, while last_window_start reflects another
1805 window which was recently showing the same buffer. 1807 window which was recently showing the same buffer.
1806 Some people might say that might be a good thing. Let's see. */ 1808 Some people might say that might be a good thing. Let's see. */
1807 b->last_window_start = marker_position (w->start); 1809 b->last_window_start = marker_position (WVAR (w, start));
1808 1810
1809 /* Point in the selected window's buffer 1811 /* Point in the selected window's buffer
1810 is actually stored in that buffer, and the window's pointm isn't used. 1812 is actually stored in that buffer, and the window's pointm isn't used.
1811 So don't clobber point in that buffer. */ 1813 So don't clobber point in that buffer. */
1812 if (! EQ (buf, XWINDOW (selected_window)->buffer) 1814 if (! EQ (buf, WVAR (XWINDOW (selected_window), buffer))
1813 /* This line helps to fix Horsley's testbug.el bug. */ 1815 /* This line helps to fix Horsley's testbug.el bug. */
1814 && !(WINDOWP (BVAR (b, last_selected_window)) 1816 && !(WINDOWP (BVAR (b, last_selected_window))
1815 && w != XWINDOW (BVAR (b, last_selected_window)) 1817 && w != XWINDOW (BVAR (b, last_selected_window))
1816 && EQ (buf, XWINDOW (BVAR (b, last_selected_window))->buffer))) 1818 && EQ (buf, WVAR (XWINDOW (BVAR (b, last_selected_window)), buffer))))
1817 temp_set_point_both (b, 1819 temp_set_point_both (b,
1818 clip_to_bounds (BUF_BEGV (b), 1820 clip_to_bounds (BUF_BEGV (b),
1819 XMARKER (w->pointm)->charpos, 1821 XMARKER (WVAR (w, pointm))->charpos,
1820 BUF_ZV (b)), 1822 BUF_ZV (b)),
1821 clip_to_bounds (BUF_BEGV_BYTE (b), 1823 clip_to_bounds (BUF_BEGV_BYTE (b),
1822 marker_byte_position (w->pointm), 1824 marker_byte_position (WVAR (w, pointm)),
1823 BUF_ZV_BYTE (b))); 1825 BUF_ZV_BYTE (b)));
1824 1826
1825 if (WINDOWP (BVAR (b, last_selected_window)) 1827 if (WINDOWP (BVAR (b, last_selected_window))
@@ -1838,19 +1840,19 @@ replace_window (Lisp_Object old, Lisp_Object new, int setflag)
1838 1840
1839 /* If OLD is its frame's root window, then NEW is the new 1841 /* If OLD is its frame's root window, then NEW is the new
1840 root window for that frame. */ 1842 root window for that frame. */
1841 if (EQ (old, FRAME_ROOT_WINDOW (XFRAME (o->frame)))) 1843 if (EQ (old, FRAME_ROOT_WINDOW (XFRAME (WVAR (o, frame)))))
1842 FRAME_ROOT_WINDOW (XFRAME (o->frame)) = new; 1844 FRAME_ROOT_WINDOW (XFRAME (WVAR (o, frame))) = new;
1843 1845
1844 if (setflag) 1846 if (setflag)
1845 { 1847 {
1846 n->left_col = o->left_col; 1848 WVAR (n, left_col) = WVAR (o, left_col);
1847 n->top_line = o->top_line; 1849 WVAR (n, top_line) = WVAR (o, top_line);
1848 n->total_cols = o->total_cols; 1850 WVAR (n, total_cols) = WVAR (o, total_cols);
1849 n->total_lines = o->total_lines; 1851 WVAR (n, total_lines) = WVAR (o, total_lines);
1850 n->normal_cols = o->normal_cols; 1852 WVAR (n, normal_cols) = WVAR (o, normal_cols);
1851 o->normal_cols = make_float (1.0); 1853 WVAR (o, normal_cols) = make_float (1.0);
1852 n->normal_lines = o->normal_lines; 1854 WVAR (n, normal_lines) = WVAR (o, normal_lines);
1853 o->normal_lines = make_float (1.0); 1855 WVAR (o, normal_lines) = make_float (1.0);
1854 n->desired_matrix = n->current_matrix = 0; 1856 n->desired_matrix = n->current_matrix = 0;
1855 n->vscroll = 0; 1857 n->vscroll = 0;
1856 memset (&n->cursor, 0, sizeof (n->cursor)); 1858 memset (&n->cursor, 0, sizeof (n->cursor));
@@ -1860,27 +1862,27 @@ replace_window (Lisp_Object old, Lisp_Object new, int setflag)
1860 n->phys_cursor_width = -1; 1862 n->phys_cursor_width = -1;
1861 n->must_be_updated_p = 0; 1863 n->must_be_updated_p = 0;
1862 n->pseudo_window_p = 0; 1864 n->pseudo_window_p = 0;
1863 XSETFASTINT (n->window_end_vpos, 0); 1865 XSETFASTINT (WVAR (n, window_end_vpos), 0);
1864 XSETFASTINT (n->window_end_pos, 0); 1866 XSETFASTINT (WVAR (n, window_end_pos), 0);
1865 n->window_end_valid = Qnil; 1867 WVAR (n, window_end_valid) = Qnil;
1866 n->frozen_window_start_p = 0; 1868 n->frozen_window_start_p = 0;
1867 } 1869 }
1868 1870
1869 n->next = tem = o->next; 1871 WVAR (n, next) = tem = WVAR (o, next);
1870 if (!NILP (tem)) 1872 if (!NILP (tem))
1871 XWINDOW (tem)->prev = new; 1873 WVAR (XWINDOW (tem), prev) = new;
1872 1874
1873 n->prev = tem = o->prev; 1875 WVAR (n, prev) = tem = WVAR (o, prev);
1874 if (!NILP (tem)) 1876 if (!NILP (tem))
1875 XWINDOW (tem)->next = new; 1877 WVAR (XWINDOW (tem), next) = new;
1876 1878
1877 n->parent = tem = o->parent; 1879 WVAR (n, parent) = tem = WVAR (o, parent);
1878 if (!NILP (tem)) 1880 if (!NILP (tem))
1879 { 1881 {
1880 if (EQ (XWINDOW (tem)->vchild, old)) 1882 if (EQ (WVAR (XWINDOW (tem), vchild), old))
1881 XWINDOW (tem)->vchild = new; 1883 WVAR (XWINDOW (tem), vchild) = new;
1882 if (EQ (XWINDOW (tem)->hchild, old)) 1884 if (EQ (WVAR (XWINDOW (tem), hchild), old))
1883 XWINDOW (tem)->hchild = new; 1885 WVAR (XWINDOW (tem), hchild) = new;
1884 } 1886 }
1885} 1887}
1886 1888
@@ -1896,64 +1898,64 @@ recombine_windows (Lisp_Object window)
1896 int horflag; 1898 int horflag;
1897 1899
1898 w = XWINDOW (window); 1900 w = XWINDOW (window);
1899 parent = w->parent; 1901 parent = WVAR (w, parent);
1900 if (!NILP (parent) && NILP (w->combination_limit)) 1902 if (!NILP (parent) && NILP (WVAR (w, combination_limit)))
1901 { 1903 {
1902 p = XWINDOW (parent); 1904 p = XWINDOW (parent);
1903 if (((!NILP (p->vchild) && !NILP (w->vchild)) 1905 if (((!NILP (WVAR (p, vchild)) && !NILP (WVAR (w, vchild)))
1904 || (!NILP (p->hchild) && !NILP (w->hchild)))) 1906 || (!NILP (WVAR (p, hchild)) && !NILP (WVAR (w, hchild)))))
1905 /* WINDOW and PARENT are both either a vertical or a horizontal 1907 /* WINDOW and PARENT are both either a vertical or a horizontal
1906 combination. */ 1908 combination. */
1907 { 1909 {
1908 horflag = NILP (w->vchild); 1910 horflag = NILP (WVAR (w, vchild));
1909 child = horflag ? w->hchild : w->vchild; 1911 child = horflag ? WVAR (w, hchild) : WVAR (w, vchild);
1910 c = XWINDOW (child); 1912 c = XWINDOW (child);
1911 1913
1912 /* Splice WINDOW's children into its parent's children and 1914 /* Splice WINDOW's children into its parent's children and
1913 assign new normal sizes. */ 1915 assign new normal sizes. */
1914 if (NILP (w->prev)) 1916 if (NILP (WVAR (w, prev)))
1915 if (horflag) 1917 if (horflag)
1916 p->hchild = child; 1918 WVAR (p, hchild) = child;
1917 else 1919 else
1918 p->vchild = child; 1920 WVAR (p, vchild) = child;
1919 else 1921 else
1920 { 1922 {
1921 c->prev = w->prev; 1923 WVAR (c, prev) = WVAR (w, prev);
1922 XWINDOW (w->prev)->next = child; 1924 WVAR (XWINDOW (WVAR (w, prev)), next) = child;
1923 } 1925 }
1924 1926
1925 while (c) 1927 while (c)
1926 { 1928 {
1927 c->parent = parent; 1929 WVAR (c, parent) = parent;
1928 1930
1929 if (horflag) 1931 if (horflag)
1930 c->normal_cols 1932 WVAR (c, normal_cols)
1931 = make_float (XFLOATINT (c->total_cols) 1933 = make_float (XFLOATINT (WVAR (c, total_cols))
1932 / XFLOATINT (p->total_cols)); 1934 / XFLOATINT (WVAR (p, total_cols)));
1933 else 1935 else
1934 c->normal_lines 1936 WVAR (c, normal_lines)
1935 = make_float (XFLOATINT (c->total_lines) 1937 = make_float (XFLOATINT (WVAR (c, total_lines))
1936 / XFLOATINT (p->total_lines)); 1938 / XFLOATINT (WVAR (p, total_lines)));
1937 1939
1938 if (NILP (c->next)) 1940 if (NILP (WVAR (c, next)))
1939 { 1941 {
1940 if (!NILP (w->next)) 1942 if (!NILP (WVAR (w, next)))
1941 { 1943 {
1942 c->next = w->next; 1944 WVAR (c, next) = WVAR (w, next);
1943 XWINDOW (c->next)->prev = child; 1945 WVAR (XWINDOW (WVAR (c, next)), prev) = child;
1944 } 1946 }
1945 1947
1946 c = 0; 1948 c = 0;
1947 } 1949 }
1948 else 1950 else
1949 { 1951 {
1950 child = c->next; 1952 child = WVAR (c, next);
1951 c = XWINDOW (child); 1953 c = XWINDOW (child);
1952 } 1954 }
1953 } 1955 }
1954 1956
1955 /* WINDOW can be deleted now. */ 1957 /* WINDOW can be deleted now. */
1956 w->vchild = w->hchild = Qnil; 1958 WVAR (w, vchild) = WVAR (w, hchild) = Qnil;
1957 } 1959 }
1958 } 1960 }
1959} 1961}
@@ -2036,10 +2038,10 @@ static int
2036candidate_window_p (Lisp_Object window, Lisp_Object owindow, Lisp_Object minibuf, Lisp_Object all_frames) 2038candidate_window_p (Lisp_Object window, Lisp_Object owindow, Lisp_Object minibuf, Lisp_Object all_frames)
2037{ 2039{
2038 struct window *w = XWINDOW (window); 2040 struct window *w = XWINDOW (window);
2039 struct frame *f = XFRAME (w->frame); 2041 struct frame *f = XFRAME (WVAR (w, frame));
2040 int candidate_p = 1; 2042 int candidate_p = 1;
2041 2043
2042 if (!BUFFERP (w->buffer)) 2044 if (!BUFFERP (WVAR (w, buffer)))
2043 candidate_p = 0; 2045 candidate_p = 0;
2044 else if (MINI_WINDOW_P (w) 2046 else if (MINI_WINDOW_P (w)
2045 && (EQ (minibuf, Qlambda) 2047 && (EQ (minibuf, Qlambda)
@@ -2054,13 +2056,13 @@ candidate_window_p (Lisp_Object window, Lisp_Object owindow, Lisp_Object minibuf
2054 else if (NILP (all_frames)) 2056 else if (NILP (all_frames))
2055 { 2057 {
2056 eassert (WINDOWP (owindow)); 2058 eassert (WINDOWP (owindow));
2057 candidate_p = EQ (w->frame, XWINDOW (owindow)->frame); 2059 candidate_p = EQ (WVAR (w, frame), WVAR (XWINDOW (owindow), frame));
2058 } 2060 }
2059 else if (EQ (all_frames, Qvisible)) 2061 else if (EQ (all_frames, Qvisible))
2060 { 2062 {
2061 FRAME_SAMPLE_VISIBILITY (f); 2063 FRAME_SAMPLE_VISIBILITY (f);
2062 candidate_p = FRAME_VISIBLE_P (f) 2064 candidate_p = FRAME_VISIBLE_P (f)
2063 && (FRAME_TERMINAL (XFRAME (w->frame)) 2065 && (FRAME_TERMINAL (XFRAME (WVAR (w, frame)))
2064 == FRAME_TERMINAL (XFRAME (selected_frame))); 2066 == FRAME_TERMINAL (XFRAME (selected_frame)));
2065 2067
2066 } 2068 }
@@ -2079,15 +2081,15 @@ candidate_window_p (Lisp_Object window, Lisp_Object owindow, Lisp_Object minibuf
2079 && !f->output_data.x->has_been_visible) 2081 && !f->output_data.x->has_been_visible)
2080#endif 2082#endif
2081 ) 2083 )
2082 && (FRAME_TERMINAL (XFRAME (w->frame)) 2084 && (FRAME_TERMINAL (XFRAME (WVAR (w, frame)))
2083 == FRAME_TERMINAL (XFRAME (selected_frame))); 2085 == FRAME_TERMINAL (XFRAME (selected_frame)));
2084 } 2086 }
2085 else if (WINDOWP (all_frames)) 2087 else if (WINDOWP (all_frames))
2086 candidate_p = (EQ (FRAME_MINIBUF_WINDOW (f), all_frames) 2088 candidate_p = (EQ (FRAME_MINIBUF_WINDOW (f), all_frames)
2087 || EQ (XWINDOW (all_frames)->frame, w->frame) 2089 || EQ (WVAR (XWINDOW (all_frames), frame), WVAR (w, frame))
2088 || EQ (XWINDOW (all_frames)->frame, FRAME_FOCUS_FRAME (f))); 2090 || EQ (WVAR (XWINDOW (all_frames), frame), FRAME_FOCUS_FRAME (f)));
2089 else if (FRAMEP (all_frames)) 2091 else if (FRAMEP (all_frames))
2090 candidate_p = EQ (all_frames, w->frame); 2092 candidate_p = EQ (all_frames, WVAR (w, frame));
2091 2093
2092 return candidate_p; 2094 return candidate_p;
2093} 2095}
@@ -2118,9 +2120,10 @@ decode_next_window_args (Lisp_Object *window, Lisp_Object *minibuf, Lisp_Object
2118 2120
2119 /* ALL_FRAMES nil doesn't specify which frames to include. */ 2121 /* ALL_FRAMES nil doesn't specify which frames to include. */
2120 if (NILP (*all_frames)) 2122 if (NILP (*all_frames))
2121 *all_frames = (!EQ (*minibuf, Qlambda) 2123 *all_frames
2122 ? FRAME_MINIBUF_WINDOW (XFRAME (XWINDOW (*window)->frame)) 2124 = (!EQ (*minibuf, Qlambda)
2123 : Qnil); 2125 ? FRAME_MINIBUF_WINDOW (XFRAME (WVAR (XWINDOW (*window), frame)))
2126 : Qnil);
2124 else if (EQ (*all_frames, Qvisible)) 2127 else if (EQ (*all_frames, Qvisible))
2125 ; 2128 ;
2126 else if (EQ (*all_frames, make_number (0))) 2129 else if (EQ (*all_frames, make_number (0)))
@@ -2145,7 +2148,7 @@ next_window (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames, in
2145 /* If ALL_FRAMES is a frame, and WINDOW isn't on that frame, just 2148 /* If ALL_FRAMES is a frame, and WINDOW isn't on that frame, just
2146 return the first window on the frame. */ 2149 return the first window on the frame. */
2147 if (FRAMEP (all_frames) 2150 if (FRAMEP (all_frames)
2148 && !EQ (all_frames, XWINDOW (window)->frame)) 2151 && !EQ (all_frames, WVAR (XWINDOW (window), frame)))
2149 return Fframe_first_window (all_frames); 2152 return Fframe_first_window (all_frames);
2150 2153
2151 if (next_p) 2154 if (next_p)
@@ -2325,7 +2328,7 @@ MINIBUF neither nil nor t means never include the minibuffer window. */)
2325 if (NILP (frame)) 2328 if (NILP (frame))
2326 frame = selected_frame; 2329 frame = selected_frame;
2327 2330
2328 if (!EQ (frame, XWINDOW (window)->frame)) 2331 if (!EQ (frame, WVAR (XWINDOW (window), frame)))
2329 error ("Window is on a different frame"); 2332 error ("Window is on a different frame");
2330 2333
2331 return window_list_1 (window, minibuf, frame); 2334 return window_list_1 (window, minibuf, frame);
@@ -2446,7 +2449,7 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame
2446 switch (type) 2449 switch (type)
2447 { 2450 {
2448 case GET_BUFFER_WINDOW: 2451 case GET_BUFFER_WINDOW:
2449 if (EQ (w->buffer, obj) 2452 if (EQ (WVAR (w, buffer), obj)
2450 /* Don't find any minibuffer window except the one that 2453 /* Don't find any minibuffer window except the one that
2451 is currently in use. */ 2454 is currently in use. */
2452 && (MINI_WINDOW_P (w) ? EQ (window, minibuf_window) : 1)) 2455 && (MINI_WINDOW_P (w) ? EQ (window, minibuf_window) : 1))
@@ -2454,7 +2457,7 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame
2454 if (EQ (window, selected_window)) 2457 if (EQ (window, selected_window))
2455 /* Preferably return the selected window. */ 2458 /* Preferably return the selected window. */
2456 RETURN_UNGCPRO (window); 2459 RETURN_UNGCPRO (window);
2457 else if (EQ (XWINDOW (window)->frame, selected_frame) 2460 else if (EQ (WVAR (XWINDOW (window), frame), selected_frame)
2458 && !frame_best_window_flag) 2461 && !frame_best_window_flag)
2459 /* Prefer windows on the current frame (but don't 2462 /* Prefer windows on the current frame (but don't
2460 choose another one if we have one already). */ 2463 choose another one if we have one already). */
@@ -2470,25 +2473,25 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame
2470 case REPLACE_BUFFER_IN_WINDOWS_SAFELY: 2473 case REPLACE_BUFFER_IN_WINDOWS_SAFELY:
2471 /* We could simply check whether the buffer shown by window 2474 /* We could simply check whether the buffer shown by window
2472 is live, and show another buffer in case it isn't. */ 2475 is live, and show another buffer in case it isn't. */
2473 if (EQ (w->buffer, obj)) 2476 if (EQ (WVAR (w, buffer), obj))
2474 { 2477 {
2475 /* Undedicate WINDOW. */ 2478 /* Undedicate WINDOW. */
2476 w->dedicated = Qnil; 2479 WVAR (w, dedicated) = Qnil;
2477 /* Make WINDOW show the buffer returned by 2480 /* Make WINDOW show the buffer returned by
2478 other_buffer_safely, don't run any hooks. */ 2481 other_buffer_safely, don't run any hooks. */
2479 set_window_buffer 2482 set_window_buffer
2480 (window, other_buffer_safely (w->buffer), 0, 0); 2483 (window, other_buffer_safely (WVAR (w, buffer)), 0, 0);
2481 /* If WINDOW is the selected window, make its buffer 2484 /* If WINDOW is the selected window, make its buffer
2482 current. But do so only if the window shows the 2485 current. But do so only if the window shows the
2483 current buffer (Bug#6454). */ 2486 current buffer (Bug#6454). */
2484 if (EQ (window, selected_window) 2487 if (EQ (window, selected_window)
2485 && XBUFFER (w->buffer) == current_buffer) 2488 && XBUFFER (WVAR (w, buffer)) == current_buffer)
2486 Fset_buffer (w->buffer); 2489 Fset_buffer (WVAR (w, buffer));
2487 } 2490 }
2488 break; 2491 break;
2489 2492
2490 case REDISPLAY_BUFFER_WINDOWS: 2493 case REDISPLAY_BUFFER_WINDOWS:
2491 if (EQ (w->buffer, obj)) 2494 if (EQ (WVAR (w, buffer), obj))
2492 { 2495 {
2493 mark_window_display_accurate (window, 0); 2496 mark_window_display_accurate (window, 0);
2494 w->update_mode_line = 1; 2497 w->update_mode_line = 1;
@@ -2500,8 +2503,8 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame
2500 2503
2501 /* Check for a window that has a killed buffer. */ 2504 /* Check for a window that has a killed buffer. */
2502 case CHECK_ALL_WINDOWS: 2505 case CHECK_ALL_WINDOWS:
2503 if (! NILP (w->buffer) 2506 if (! NILP (WVAR (w, buffer))
2504 && NILP (BVAR (XBUFFER (w->buffer), name))) 2507 && NILP (BVAR (XBUFFER (WVAR (w, buffer)), name)))
2505 abort (); 2508 abort ();
2506 break; 2509 break;
2507 2510
@@ -2588,7 +2591,7 @@ window-start value is reasonable when this function is called. */)
2588 2591
2589 w = decode_any_window (window); 2592 w = decode_any_window (window);
2590 XSETWINDOW (window, w); 2593 XSETWINDOW (window, w);
2591 f = XFRAME (w->frame); 2594 f = XFRAME (WVAR (w, frame));
2592 2595
2593 if (NILP (root)) 2596 if (NILP (root))
2594 /* ROOT is the frame's root window. */ 2597 /* ROOT is the frame's root window. */
@@ -2600,12 +2603,12 @@ window-start value is reasonable when this function is called. */)
2600 /* ROOT must be an ancestor of WINDOW. */ 2603 /* ROOT must be an ancestor of WINDOW. */
2601 { 2604 {
2602 r = decode_any_window (root); 2605 r = decode_any_window (root);
2603 pwindow = XWINDOW (window)->parent; 2606 pwindow = WVAR (XWINDOW (window), parent);
2604 while (!NILP (pwindow)) 2607 while (!NILP (pwindow))
2605 if (EQ (pwindow, root)) 2608 if (EQ (pwindow, root))
2606 break; 2609 break;
2607 else 2610 else
2608 pwindow = XWINDOW (pwindow)->parent; 2611 pwindow = WVAR (XWINDOW (pwindow), parent);
2609 if (!EQ (pwindow, root)) 2612 if (!EQ (pwindow, root))
2610 error ("Specified root is not an ancestor of specified window"); 2613 error ("Specified root is not an ancestor of specified window");
2611 } 2614 }
@@ -2619,15 +2622,15 @@ window-start value is reasonable when this function is called. */)
2619 else if (MINI_WINDOW_P (w)) /* && top > 0) */ 2622 else if (MINI_WINDOW_P (w)) /* && top > 0) */
2620 error ("Can't expand minibuffer to full frame"); 2623 error ("Can't expand minibuffer to full frame");
2621 2624
2622 if (!NILP (w->buffer)) 2625 if (!NILP (WVAR (w, buffer)))
2623 { 2626 {
2624 startpos = marker_position (w->start); 2627 startpos = marker_position (WVAR (w, start));
2625 top = WINDOW_TOP_EDGE_LINE (w) 2628 top = WINDOW_TOP_EDGE_LINE (w)
2626 - FRAME_TOP_MARGIN (XFRAME (WINDOW_FRAME (w))); 2629 - FRAME_TOP_MARGIN (XFRAME (WINDOW_FRAME (w)));
2627 /* Make sure WINDOW is the frame's selected window. */ 2630 /* Make sure WINDOW is the frame's selected window. */
2628 if (!EQ (window, FRAME_SELECTED_WINDOW (f))) 2631 if (!EQ (window, FRAME_SELECTED_WINDOW (f)))
2629 { 2632 {
2630 if (EQ (selected_frame, w->frame)) 2633 if (EQ (selected_frame, WVAR (w, frame)))
2631 Fselect_window (window, Qnil); 2634 Fselect_window (window, Qnil);
2632 else 2635 else
2633 FRAME_SELECTED_WINDOW (f) = window; 2636 FRAME_SELECTED_WINDOW (f) = window;
@@ -2644,7 +2647,7 @@ window-start value is reasonable when this function is called. */)
2644 { 2647 {
2645 pwindow = swindow; 2648 pwindow = swindow;
2646 while (!NILP (pwindow) && !EQ (window, pwindow)) 2649 while (!NILP (pwindow) && !EQ (window, pwindow))
2647 pwindow = XWINDOW (pwindow)->parent; 2650 pwindow = WVAR (XWINDOW (pwindow), parent);
2648 2651
2649 if (EQ (window, pwindow)) 2652 if (EQ (window, pwindow))
2650 /* If WINDOW is an ancestor of SWINDOW, then SWINDOW is ok 2653 /* If WINDOW is an ancestor of SWINDOW, then SWINDOW is ok
@@ -2657,7 +2660,7 @@ window-start value is reasonable when this function is called. */)
2657 2660
2658 if (!EQ (swindow, FRAME_SELECTED_WINDOW (f))) 2661 if (!EQ (swindow, FRAME_SELECTED_WINDOW (f)))
2659 { 2662 {
2660 if (EQ (selected_frame, w->frame)) 2663 if (EQ (selected_frame, WVAR (w, frame)))
2661 Fselect_window (swindow, Qnil); 2664 Fselect_window (swindow, Qnil);
2662 else 2665 else
2663 FRAME_SELECTED_WINDOW (f) = swindow; 2666 FRAME_SELECTED_WINDOW (f) = swindow;
@@ -2690,11 +2693,12 @@ window-start value is reasonable when this function is called. */)
2690 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 2693 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
2691 resize_failed = 0; 2694 resize_failed = 0;
2692 2695
2693 if (NILP (w->buffer)) 2696 if (NILP (WVAR (w, buffer)))
2694 { 2697 {
2695 /* Resize child windows vertically. */ 2698 /* Resize child windows vertically. */
2696 XSETINT (delta, XINT (r->total_lines) - XINT (w->total_lines)); 2699 XSETINT (delta, XINT (WVAR (r, total_lines))
2697 w->top_line = r->top_line; 2700 - XINT (WVAR (w, total_lines)));
2701 WVAR (w, top_line) = WVAR (r, top_line);
2698 resize_root_window (window, delta, Qnil, Qnil); 2702 resize_root_window (window, delta, Qnil, Qnil);
2699 if (window_resize_check (w, 0)) 2703 if (window_resize_check (w, 0))
2700 window_resize_apply (w, 0); 2704 window_resize_apply (w, 0);
@@ -2710,9 +2714,10 @@ window-start value is reasonable when this function is called. */)
2710 /* Resize child windows horizontally. */ 2714 /* Resize child windows horizontally. */
2711 if (!resize_failed) 2715 if (!resize_failed)
2712 { 2716 {
2713 w->left_col = r->left_col; 2717 WVAR (w, left_col) = WVAR (r, left_col);
2714 XSETINT (delta, XINT (r->total_cols) - XINT (w->total_cols)); 2718 XSETINT (delta, XINT (WVAR (r, total_cols))
2715 w->left_col = r->left_col; 2719 - XINT (WVAR (w, total_cols)));
2720 WVAR (w, left_col) = WVAR (r, left_col);
2716 resize_root_window (window, delta, Qt, Qnil); 2721 resize_root_window (window, delta, Qt, Qnil);
2717 if (window_resize_check (w, 1)) 2722 if (window_resize_check (w, 1))
2718 window_resize_apply (w, 1); 2723 window_resize_apply (w, 1);
@@ -2735,43 +2740,43 @@ window-start value is reasonable when this function is called. */)
2735 } 2740 }
2736 2741
2737 /* Cleanly unlink WINDOW from window-tree. */ 2742 /* Cleanly unlink WINDOW from window-tree. */
2738 if (!NILP (w->prev)) 2743 if (!NILP (WVAR (w, prev)))
2739 /* Get SIBLING above (on the left of) WINDOW. */ 2744 /* Get SIBLING above (on the left of) WINDOW. */
2740 { 2745 {
2741 sibling = w->prev; 2746 sibling = WVAR (w, prev);
2742 s = XWINDOW (sibling); 2747 s = XWINDOW (sibling);
2743 s->next = w->next; 2748 WVAR (s, next) = WVAR (w, next);
2744 if (!NILP (s->next)) 2749 if (!NILP (WVAR (s, next)))
2745 XWINDOW (s->next)->prev = sibling; 2750 WVAR (XWINDOW (WVAR (s, next)), prev) = sibling;
2746 } 2751 }
2747 else 2752 else
2748 /* Get SIBLING below (on the right of) WINDOW. */ 2753 /* Get SIBLING below (on the right of) WINDOW. */
2749 { 2754 {
2750 sibling = w->next; 2755 sibling = WVAR (w, next);
2751 s = XWINDOW (sibling); 2756 s = XWINDOW (sibling);
2752 s->prev = Qnil; 2757 WVAR (s, prev) = Qnil;
2753 if (!NILP (XWINDOW (w->parent)->vchild)) 2758 if (!NILP (WVAR (XWINDOW (WVAR (w, parent)), vchild)))
2754 XWINDOW (w->parent)->vchild = sibling; 2759 WVAR (XWINDOW (WVAR (w, parent)), vchild) = sibling;
2755 else 2760 else
2756 XWINDOW (w->parent)->hchild = sibling; 2761 WVAR (XWINDOW (WVAR (w, parent)), hchild) = sibling;
2757 } 2762 }
2758 2763
2759 /* Delete ROOT and all child windows of ROOT. */ 2764 /* Delete ROOT and all child windows of ROOT. */
2760 if (!NILP (r->vchild)) 2765 if (!NILP (WVAR (r, vchild)))
2761 { 2766 {
2762 delete_all_child_windows (r->vchild); 2767 delete_all_child_windows (WVAR (r, vchild));
2763 r->vchild = Qnil; 2768 WVAR (r, vchild) = Qnil;
2764 } 2769 }
2765 else if (!NILP (r->hchild)) 2770 else if (!NILP (WVAR (r, hchild)))
2766 { 2771 {
2767 delete_all_child_windows (r->hchild); 2772 delete_all_child_windows (WVAR (r, hchild));
2768 r->hchild = Qnil; 2773 WVAR (r, hchild) = Qnil;
2769 } 2774 }
2770 2775
2771 replace_window (root, window, 1); 2776 replace_window (root, window, 1);
2772 2777
2773 /* This must become SWINDOW anyway ....... */ 2778 /* This must become SWINDOW anyway ....... */
2774 if (!NILP (w->buffer) && !resize_failed) 2779 if (!NILP (WVAR (w, buffer)) && !resize_failed)
2775 { 2780 {
2776 /* Try to minimize scrolling, by setting the window start to the 2781 /* Try to minimize scrolling, by setting the window start to the
2777 point will cause the text at the old window start to be at the 2782 point will cause the text at the old window start to be at the
@@ -2780,19 +2785,19 @@ window-start value is reasonable when this function is called. */)
2780 when the display is not current, due to typeahead). */ 2785 when the display is not current, due to typeahead). */
2781 new_top = WINDOW_TOP_EDGE_LINE (w) - FRAME_TOP_MARGIN (XFRAME (WINDOW_FRAME (w))); 2786 new_top = WINDOW_TOP_EDGE_LINE (w) - FRAME_TOP_MARGIN (XFRAME (WINDOW_FRAME (w)));
2782 if (new_top != top 2787 if (new_top != top
2783 && startpos >= BUF_BEGV (XBUFFER (w->buffer)) 2788 && startpos >= BUF_BEGV (XBUFFER (WVAR (w, buffer)))
2784 && startpos <= BUF_ZV (XBUFFER (w->buffer))) 2789 && startpos <= BUF_ZV (XBUFFER (WVAR (w, buffer))))
2785 { 2790 {
2786 struct position pos; 2791 struct position pos;
2787 struct buffer *obuf = current_buffer; 2792 struct buffer *obuf = current_buffer;
2788 2793
2789 Fset_buffer (w->buffer); 2794 Fset_buffer (WVAR (w, buffer));
2790 /* This computation used to temporarily move point, but that 2795 /* This computation used to temporarily move point, but that
2791 can have unwanted side effects due to text properties. */ 2796 can have unwanted side effects due to text properties. */
2792 pos = *vmotion (startpos, -top, w); 2797 pos = *vmotion (startpos, -top, w);
2793 2798
2794 set_marker_both (w->start, w->buffer, pos.bufpos, pos.bytepos); 2799 set_marker_both (WVAR (w, start), WVAR (w, buffer), pos.bufpos, pos.bytepos);
2795 w->window_end_valid = Qnil; 2800 WVAR (w, window_end_valid) = Qnil;
2796 w->start_at_line_beg = (pos.bytepos == BEGV_BYTE 2801 w->start_at_line_beg = (pos.bytepos == BEGV_BYTE
2797 || FETCH_BYTE (pos.bytepos - 1) == '\n'); 2802 || FETCH_BYTE (pos.bytepos - 1) == '\n');
2798 /* We need to do this, so that the window-scroll-functions 2803 /* We need to do this, so that the window-scroll-functions
@@ -2882,13 +2887,13 @@ adjust_window_margins (struct window *w)
2882 if (WINDOW_RIGHT_MARGIN_COLS (w) > 0) 2887 if (WINDOW_RIGHT_MARGIN_COLS (w) > 0)
2883 { 2888 {
2884 if (WINDOW_LEFT_MARGIN_COLS (w) > 0) 2889 if (WINDOW_LEFT_MARGIN_COLS (w) > 0)
2885 w->left_margin_cols = w->right_margin_cols 2890 WVAR (w, left_margin_cols) = WVAR (w, right_margin_cols)
2886 = make_number (margin_cols/2); 2891 = make_number (margin_cols/2);
2887 else 2892 else
2888 w->right_margin_cols = make_number (margin_cols); 2893 WVAR (w, right_margin_cols) = make_number (margin_cols);
2889 } 2894 }
2890 else 2895 else
2891 w->left_margin_cols = make_number (margin_cols); 2896 WVAR (w, left_margin_cols) = make_number (margin_cols);
2892 return 1; 2897 return 1;
2893} 2898}
2894 2899
@@ -2986,9 +2991,9 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
2986 struct window *w = XWINDOW (window); 2991 struct window *w = XWINDOW (window);
2987 struct buffer *b = XBUFFER (buffer); 2992 struct buffer *b = XBUFFER (buffer);
2988 ptrdiff_t count = SPECPDL_INDEX (); 2993 ptrdiff_t count = SPECPDL_INDEX ();
2989 int samebuf = EQ (buffer, w->buffer); 2994 int samebuf = EQ (buffer, WVAR (w, buffer));
2990 2995
2991 w->buffer = buffer; 2996 WVAR (w, buffer) = buffer;
2992 2997
2993 if (EQ (window, selected_window)) 2998 if (EQ (window, selected_window))
2994 BVAR (b, last_selected_window) = window; 2999 BVAR (b, last_selected_window) = window;
@@ -3001,10 +3006,10 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
3001 XSETINT (BVAR (b, display_count), XINT (BVAR (b, display_count)) + 1); 3006 XSETINT (BVAR (b, display_count), XINT (BVAR (b, display_count)) + 1);
3002 BVAR (b, display_time) = Fcurrent_time (); 3007 BVAR (b, display_time) = Fcurrent_time ();
3003 3008
3004 XSETFASTINT (w->window_end_pos, 0); 3009 XSETFASTINT (WVAR (w, window_end_pos), 0);
3005 XSETFASTINT (w->window_end_vpos, 0); 3010 XSETFASTINT (WVAR (w, window_end_vpos), 0);
3006 memset (&w->last_cursor, 0, sizeof w->last_cursor); 3011 memset (&w->last_cursor, 0, sizeof w->last_cursor);
3007 w->window_end_valid = Qnil; 3012 WVAR (w, window_end_valid) = Qnil;
3008 if (!(keep_margins_p && samebuf)) 3013 if (!(keep_margins_p && samebuf))
3009 { /* If we're not actually changing the buffer, don't reset hscroll and 3014 { /* If we're not actually changing the buffer, don't reset hscroll and
3010 vscroll. This case happens for example when called from 3015 vscroll. This case happens for example when called from
@@ -3016,8 +3021,8 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
3016 whenever we resize the frame. */ 3021 whenever we resize the frame. */
3017 w->hscroll = w->min_hscroll = 0; 3022 w->hscroll = w->min_hscroll = 0;
3018 w->vscroll = 0; 3023 w->vscroll = 0;
3019 set_marker_both (w->pointm, buffer, BUF_PT (b), BUF_PT_BYTE (b)); 3024 set_marker_both (WVAR (w, pointm), buffer, BUF_PT (b), BUF_PT_BYTE (b));
3020 set_marker_restricted (w->start, 3025 set_marker_restricted (WVAR (w, start),
3021 make_number (b->last_window_start), 3026 make_number (b->last_window_start),
3022 buffer); 3027 buffer);
3023 w->start_at_line_beg = 0; 3028 w->start_at_line_beg = 0;
@@ -3038,7 +3043,7 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
3038 Fset_buffer (buffer); 3043 Fset_buffer (buffer);
3039 } 3044 }
3040 3045
3041 XMARKER (w->pointm)->insertion_type = !NILP (Vwindow_point_insertion_type); 3046 XMARKER (WVAR (w, pointm))->insertion_type = !NILP (Vwindow_point_insertion_type);
3042 3047
3043 if (!keep_margins_p) 3048 if (!keep_margins_p)
3044 { 3049 {
@@ -3046,10 +3051,10 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
3046 3051
3047 /* This may call adjust_window_margins three times, so 3052 /* This may call adjust_window_margins three times, so
3048 temporarily disable window margins. */ 3053 temporarily disable window margins. */
3049 Lisp_Object save_left = w->left_margin_cols; 3054 Lisp_Object save_left = WVAR (w, left_margin_cols);
3050 Lisp_Object save_right = w->right_margin_cols; 3055 Lisp_Object save_right = WVAR (w, right_margin_cols);
3051 3056
3052 w->left_margin_cols = w->right_margin_cols = Qnil; 3057 WVAR (w, left_margin_cols) = WVAR (w, right_margin_cols) = Qnil;
3053 3058
3054 Fset_window_fringes (window, 3059 Fset_window_fringes (window,
3055 BVAR (b, left_fringe_width), BVAR (b, right_fringe_width), 3060 BVAR (b, left_fringe_width), BVAR (b, right_fringe_width),
@@ -3059,8 +3064,8 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
3059 BVAR (b, scroll_bar_width), 3064 BVAR (b, scroll_bar_width),
3060 BVAR (b, vertical_scroll_bar_type), Qnil); 3065 BVAR (b, vertical_scroll_bar_type), Qnil);
3061 3066
3062 w->left_margin_cols = save_left; 3067 WVAR (w, left_margin_cols) = save_left;
3063 w->right_margin_cols = save_right; 3068 WVAR (w, right_margin_cols) = save_right;
3064 3069
3065 Fset_window_margins (window, 3070 Fset_window_margins (window,
3066 BVAR (b, left_margin_cols), BVAR (b, right_margin_cols)); 3071 BVAR (b, left_margin_cols), BVAR (b, right_margin_cols));
@@ -3070,7 +3075,7 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
3070 { 3075 {
3071 if (! NILP (Vwindow_scroll_functions)) 3076 if (! NILP (Vwindow_scroll_functions))
3072 run_hook_with_args_2 (Qwindow_scroll_functions, window, 3077 run_hook_with_args_2 (Qwindow_scroll_functions, window,
3073 Fmarker_position (w->start)); 3078 Fmarker_position (WVAR (w, start)));
3074 run_window_configuration_change_hook (XFRAME (WINDOW_FRAME (w))); 3079 run_window_configuration_change_hook (XFRAME (WINDOW_FRAME (w)));
3075 } 3080 }
3076 3081
@@ -3104,7 +3109,7 @@ This function runs `window-scroll-functions' before running
3104 if (NILP (BVAR (XBUFFER (buffer), name))) 3109 if (NILP (BVAR (XBUFFER (buffer), name)))
3105 error ("Attempt to display deleted buffer"); 3110 error ("Attempt to display deleted buffer");
3106 3111
3107 tem = w->buffer; 3112 tem = WVAR (w, buffer);
3108 if (NILP (tem)) 3113 if (NILP (tem))
3109 error ("Window is deleted"); 3114 error ("Window is deleted");
3110 else if (!EQ (tem, Qt)) 3115 else if (!EQ (tem, Qt))
@@ -3112,14 +3117,14 @@ This function runs `window-scroll-functions' before running
3112 { 3117 {
3113 if (!EQ (tem, buffer)) 3118 if (!EQ (tem, buffer))
3114 { 3119 {
3115 if (EQ (w->dedicated, Qt)) 3120 if (EQ (WVAR (w, dedicated), Qt))
3116 /* WINDOW is strongly dedicated to its buffer, signal an 3121 /* WINDOW is strongly dedicated to its buffer, signal an
3117 error. */ 3122 error. */
3118 error ("Window is dedicated to `%s'", SDATA (BVAR (XBUFFER (tem), name))); 3123 error ("Window is dedicated to `%s'", SDATA (BVAR (XBUFFER (tem), name)));
3119 else 3124 else
3120 /* WINDOW is weakly dedicated to its buffer, reset 3125 /* WINDOW is weakly dedicated to its buffer, reset
3121 dedication. */ 3126 dedication. */
3122 w->dedicated = Qnil; 3127 WVAR (w, dedicated) = Qnil;
3123 3128
3124 call1 (Qrecord_window_buffer, window); 3129 call1 (Qrecord_window_buffer, window);
3125 } 3130 }
@@ -3158,8 +3163,8 @@ displaying that buffer. */)
3158 struct window *w = XWINDOW (object); 3163 struct window *w = XWINDOW (object);
3159 mark_window_display_accurate (object, 0); 3164 mark_window_display_accurate (object, 0);
3160 w->update_mode_line = 1; 3165 w->update_mode_line = 1;
3161 if (BUFFERP (w->buffer)) 3166 if (BUFFERP (WVAR (w, buffer)))
3162 XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; 3167 XBUFFER (WVAR (w, buffer))->prevent_redisplay_optimizations_p = 1;
3163 ++update_mode_lines; 3168 ++update_mode_lines;
3164 return Qt; 3169 return Qt;
3165 } 3170 }
@@ -3204,14 +3209,14 @@ temp_output_buffer_show (register Lisp_Object buf)
3204 { 3209 {
3205 window = display_buffer (buf, Qnil, Qnil); 3210 window = display_buffer (buf, Qnil, Qnil);
3206 3211
3207 if (!EQ (XWINDOW (window)->frame, selected_frame)) 3212 if (!EQ (WVAR (XWINDOW (window), frame), selected_frame))
3208 Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window))); 3213 Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window)));
3209 Vminibuf_scroll_window = window; 3214 Vminibuf_scroll_window = window;
3210 w = XWINDOW (window); 3215 w = XWINDOW (window);
3211 w->hscroll = 0; 3216 w->hscroll = 0;
3212 w->min_hscroll = 0; 3217 w->min_hscroll = 0;
3213 set_marker_restricted_both (w->start, buf, BEG, BEG); 3218 set_marker_restricted_both (WVAR (w, start), buf, BEG, BEG);
3214 set_marker_restricted_both (w->pointm, buf, BEG, BEG); 3219 set_marker_restricted_both (WVAR (w, pointm), buf, BEG, BEG);
3215 3220
3216 /* Run temp-buffer-show-hook, with the chosen window selected 3221 /* Run temp-buffer-show-hook, with the chosen window selected
3217 and its buffer current. */ 3222 and its buffer current. */
@@ -3228,7 +3233,7 @@ temp_output_buffer_show (register Lisp_Object buf)
3228 record_unwind_protect (Fset_buffer, prev_buffer); 3233 record_unwind_protect (Fset_buffer, prev_buffer);
3229 record_unwind_protect (select_window_norecord, prev_window); 3234 record_unwind_protect (select_window_norecord, prev_window);
3230 Fselect_window (window, Qt); 3235 Fselect_window (window, Qt);
3231 Fset_buffer (w->buffer); 3236 Fset_buffer (WVAR (w, buffer));
3232 Frun_hooks (1, &Qtemp_buffer_show_hook); 3237 Frun_hooks (1, &Qtemp_buffer_show_hook);
3233 unbind_to (count, Qnil); 3238 unbind_to (count, Qnil);
3234 } 3239 }
@@ -3265,17 +3270,17 @@ make_parent_window (Lisp_Object window, int horflag)
3265 3270
3266 replace_window (window, parent, 1); 3271 replace_window (window, parent, 1);
3267 3272
3268 o->next = Qnil; 3273 WVAR (o, next) = Qnil;
3269 o->prev = Qnil; 3274 WVAR (o, prev) = Qnil;
3270 o->parent = parent; 3275 WVAR (o, parent) = parent;
3271 3276
3272 p->hchild = horflag ? window : Qnil; 3277 WVAR (p, hchild) = horflag ? window : Qnil;
3273 p->vchild = horflag ? Qnil : window; 3278 WVAR (p, vchild) = horflag ? Qnil : window;
3274 p->start = Qnil; 3279 WVAR (p, start) = Qnil;
3275 p->pointm = Qnil; 3280 WVAR (p, pointm) = Qnil;
3276 p->buffer = Qnil; 3281 WVAR (p, buffer) = Qnil;
3277 p->combination_limit = Qnil; 3282 WVAR (p, combination_limit) = Qnil;
3278 p->window_parameters = Qnil; 3283 WVAR (p, window_parameters) = Qnil;
3279} 3284}
3280 3285
3281/* Make new window from scratch. */ 3286/* Make new window from scratch. */
@@ -3288,19 +3293,19 @@ make_window (void)
3288 w = allocate_window (); 3293 w = allocate_window ();
3289 /* Initialize Lisp data. Note that allocate_window initializes all 3294 /* Initialize Lisp data. Note that allocate_window initializes all
3290 Lisp data to nil, so do it only for slots which should not be nil. */ 3295 Lisp data to nil, so do it only for slots which should not be nil. */
3291 XSETFASTINT (w->left_col, 0); 3296 XSETFASTINT (WVAR (w, left_col), 0);
3292 XSETFASTINT (w->top_line, 0); 3297 XSETFASTINT (WVAR (w, top_line), 0);
3293 XSETFASTINT (w->total_lines, 0); 3298 XSETFASTINT (WVAR (w, total_lines), 0);
3294 XSETFASTINT (w->total_cols, 0); 3299 XSETFASTINT (WVAR (w, total_cols), 0);
3295 w->normal_lines = make_float (1.0); 3300 WVAR (w, normal_lines) = make_float (1.0);
3296 w->normal_cols = make_float (1.0); 3301 WVAR (w, normal_cols) = make_float (1.0);
3297 XSETFASTINT (w->new_total, 0); 3302 XSETFASTINT (WVAR (w, new_total), 0);
3298 XSETFASTINT (w->new_normal, 0); 3303 XSETFASTINT (WVAR (w, new_normal), 0);
3299 w->start = Fmake_marker (); 3304 WVAR (w, start) = Fmake_marker ();
3300 w->pointm = Fmake_marker (); 3305 WVAR (w, pointm) = Fmake_marker ();
3301 w->vertical_scroll_bar_type = Qt; 3306 WVAR (w, vertical_scroll_bar_type) = Qt;
3302 XSETFASTINT (w->window_end_pos, 0); 3307 XSETFASTINT (WVAR (w, window_end_pos), 0);
3303 XSETFASTINT (w->window_end_vpos, 0); 3308 XSETFASTINT (WVAR (w, window_end_vpos), 0);
3304 3309
3305 /* Initialize non-Lisp data. Note that allocate_window zeroes out all 3310 /* Initialize non-Lisp data. Note that allocate_window zeroes out all
3306 non-Lisp data, so do it only for slots which should not be zero. */ 3311 non-Lisp data, so do it only for slots which should not be zero. */
@@ -3330,11 +3335,11 @@ Note: This function does not operate on any child windows of WINDOW. */)
3330 3335
3331 CHECK_NUMBER (size); 3336 CHECK_NUMBER (size);
3332 if (NILP (add)) 3337 if (NILP (add))
3333 XSETINT (w->new_total, XINT (size)); 3338 XSETINT (WVAR (w, new_total), XINT (size));
3334 else 3339 else
3335 XSETINT (w->new_total, XINT (w->new_total) + XINT (size)); 3340 XSETINT (WVAR (w, new_total), XINT (WVAR (w, new_total)) + XINT (size));
3336 3341
3337 return w->new_total; 3342 return WVAR (w, new_total);
3338} 3343}
3339 3344
3340DEFUN ("set-window-new-normal", Fset_window_new_normal, Sset_window_new_normal, 1, 2, 0, 3345DEFUN ("set-window-new-normal", Fset_window_new_normal, Sset_window_new_normal, 1, 2, 0,
@@ -3346,8 +3351,8 @@ Note: This function does not operate on any child windows of WINDOW. */)
3346{ 3351{
3347 struct window *w = decode_any_window (window); 3352 struct window *w = decode_any_window (window);
3348 3353
3349 w->new_normal = size; 3354 WVAR (w, new_normal) = size;
3350 return w->new_normal; 3355 return WVAR (w, new_normal);
3351} 3356}
3352 3357
3353/* Return 1 if setting w->total_lines (w->total_cols if HORFLAG is 3358/* Return 1 if setting w->total_lines (w->total_cols if HORFLAG is
@@ -3362,19 +3367,19 @@ window_resize_check (struct window *w, int horflag)
3362{ 3367{
3363 struct window *c; 3368 struct window *c;
3364 3369
3365 if (!NILP (w->vchild)) 3370 if (!NILP (WVAR (w, vchild)))
3366 /* W is a vertical combination. */ 3371 /* W is a vertical combination. */
3367 { 3372 {
3368 c = XWINDOW (w->vchild); 3373 c = XWINDOW (WVAR (w, vchild));
3369 if (horflag) 3374 if (horflag)
3370 /* All child windows of W must have the same width as W. */ 3375 /* All child windows of W must have the same width as W. */
3371 { 3376 {
3372 while (c) 3377 while (c)
3373 { 3378 {
3374 if ((XINT (c->new_total) != XINT (w->new_total)) 3379 if ((XINT (WVAR (c, new_total)) != XINT (WVAR (w, new_total)))
3375 || !window_resize_check (c, horflag)) 3380 || !window_resize_check (c, horflag))
3376 return 0; 3381 return 0;
3377 c = NILP (c->next) ? 0 : XWINDOW (c->next); 3382 c = NILP (WVAR (c, next)) ? 0 : XWINDOW (WVAR (c, next));
3378 } 3383 }
3379 return 1; 3384 return 1;
3380 } 3385 }
@@ -3387,16 +3392,16 @@ window_resize_check (struct window *w, int horflag)
3387 { 3392 {
3388 if (!window_resize_check (c, horflag)) 3393 if (!window_resize_check (c, horflag))
3389 return 0; 3394 return 0;
3390 sum_of_sizes = sum_of_sizes + XINT (c->new_total); 3395 sum_of_sizes = sum_of_sizes + XINT (WVAR (c, new_total));
3391 c = NILP (c->next) ? 0 : XWINDOW (c->next); 3396 c = NILP (WVAR (c, next)) ? 0 : XWINDOW (WVAR (c, next));
3392 } 3397 }
3393 return (sum_of_sizes == XINT (w->new_total)); 3398 return (sum_of_sizes == XINT (WVAR (w, new_total)));
3394 } 3399 }
3395 } 3400 }
3396 else if (!NILP (w->hchild)) 3401 else if (!NILP (WVAR (w, hchild)))
3397 /* W is a horizontal combination. */ 3402 /* W is a horizontal combination. */
3398 { 3403 {
3399 c = XWINDOW (w->hchild); 3404 c = XWINDOW (WVAR (w, hchild));
3400 if (horflag) 3405 if (horflag)
3401 /* The sum of the widths of the child windows of W must equal W's 3406 /* The sum of the widths of the child windows of W must equal W's
3402 width. */ 3407 width. */
@@ -3406,20 +3411,20 @@ window_resize_check (struct window *w, int horflag)
3406 { 3411 {
3407 if (!window_resize_check (c, horflag)) 3412 if (!window_resize_check (c, horflag))
3408 return 0; 3413 return 0;
3409 sum_of_sizes = sum_of_sizes + XINT (c->new_total); 3414 sum_of_sizes = sum_of_sizes + XINT (WVAR (c, new_total));
3410 c = NILP (c->next) ? 0 : XWINDOW (c->next); 3415 c = NILP (WVAR (c, next)) ? 0 : XWINDOW (WVAR (c, next));
3411 } 3416 }
3412 return (sum_of_sizes == XINT (w->new_total)); 3417 return (sum_of_sizes == XINT (WVAR (w, new_total)));
3413 } 3418 }
3414 else 3419 else
3415 /* All child windows of W must have the same height as W. */ 3420 /* All child windows of W must have the same height as W. */
3416 { 3421 {
3417 while (c) 3422 while (c)
3418 { 3423 {
3419 if ((XINT (c->new_total) != XINT (w->new_total)) 3424 if ((XINT (WVAR (c, new_total)) != XINT (WVAR (w, new_total)))
3420 || !window_resize_check (c, horflag)) 3425 || !window_resize_check (c, horflag))
3421 return 0; 3426 return 0;
3422 c = NILP (c->next) ? 0 : XWINDOW (c->next); 3427 c = NILP (WVAR (c, next)) ? 0 : XWINDOW (WVAR (c, next));
3423 } 3428 }
3424 return 1; 3429 return 1;
3425 } 3430 }
@@ -3428,7 +3433,7 @@ window_resize_check (struct window *w, int horflag)
3428 /* A leaf window. Make sure it's not too small. The following 3433 /* A leaf window. Make sure it's not too small. The following
3429 hardcodes the values of `window-safe-min-width' (2) and 3434 hardcodes the values of `window-safe-min-width' (2) and
3430 `window-safe-min-height' (1) which are defined in window.el. */ 3435 `window-safe-min-height' (1) which are defined in window.el. */
3431 return XINT (w->new_total) >= (horflag ? 2 : 1); 3436 return XINT (WVAR (w, new_total)) >= (horflag ? 2 : 1);
3432} 3437}
3433 3438
3434/* Set w->total_lines (w->total_cols if HORIZONTAL is non-zero) to 3439/* Set w->total_lines (w->total_cols if HORIZONTAL is non-zero) to
@@ -3448,51 +3453,51 @@ window_resize_apply (struct window *w, int horflag)
3448 parent window has been set *before*. */ 3453 parent window has been set *before*. */
3449 if (horflag) 3454 if (horflag)
3450 { 3455 {
3451 w->total_cols = w->new_total; 3456 WVAR (w, total_cols) = WVAR (w, new_total);
3452 if (NUMBERP (w->new_normal)) 3457 if (NUMBERP (WVAR (w, new_normal)))
3453 w->normal_cols = w->new_normal; 3458 WVAR (w, normal_cols) = WVAR (w, new_normal);
3454 3459
3455 pos = XINT (w->left_col); 3460 pos = XINT (WVAR (w, left_col));
3456 } 3461 }
3457 else 3462 else
3458 { 3463 {
3459 w->total_lines = w->new_total; 3464 WVAR (w, total_lines) = WVAR (w, new_total);
3460 if (NUMBERP (w->new_normal)) 3465 if (NUMBERP (WVAR (w, new_normal)))
3461 w->normal_lines = w->new_normal; 3466 WVAR (w, normal_lines) = WVAR (w, new_normal);
3462 3467
3463 pos = XINT (w->top_line); 3468 pos = XINT (WVAR (w, top_line));
3464 } 3469 }
3465 3470
3466 if (!NILP (w->vchild)) 3471 if (!NILP (WVAR (w, vchild)))
3467 /* W is a vertical combination. */ 3472 /* W is a vertical combination. */
3468 { 3473 {
3469 c = XWINDOW (w->vchild); 3474 c = XWINDOW (WVAR (w, vchild));
3470 while (c) 3475 while (c)
3471 { 3476 {
3472 if (horflag) 3477 if (horflag)
3473 XSETFASTINT (c->left_col, pos); 3478 XSETFASTINT (WVAR (c, left_col), pos);
3474 else 3479 else
3475 XSETFASTINT (c->top_line, pos); 3480 XSETFASTINT (WVAR (c, top_line), pos);
3476 window_resize_apply (c, horflag); 3481 window_resize_apply (c, horflag);
3477 if (!horflag) 3482 if (!horflag)
3478 pos = pos + XINT (c->total_lines); 3483 pos = pos + XINT (WVAR (c, total_lines));
3479 c = NILP (c->next) ? 0 : XWINDOW (c->next); 3484 c = NILP (WVAR (c, next)) ? 0 : XWINDOW (WVAR (c, next));
3480 } 3485 }
3481 } 3486 }
3482 else if (!NILP (w->hchild)) 3487 else if (!NILP (WVAR (w, hchild)))
3483 /* W is a horizontal combination. */ 3488 /* W is a horizontal combination. */
3484 { 3489 {
3485 c = XWINDOW (w->hchild); 3490 c = XWINDOW (WVAR (w, hchild));
3486 while (c) 3491 while (c)
3487 { 3492 {
3488 if (horflag) 3493 if (horflag)
3489 XSETFASTINT (c->left_col, pos); 3494 XSETFASTINT (WVAR (c, left_col), pos);
3490 else 3495 else
3491 XSETFASTINT (c->top_line, pos); 3496 XSETFASTINT (WVAR (c, top_line), pos);
3492 window_resize_apply (c, horflag); 3497 window_resize_apply (c, horflag);
3493 if (horflag) 3498 if (horflag)
3494 pos = pos + XINT (c->total_cols); 3499 pos = pos + XINT (WVAR (c, total_cols));
3495 c = NILP (c->next) ? 0 : XWINDOW (c->next); 3500 c = NILP (WVAR (c, next)) ? 0 : XWINDOW (WVAR (c, next));
3496 } 3501 }
3497 } 3502 }
3498 3503
@@ -3528,7 +3533,8 @@ be applied on the Elisp level. */)
3528 r = XWINDOW (FRAME_ROOT_WINDOW (f)); 3533 r = XWINDOW (FRAME_ROOT_WINDOW (f));
3529 3534
3530 if (!window_resize_check (r, horflag) 3535 if (!window_resize_check (r, horflag)
3531 || ! EQ (r->new_total, (horflag ? r->total_cols : r->total_lines))) 3536 || ! EQ (WVAR (r, new_total),
3537 (horflag ? WVAR (r, total_cols) : WVAR (r, total_lines))))
3532 return Qnil; 3538 return Qnil;
3533 3539
3534 BLOCK_INPUT; 3540 BLOCK_INPUT;
@@ -3568,37 +3574,39 @@ resize_frame_windows (struct frame *f, int size, int horflag)
3568 - ((FRAME_HAS_MINIBUF_P (f) && !FRAME_MINIBUF_ONLY_P (f)) 3574 - ((FRAME_HAS_MINIBUF_P (f) && !FRAME_MINIBUF_ONLY_P (f))
3569 ? 1 : 0))); 3575 ? 1 : 0)));
3570 3576
3571 XSETFASTINT (r->top_line, FRAME_TOP_MARGIN (f)); 3577 XSETFASTINT (WVAR (r, top_line), FRAME_TOP_MARGIN (f));
3572 if (NILP (r->vchild) && NILP (r->hchild)) 3578 if (NILP (WVAR (r, vchild)) && NILP (WVAR (r, hchild)))
3573 /* For a leaf root window just set the size. */ 3579 /* For a leaf root window just set the size. */
3574 if (horflag) 3580 if (horflag)
3575 XSETFASTINT (r->total_cols, new_size); 3581 XSETFASTINT (WVAR (r, total_cols), new_size);
3576 else 3582 else
3577 XSETFASTINT (r->total_lines, new_size); 3583 XSETFASTINT (WVAR (r, total_lines), new_size);
3578 else 3584 else
3579 { 3585 {
3580 /* old_size is the old size of the frame's root window. */ 3586 /* old_size is the old size of the frame's root window. */
3581 int old_size = XFASTINT (horflag ? r->total_cols : r->total_lines); 3587 int old_size = XFASTINT (horflag ? WVAR (r, total_cols)
3588 : WVAR (r, total_lines));
3582 Lisp_Object delta; 3589 Lisp_Object delta;
3583 3590
3584 XSETINT (delta, new_size - old_size); 3591 XSETINT (delta, new_size - old_size);
3585 /* Try a "normal" resize first. */ 3592 /* Try a "normal" resize first. */
3586 resize_root_window (root, delta, horflag ? Qt : Qnil, Qnil); 3593 resize_root_window (root, delta, horflag ? Qt : Qnil, Qnil);
3587 if (window_resize_check (r, horflag) && new_size == XINT (r->new_total)) 3594 if (window_resize_check (r, horflag)
3595 && new_size == XINT (WVAR (r, new_total)))
3588 window_resize_apply (r, horflag); 3596 window_resize_apply (r, horflag);
3589 else 3597 else
3590 { 3598 {
3591 /* Try with "reasonable" minimum sizes next. */ 3599 /* Try with "reasonable" minimum sizes next. */
3592 resize_root_window (root, delta, horflag ? Qt : Qnil, Qt); 3600 resize_root_window (root, delta, horflag ? Qt : Qnil, Qt);
3593 if (window_resize_check (r, horflag) 3601 if (window_resize_check (r, horflag)
3594 && new_size == XINT (r->new_total)) 3602 && new_size == XINT (WVAR (r, new_total)))
3595 window_resize_apply (r, horflag); 3603 window_resize_apply (r, horflag);
3596 else 3604 else
3597 { 3605 {
3598 /* Finally, try with "safe" minimum sizes. */ 3606 /* Finally, try with "safe" minimum sizes. */
3599 resize_root_window (root, delta, horflag ? Qt : Qnil, Qsafe); 3607 resize_root_window (root, delta, horflag ? Qt : Qnil, Qsafe);
3600 if (window_resize_check (r, horflag) 3608 if (window_resize_check (r, horflag)
3601 && new_size == XINT (r->new_total)) 3609 && new_size == XINT (WVAR (r, new_total)))
3602 window_resize_apply (r, horflag); 3610 window_resize_apply (r, horflag);
3603 else 3611 else
3604 { 3612 {
@@ -3607,9 +3615,9 @@ resize_frame_windows (struct frame *f, int size, int horflag)
3607 root = FVAR (f, selected_window); 3615 root = FVAR (f, selected_window);
3608 Fdelete_other_windows_internal (root, Qnil); 3616 Fdelete_other_windows_internal (root, Qnil);
3609 if (horflag) 3617 if (horflag)
3610 XSETFASTINT (XWINDOW (root)->total_cols, new_size); 3618 XSETFASTINT (WVAR (XWINDOW (root), total_cols), new_size);
3611 else 3619 else
3612 XSETFASTINT (XWINDOW (root)->total_lines, new_size); 3620 XSETFASTINT (WVAR (XWINDOW (root), total_lines), new_size);
3613 } 3621 }
3614 } 3622 }
3615 } 3623 }
@@ -3619,12 +3627,13 @@ resize_frame_windows (struct frame *f, int size, int horflag)
3619 { 3627 {
3620 m = XWINDOW (mini); 3628 m = XWINDOW (mini);
3621 if (horflag) 3629 if (horflag)
3622 XSETFASTINT (m->total_cols, size); 3630 XSETFASTINT (WVAR (m, total_cols), size);
3623 else 3631 else
3624 { 3632 {
3625 /* Are we sure we always want 1 line here? */ 3633 /* Are we sure we always want 1 line here? */
3626 XSETFASTINT (m->total_lines, 1); 3634 XSETFASTINT (WVAR (m, total_lines), 1);
3627 XSETFASTINT (m->top_line, XINT (r->top_line) + XINT (r->total_lines)); 3635 XSETFASTINT (WVAR (m, top_line), XINT (WVAR (r, top_line))
3636 + XINT (WVAR (r, total_lines)));
3628 } 3637 }
3629 } 3638 }
3630} 3639}
@@ -3680,10 +3689,10 @@ set correctly. See the code of `split-window' for how this is done. */)
3680 parent, or OLD is ortho-combined. */ 3689 parent, or OLD is ortho-combined. */
3681 combination_limit = 3690 combination_limit =
3682 !NILP (Vwindow_combination_limit) 3691 !NILP (Vwindow_combination_limit)
3683 || NILP (o->parent) 3692 || NILP (WVAR (o, parent))
3684 || NILP (horflag 3693 || NILP (horflag
3685 ? (XWINDOW (o->parent)->hchild) 3694 ? (WVAR (XWINDOW (WVAR (o, parent)), hchild))
3686 : (XWINDOW (o->parent)->vchild)); 3695 : (WVAR (XWINDOW (WVAR (o, parent)), vchild)));
3687 3696
3688 /* We need a live reference window to initialize some parameters. */ 3697 /* We need a live reference window to initialize some parameters. */
3689 if (WINDOW_LIVE_P (old)) 3698 if (WINDOW_LIVE_P (old))
@@ -3703,23 +3712,24 @@ set correctly. See the code of `split-window' for how this is done. */)
3703 /* `window-combination-resize' non-nil means try to resize OLD's siblings 3712 /* `window-combination-resize' non-nil means try to resize OLD's siblings
3704 proportionally. */ 3713 proportionally. */
3705 { 3714 {
3706 p = XWINDOW (o->parent); 3715 p = XWINDOW (WVAR (o, parent));
3707 /* Temporarily pretend we split the parent window. */ 3716 /* Temporarily pretend we split the parent window. */
3708 XSETINT (p->new_total, 3717 XSETINT (WVAR (p, new_total),
3709 XINT (horflag ? p->total_cols : p->total_lines) 3718 XINT (horflag ? WVAR (p, total_cols) : WVAR (p, total_lines))
3710 - XINT (total_size)); 3719 - XINT (total_size));
3711 if (!window_resize_check (p, horflag)) 3720 if (!window_resize_check (p, horflag))
3712 error ("Window sizes don't fit"); 3721 error ("Window sizes don't fit");
3713 else 3722 else
3714 /* Undo the temporary pretension. */ 3723 /* Undo the temporary pretension. */
3715 p->new_total = horflag ? p->total_cols : p->total_lines; 3724 WVAR (p, new_total)
3725 = horflag ? WVAR (p, total_cols) : WVAR (p, total_lines);
3716 } 3726 }
3717 else 3727 else
3718 { 3728 {
3719 if (!window_resize_check (o, horflag)) 3729 if (!window_resize_check (o, horflag))
3720 error ("Resizing old window failed"); 3730 error ("Resizing old window failed");
3721 else if (XINT (total_size) + XINT (o->new_total) 3731 else if (XINT (total_size) + XINT (WVAR (o, new_total))
3722 != XINT (horflag ? o->total_cols : o->total_lines)) 3732 != XINT (horflag ? WVAR (o, total_cols) : WVAR (o, total_lines)))
3723 error ("Sum of sizes of old and new window don't fit"); 3733 error ("Sum of sizes of old and new window don't fit");
3724 } 3734 }
3725 3735
@@ -3729,93 +3739,95 @@ set correctly. See the code of `split-window' for how this is done. */)
3729 /* Save the old value of o->normal_cols/lines. It gets corrupted 3739 /* Save the old value of o->normal_cols/lines. It gets corrupted
3730 by make_parent_window and we need it below for assigning it to 3740 by make_parent_window and we need it below for assigning it to
3731 p->new_normal. */ 3741 p->new_normal. */
3732 Lisp_Object new_normal = horflag ? o->normal_cols : o->normal_lines; 3742 Lisp_Object new_normal
3743 = horflag ? WVAR (o, normal_cols) : WVAR (o, normal_lines);
3733 3744
3734 make_parent_window (old, horflag); 3745 make_parent_window (old, horflag);
3735 p = XWINDOW (o->parent); 3746 p = XWINDOW (WVAR (o, parent));
3736 /* Store value of `window-combination-limit' in new parent's 3747 /* Store value of `window-combination-limit' in new parent's
3737 combination_limit slot. */ 3748 combination_limit slot. */
3738 p->combination_limit = Vwindow_combination_limit; 3749 WVAR (p, combination_limit) = Vwindow_combination_limit;
3739 /* These get applied below. */ 3750 /* These get applied below. */
3740 p->new_total = horflag ? o->total_cols : o->total_lines; 3751 WVAR (p, new_total)
3741 p->new_normal = new_normal; 3752 = horflag ? WVAR (o, total_cols) : WVAR (o, total_lines);
3753 WVAR (p, new_normal) = new_normal;
3742 } 3754 }
3743 else 3755 else
3744 p = XWINDOW (o->parent); 3756 p = XWINDOW (WVAR (o, parent));
3745 3757
3746 windows_or_buffers_changed++; 3758 windows_or_buffers_changed++;
3747 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 3759 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
3748 new = make_window (); 3760 new = make_window ();
3749 n = XWINDOW (new); 3761 n = XWINDOW (new);
3750 n->frame = frame; 3762 WVAR (n, frame) = frame;
3751 n->parent = o->parent; 3763 WVAR (n, parent) = WVAR (o, parent);
3752 n->vchild = n->hchild = Qnil; 3764 WVAR (n, vchild) = WVAR (n, hchild) = Qnil;
3753 3765
3754 if (EQ (side, Qabove) || EQ (side, Qleft)) 3766 if (EQ (side, Qabove) || EQ (side, Qleft))
3755 { 3767 {
3756 n->prev = o->prev; 3768 WVAR (n, prev) = WVAR (o, prev);
3757 if (NILP (n->prev)) 3769 if (NILP (WVAR (n, prev)))
3758 if (horflag) 3770 if (horflag)
3759 p->hchild = new; 3771 WVAR (p, hchild) = new;
3760 else 3772 else
3761 p->vchild = new; 3773 WVAR (p, vchild) = new;
3762 else 3774 else
3763 XWINDOW (n->prev)->next = new; 3775 WVAR (XWINDOW (WVAR (n, prev)), next) = new;
3764 n->next = old; 3776 WVAR (n, next) = old;
3765 o->prev = new; 3777 WVAR (o, prev) = new;
3766 } 3778 }
3767 else 3779 else
3768 { 3780 {
3769 n->next = o->next; 3781 WVAR (n, next) = WVAR (o, next);
3770 if (!NILP (n->next)) 3782 if (!NILP (WVAR (n, next)))
3771 XWINDOW (n->next)->prev = new; 3783 WVAR (XWINDOW (WVAR (n, next)), prev) = new;
3772 n->prev = old; 3784 WVAR (n, prev) = old;
3773 o->next = new; 3785 WVAR (o, next) = new;
3774 } 3786 }
3775 3787
3776 n->buffer = Qt; 3788 WVAR (n, buffer) = Qt;
3777 n->window_end_valid = Qnil; 3789 WVAR (n, window_end_valid) = Qnil;
3778 memset (&n->last_cursor, 0, sizeof n->last_cursor); 3790 memset (&n->last_cursor, 0, sizeof n->last_cursor);
3779 3791
3780 /* Get special geometry settings from reference window. */ 3792 /* Get special geometry settings from reference window. */
3781 n->left_margin_cols = r->left_margin_cols; 3793 WVAR (n, left_margin_cols) = WVAR (r, left_margin_cols);
3782 n->right_margin_cols = r->right_margin_cols; 3794 WVAR (n, right_margin_cols) = WVAR (r, right_margin_cols);
3783 n->left_fringe_width = r->left_fringe_width; 3795 WVAR (n, left_fringe_width) = WVAR (r, left_fringe_width);
3784 n->right_fringe_width = r->right_fringe_width; 3796 WVAR (n, right_fringe_width) = WVAR (r, right_fringe_width);
3785 n->fringes_outside_margins = r->fringes_outside_margins; 3797 n->fringes_outside_margins = r->fringes_outside_margins;
3786 n->scroll_bar_width = r->scroll_bar_width; 3798 WVAR (n, scroll_bar_width) = WVAR (r, scroll_bar_width);
3787 n->vertical_scroll_bar_type = r->vertical_scroll_bar_type; 3799 WVAR (n, vertical_scroll_bar_type) = WVAR (r, vertical_scroll_bar_type);
3788 3800
3789 /* Directly assign orthogonal coordinates and sizes. */ 3801 /* Directly assign orthogonal coordinates and sizes. */
3790 if (horflag) 3802 if (horflag)
3791 { 3803 {
3792 n->top_line = o->top_line; 3804 WVAR (n, top_line) = WVAR (o, top_line);
3793 n->total_lines = o->total_lines; 3805 WVAR (n, total_lines) = WVAR (o, total_lines);
3794 } 3806 }
3795 else 3807 else
3796 { 3808 {
3797 n->left_col = o->left_col; 3809 WVAR (n, left_col) = WVAR (o, left_col);
3798 n->total_cols = o->total_cols; 3810 WVAR (n, total_cols) = WVAR (o, total_cols);
3799 } 3811 }
3800 3812
3801 /* Iso-coordinates and sizes are assigned by window_resize_apply, 3813 /* Iso-coordinates and sizes are assigned by window_resize_apply,
3802 get them ready here. */ 3814 get them ready here. */
3803 n->new_total = total_size; 3815 WVAR (n, new_total) = total_size;
3804 n->new_normal = normal_size; 3816 WVAR (n, new_normal) = normal_size;
3805 3817
3806 BLOCK_INPUT; 3818 BLOCK_INPUT;
3807 window_resize_apply (p, horflag); 3819 window_resize_apply (p, horflag);
3808 adjust_glyphs (f); 3820 adjust_glyphs (f);
3809 /* Set buffer of NEW to buffer of reference window. Don't run 3821 /* Set buffer of NEW to buffer of reference window. Don't run
3810 any hooks. */ 3822 any hooks. */
3811 set_window_buffer (new, r->buffer, 0, 1); 3823 set_window_buffer (new, WVAR (r, buffer), 0, 1);
3812 UNBLOCK_INPUT; 3824 UNBLOCK_INPUT;
3813 3825
3814 /* Maybe we should run the scroll functions in Elisp (which already 3826 /* Maybe we should run the scroll functions in Elisp (which already
3815 runs the configuration change hook). */ 3827 runs the configuration change hook). */
3816 if (! NILP (Vwindow_scroll_functions)) 3828 if (! NILP (Vwindow_scroll_functions))
3817 run_hook_with_args_2 (Qwindow_scroll_functions, new, 3829 run_hook_with_args_2 (Qwindow_scroll_functions, new,
3818 Fmarker_position (n->start)); 3830 Fmarker_position (WVAR (n, start)));
3819 /* Return NEW. */ 3831 /* Return NEW. */
3820 return new; 3832 return new;
3821} 3833}
@@ -3835,21 +3847,22 @@ Signal an error when WINDOW is the only window on its frame. */)
3835 3847
3836 w = decode_any_window (window); 3848 w = decode_any_window (window);
3837 XSETWINDOW (window, w); 3849 XSETWINDOW (window, w);
3838 if (NILP (w->buffer) && NILP (w->hchild) && NILP (w->vchild)) 3850 if (NILP (WVAR (w, buffer))
3851 && NILP (WVAR (w, hchild)) && NILP (WVAR (w, vchild)))
3839 /* It's a no-op to delete an already deleted window. */ 3852 /* It's a no-op to delete an already deleted window. */
3840 return Qnil; 3853 return Qnil;
3841 3854
3842 parent = w->parent; 3855 parent = WVAR (w, parent);
3843 if (NILP (parent)) 3856 if (NILP (parent))
3844 /* Never delete a minibuffer or frame root window. */ 3857 /* Never delete a minibuffer or frame root window. */
3845 error ("Attempt to delete minibuffer or sole ordinary window"); 3858 error ("Attempt to delete minibuffer or sole ordinary window");
3846 else if (NILP (w->prev) && NILP (w->next)) 3859 else if (NILP (WVAR (w, prev)) && NILP (WVAR (w, next)))
3847 /* Rather bow out here, this case should be handled on the Elisp 3860 /* Rather bow out here, this case should be handled on the Elisp
3848 level. */ 3861 level. */
3849 error ("Attempt to delete sole window of parent"); 3862 error ("Attempt to delete sole window of parent");
3850 3863
3851 p = XWINDOW (parent); 3864 p = XWINDOW (parent);
3852 horflag = NILP (p->vchild); 3865 horflag = NILP (WVAR (p, vchild));
3853 3866
3854 frame = WINDOW_FRAME (w); 3867 frame = WINDOW_FRAME (w);
3855 f = XFRAME (frame); 3868 f = XFRAME (frame);
@@ -3858,32 +3871,33 @@ Signal an error when WINDOW is the only window on its frame. */)
3858 r = XWINDOW (root); 3871 r = XWINDOW (root);
3859 3872
3860 /* Unlink WINDOW from window tree. */ 3873 /* Unlink WINDOW from window tree. */
3861 if (NILP (w->prev)) 3874 if (NILP (WVAR (w, prev)))
3862 /* Get SIBLING below (on the right of) WINDOW. */ 3875 /* Get SIBLING below (on the right of) WINDOW. */
3863 { 3876 {
3864 /* before_sibling 1 means WINDOW is the first child of its 3877 /* before_sibling 1 means WINDOW is the first child of its
3865 parent and thus before the sibling. */ 3878 parent and thus before the sibling. */
3866 before_sibling = 1; 3879 before_sibling = 1;
3867 sibling = w->next; 3880 sibling = WVAR (w, next);
3868 s = XWINDOW (sibling); 3881 s = XWINDOW (sibling);
3869 s->prev = Qnil; 3882 WVAR (s, prev) = Qnil;
3870 if (horflag) 3883 if (horflag)
3871 p->hchild = sibling; 3884 WVAR (p, hchild) = sibling;
3872 else 3885 else
3873 p->vchild = sibling; 3886 WVAR (p, vchild) = sibling;
3874 } 3887 }
3875 else 3888 else
3876 /* Get SIBLING above (on the left of) WINDOW. */ 3889 /* Get SIBLING above (on the left of) WINDOW. */
3877 { 3890 {
3878 sibling = w->prev; 3891 sibling = WVAR (w, prev);
3879 s = XWINDOW (sibling); 3892 s = XWINDOW (sibling);
3880 s->next = w->next; 3893 WVAR (s, next) = WVAR (w, next);
3881 if (!NILP (s->next)) 3894 if (!NILP (WVAR (s, next)))
3882 XWINDOW (s->next)->prev = sibling; 3895 WVAR (XWINDOW (WVAR (s, next)), prev) = sibling;
3883 } 3896 }
3884 3897
3885 if (window_resize_check (r, horflag) 3898 if (window_resize_check (r, horflag)
3886 && EQ (r->new_total, (horflag ? r->total_cols : r->total_lines))) 3899 && EQ (WVAR (r, new_total),
3900 (horflag ? WVAR (r, total_cols) : WVAR (r, total_lines))))
3887 /* We can delete WINDOW now. */ 3901 /* We can delete WINDOW now. */
3888 { 3902 {
3889 3903
@@ -3905,28 +3919,28 @@ Signal an error when WINDOW is the only window on its frame. */)
3905 Vwindow_list = Qnil; 3919 Vwindow_list = Qnil;
3906 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 3920 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
3907 3921
3908 w->next = Qnil; /* Don't delete w->next too. */ 3922 WVAR (w, next) = Qnil; /* Don't delete w->next too. */
3909 free_window_matrices (w); 3923 free_window_matrices (w);
3910 3924
3911 if (!NILP (w->vchild)) 3925 if (!NILP (WVAR (w, vchild)))
3912 { 3926 {
3913 delete_all_child_windows (w->vchild); 3927 delete_all_child_windows (WVAR (w, vchild));
3914 w->vchild = Qnil; 3928 WVAR (w, vchild) = Qnil;
3915 } 3929 }
3916 else if (!NILP (w->hchild)) 3930 else if (!NILP (WVAR (w, hchild)))
3917 { 3931 {
3918 delete_all_child_windows (w->hchild); 3932 delete_all_child_windows (WVAR (w, hchild));
3919 w->hchild = Qnil; 3933 WVAR (w, hchild) = Qnil;
3920 } 3934 }
3921 else if (!NILP (w->buffer)) 3935 else if (!NILP (WVAR (w, buffer)))
3922 { 3936 {
3923 unshow_buffer (w); 3937 unshow_buffer (w);
3924 unchain_marker (XMARKER (w->pointm)); 3938 unchain_marker (XMARKER (WVAR (w, pointm)));
3925 unchain_marker (XMARKER (w->start)); 3939 unchain_marker (XMARKER (WVAR (w, start)));
3926 w->buffer = Qnil; 3940 WVAR (w, buffer) = Qnil;
3927 } 3941 }
3928 3942
3929 if (NILP (s->prev) && NILP (s->next)) 3943 if (NILP (WVAR (s, prev)) && NILP (WVAR (s, next)))
3930 /* A matrjoshka where SIBLING has become the only child of 3944 /* A matrjoshka where SIBLING has become the only child of
3931 PARENT. */ 3945 PARENT. */
3932 { 3946 {
@@ -3934,10 +3948,10 @@ Signal an error when WINDOW is the only window on its frame. */)
3934 replace_window (parent, sibling, 0); 3948 replace_window (parent, sibling, 0);
3935 /* Have SIBLING inherit the following three slot values from 3949 /* Have SIBLING inherit the following three slot values from
3936 PARENT (the combination_limit slot is not inherited). */ 3950 PARENT (the combination_limit slot is not inherited). */
3937 s->normal_cols = p->normal_cols; 3951 WVAR (s, normal_cols) = WVAR (p, normal_cols);
3938 s->normal_lines = p->normal_lines; 3952 WVAR (s, normal_lines) = WVAR (p, normal_lines);
3939 /* Mark PARENT as deleted. */ 3953 /* Mark PARENT as deleted. */
3940 p->vchild = p->hchild = Qnil; 3954 WVAR (p, vchild) = WVAR (p, hchild) = Qnil;
3941 /* Try to merge SIBLING into its new parent. */ 3955 /* Try to merge SIBLING into its new parent. */
3942 recombine_windows (sibling); 3956 recombine_windows (sibling);
3943 } 3957 }
@@ -3964,7 +3978,7 @@ Signal an error when WINDOW is the only window on its frame. */)
3964 /* Now look whether `get-mru-window' gets us something. */ 3978 /* Now look whether `get-mru-window' gets us something. */
3965 mru_window = call1 (Qget_mru_window, frame); 3979 mru_window = call1 (Qget_mru_window, frame);
3966 if (WINDOW_LIVE_P (mru_window) 3980 if (WINDOW_LIVE_P (mru_window)
3967 && EQ (XWINDOW (mru_window)->frame, frame)) 3981 && EQ (WVAR (XWINDOW (mru_window), frame), frame))
3968 new_selected_window = mru_window; 3982 new_selected_window = mru_window;
3969 3983
3970 /* If all ended up well, we now promote the mru window. */ 3984 /* If all ended up well, we now promote the mru window. */
@@ -3984,17 +3998,17 @@ Signal an error when WINDOW is the only window on its frame. */)
3984 { 3998 {
3985 if (before_sibling) 3999 if (before_sibling)
3986 { 4000 {
3987 s->prev = window; 4001 WVAR (s, prev) = window;
3988 if (horflag) 4002 if (horflag)
3989 p->hchild = window; 4003 WVAR (p, hchild) = window;
3990 else 4004 else
3991 p->vchild = window; 4005 WVAR (p, vchild) = window;
3992 } 4006 }
3993 else 4007 else
3994 { 4008 {
3995 s->next = window; 4009 WVAR (s, next) = window;
3996 if (!NILP (w->next)) 4010 if (!NILP (WVAR (w, next)))
3997 XWINDOW (w->next)->prev = window; 4011 WVAR (XWINDOW (WVAR (w, next)), prev) = window;
3998 } 4012 }
3999 error ("Deletion failed"); 4013 error ("Deletion failed");
4000 } 4014 }
@@ -4011,7 +4025,7 @@ Signal an error when WINDOW is the only window on its frame. */)
4011void 4025void
4012grow_mini_window (struct window *w, int delta) 4026grow_mini_window (struct window *w, int delta)
4013{ 4027{
4014 struct frame *f = XFRAME (w->frame); 4028 struct frame *f = XFRAME (WVAR (w, frame));
4015 struct window *r; 4029 struct window *r;
4016 Lisp_Object root, value; 4030 Lisp_Object root, value;
4017 4031
@@ -4028,8 +4042,9 @@ grow_mini_window (struct window *w, int delta)
4028 window_resize_apply (r, 0); 4042 window_resize_apply (r, 0);
4029 4043
4030 /* Grow the mini-window. */ 4044 /* Grow the mini-window. */
4031 XSETFASTINT (w->top_line, XFASTINT (r->top_line) + XFASTINT (r->total_lines)); 4045 XSETFASTINT (WVAR (w, top_line),
4032 XSETFASTINT (w->total_lines, XFASTINT (w->total_lines) - XINT (value)); 4046 XFASTINT (WVAR (r, top_line)) + XFASTINT (WVAR (r, total_lines)));
4047 XSETFASTINT (WVAR (w, total_lines), XFASTINT (WVAR (w, total_lines)) - XINT (value));
4033 w->last_modified = 0; 4048 w->last_modified = 0;
4034 w->last_overlay_modified = 0; 4049 w->last_overlay_modified = 0;
4035 4050
@@ -4043,14 +4058,14 @@ grow_mini_window (struct window *w, int delta)
4043void 4058void
4044shrink_mini_window (struct window *w) 4059shrink_mini_window (struct window *w)
4045{ 4060{
4046 struct frame *f = XFRAME (w->frame); 4061 struct frame *f = XFRAME (WVAR (w, frame));
4047 struct window *r; 4062 struct window *r;
4048 Lisp_Object root, value; 4063 Lisp_Object root, value;
4049 EMACS_INT size; 4064 EMACS_INT size;
4050 4065
4051 eassert (MINI_WINDOW_P (w)); 4066 eassert (MINI_WINDOW_P (w));
4052 4067
4053 size = XINT (w->total_lines); 4068 size = XINT (WVAR (w, total_lines));
4054 if (size > 1) 4069 if (size > 1)
4055 { 4070 {
4056 root = FRAME_ROOT_WINDOW (f); 4071 root = FRAME_ROOT_WINDOW (f);
@@ -4063,8 +4078,9 @@ shrink_mini_window (struct window *w)
4063 window_resize_apply (r, 0); 4078 window_resize_apply (r, 0);
4064 4079
4065 /* Shrink the mini-window. */ 4080 /* Shrink the mini-window. */
4066 XSETFASTINT (w->top_line, XFASTINT (r->top_line) + XFASTINT (r->total_lines)); 4081 XSETFASTINT (WVAR (w, top_line), XFASTINT (WVAR (r, top_line))
4067 XSETFASTINT (w->total_lines, 1); 4082 + XFASTINT (WVAR (r, total_lines)));
4083 XSETFASTINT (WVAR (w, total_lines), 1);
4068 4084
4069 w->last_modified = 0; 4085 w->last_modified = 0;
4070 w->last_overlay_modified = 0; 4086 w->last_overlay_modified = 0;
@@ -4089,24 +4105,25 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini
4089 int height; 4105 int height;
4090 4106
4091 CHECK_WINDOW (window); 4107 CHECK_WINDOW (window);
4092 f = XFRAME (w->frame); 4108 f = XFRAME (WVAR (w, frame));
4093 4109
4094 if (!EQ (FRAME_MINIBUF_WINDOW (XFRAME (w->frame)), window)) 4110 if (!EQ (FRAME_MINIBUF_WINDOW (XFRAME (WVAR (w, frame))), window))
4095 error ("Not a valid minibuffer window"); 4111 error ("Not a valid minibuffer window");
4096 else if (FRAME_MINIBUF_ONLY_P (f)) 4112 else if (FRAME_MINIBUF_ONLY_P (f))
4097 error ("Cannot resize a minibuffer-only frame"); 4113 error ("Cannot resize a minibuffer-only frame");
4098 4114
4099 r = XWINDOW (FRAME_ROOT_WINDOW (f)); 4115 r = XWINDOW (FRAME_ROOT_WINDOW (f));
4100 height = XINT (r->total_lines) + XINT (w->total_lines); 4116 height = XINT (WVAR (r, total_lines)) + XINT (WVAR (w, total_lines));
4101 if (window_resize_check (r, 0) 4117 if (window_resize_check (r, 0)
4102 && XINT (w->new_total) > 0 4118 && XINT (WVAR (w, new_total)) > 0
4103 && height == XINT (r->new_total) + XINT (w->new_total)) 4119 && height == XINT (WVAR (r, new_total)) + XINT (WVAR (w, new_total)))
4104 { 4120 {
4105 BLOCK_INPUT; 4121 BLOCK_INPUT;
4106 window_resize_apply (r, 0); 4122 window_resize_apply (r, 0);
4107 4123
4108 w->total_lines = w->new_total; 4124 WVAR (w, total_lines) = WVAR (w, new_total);
4109 XSETFASTINT (w->top_line, XINT (r->top_line) + XINT (r->total_lines)); 4125 XSETFASTINT (WVAR (w, top_line),
4126 XINT (WVAR (r, top_line)) + XINT (WVAR (r, total_lines)));
4110 4127
4111 windows_or_buffers_changed++; 4128 windows_or_buffers_changed++;
4112 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 4129 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
@@ -4129,14 +4146,14 @@ mark_window_cursors_off (struct window *w)
4129{ 4146{
4130 while (w) 4147 while (w)
4131 { 4148 {
4132 if (!NILP (w->hchild)) 4149 if (!NILP (WVAR (w, hchild)))
4133 mark_window_cursors_off (XWINDOW (w->hchild)); 4150 mark_window_cursors_off (XWINDOW (WVAR (w, hchild)));
4134 else if (!NILP (w->vchild)) 4151 else if (!NILP (WVAR (w, vchild)))
4135 mark_window_cursors_off (XWINDOW (w->vchild)); 4152 mark_window_cursors_off (XWINDOW (WVAR (w, vchild)));
4136 else 4153 else
4137 w->phys_cursor_on_p = 0; 4154 w->phys_cursor_on_p = 0;
4138 4155
4139 w = NILP (w->next) ? 0 : XWINDOW (w->next); 4156 w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next));
4140 } 4157 }
4141} 4158}
4142 4159
@@ -4146,15 +4163,15 @@ mark_window_cursors_off (struct window *w)
4146int 4163int
4147window_internal_height (struct window *w) 4164window_internal_height (struct window *w)
4148{ 4165{
4149 int ht = XFASTINT (w->total_lines); 4166 int ht = XFASTINT (WVAR (w, total_lines));
4150 4167
4151 if (!MINI_WINDOW_P (w)) 4168 if (!MINI_WINDOW_P (w))
4152 { 4169 {
4153 if (!NILP (w->parent) 4170 if (!NILP (WVAR (w, parent))
4154 || !NILP (w->vchild) 4171 || !NILP (WVAR (w, vchild))
4155 || !NILP (w->hchild) 4172 || !NILP (WVAR (w, hchild))
4156 || !NILP (w->next) 4173 || !NILP (WVAR (w, next))
4157 || !NILP (w->prev) 4174 || !NILP (WVAR (w, prev))
4158 || WINDOW_WANTS_MODELINE_P (w)) 4175 || WINDOW_WANTS_MODELINE_P (w))
4159 --ht; 4176 --ht;
4160 4177
@@ -4184,7 +4201,7 @@ window_scroll (Lisp_Object window, EMACS_INT n, int whole, int noerror)
4184 4201
4185 /* If we must, use the pixel-based version which is much slower than 4202 /* If we must, use the pixel-based version which is much slower than
4186 the line-based one but can handle varying line heights. */ 4203 the line-based one but can handle varying line heights. */
4187 if (FRAME_WINDOW_P (XFRAME (XWINDOW (window)->frame))) 4204 if (FRAME_WINDOW_P (XFRAME (WVAR (XWINDOW (window), frame))))
4188 window_scroll_pixel_based (window, n, whole, noerror); 4205 window_scroll_pixel_based (window, n, whole, noerror);
4189 else 4206 else
4190 window_scroll_line_based (window, n, whole, noerror); 4207 window_scroll_line_based (window, n, whole, noerror);
@@ -4209,7 +4226,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
4209 int x, y, rtop, rbot, rowh, vpos; 4226 int x, y, rtop, rbot, rowh, vpos;
4210 void *itdata = NULL; 4227 void *itdata = NULL;
4211 4228
4212 SET_TEXT_POS_FROM_MARKER (start, w->start); 4229 SET_TEXT_POS_FROM_MARKER (start, WVAR (w, start));
4213 /* Scrolling a minibuffer window via scroll bar when the echo area 4230 /* Scrolling a minibuffer window via scroll bar when the echo area
4214 shows long text sometimes resets the minibuffer contents behind 4231 shows long text sometimes resets the minibuffer contents behind
4215 our backs. */ 4232 our backs. */
@@ -4290,8 +4307,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
4290 spos = XINT (Fline_beginning_position (Qnil)); 4307 spos = XINT (Fline_beginning_position (Qnil));
4291 else 4308 else
4292 spos = min (XINT (Fline_end_position (Qnil)) + 1, ZV); 4309 spos = min (XINT (Fline_end_position (Qnil)) + 1, ZV);
4293 set_marker_restricted (w->start, make_number (spos), 4310 set_marker_restricted (WVAR (w, start), make_number (spos),
4294 w->buffer); 4311 WVAR (w, buffer));
4295 w->start_at_line_beg = 1; 4312 w->start_at_line_beg = 1;
4296 w->update_mode_line = 1; 4313 w->update_mode_line = 1;
4297 w->last_modified = 0; 4314 w->last_modified = 0;
@@ -4415,7 +4432,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
4415 4432
4416 /* If control gets here, then we vscrolled. */ 4433 /* If control gets here, then we vscrolled. */
4417 4434
4418 XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; 4435 XBUFFER (WVAR (w, buffer))->prevent_redisplay_optimizations_p = 1;
4419 4436
4420 /* Don't try to change the window start below. */ 4437 /* Don't try to change the window start below. */
4421 vscrolled = 1; 4438 vscrolled = 1;
@@ -4435,9 +4452,9 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
4435 } 4452 }
4436 4453
4437 /* Set the window start, and set up the window for redisplay. */ 4454 /* Set the window start, and set up the window for redisplay. */
4438 set_marker_restricted (w->start, make_number (pos), 4455 set_marker_restricted (WVAR (w, start), make_number (pos),
4439 w->buffer); 4456 WVAR (w, buffer));
4440 bytepos = XMARKER (w->start)->bytepos; 4457 bytepos = XMARKER (WVAR (w, start))->bytepos;
4441 w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n'); 4458 w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n');
4442 w->update_mode_line = 1; 4459 w->update_mode_line = 1;
4443 w->last_modified = 0; 4460 w->last_modified = 0;
@@ -4455,7 +4472,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
4455 This code wants current_y to be zero at the window start position 4472 This code wants current_y to be zero at the window start position
4456 even if there is a header line. */ 4473 even if there is a header line. */
4457 this_scroll_margin = max (0, scroll_margin); 4474 this_scroll_margin = max (0, scroll_margin);
4458 this_scroll_margin = min (this_scroll_margin, XFASTINT (w->total_lines) / 4); 4475 this_scroll_margin
4476 = min (this_scroll_margin, XFASTINT (WVAR (w, total_lines)) / 4);
4459 this_scroll_margin *= FRAME_LINE_HEIGHT (it.f); 4477 this_scroll_margin *= FRAME_LINE_HEIGHT (it.f);
4460 4478
4461 if (n > 0) 4479 if (n > 0)
@@ -4529,7 +4547,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
4529 ; 4547 ;
4530 else if (window_scroll_pixel_based_preserve_y >= 0) 4548 else if (window_scroll_pixel_based_preserve_y >= 0)
4531 { 4549 {
4532 SET_TEXT_POS_FROM_MARKER (start, w->start); 4550 SET_TEXT_POS_FROM_MARKER (start, WVAR (w, start));
4533 start_display (&it, w, start); 4551 start_display (&it, w, start);
4534 /* It would be wrong to subtract CURRENT_HEADER_LINE_HEIGHT 4552 /* It would be wrong to subtract CURRENT_HEADER_LINE_HEIGHT
4535 here because we called start_display again and did not 4553 here because we called start_display again and did not
@@ -4583,7 +4601,7 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
4583 if (whole) 4601 if (whole)
4584 n *= max (1, ht - next_screen_context_lines); 4602 n *= max (1, ht - next_screen_context_lines);
4585 4603
4586 startpos = marker_position (w->start); 4604 startpos = marker_position (WVAR (w, start));
4587 4605
4588 if (!NILP (Vscroll_preserve_screen_position)) 4606 if (!NILP (Vscroll_preserve_screen_position))
4589 { 4607 {
@@ -4634,9 +4652,9 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
4634 { 4652 {
4635 /* Don't use a scroll margin that is negative or too large. */ 4653 /* Don't use a scroll margin that is negative or too large. */
4636 int this_scroll_margin = 4654 int this_scroll_margin =
4637 max (0, min (scroll_margin, XINT (w->total_lines) / 4)); 4655 max (0, min (scroll_margin, XINT (WVAR (w, total_lines)) / 4));
4638 4656
4639 set_marker_restricted_both (w->start, w->buffer, pos, pos_byte); 4657 set_marker_restricted_both (WVAR (w, start), WVAR (w, buffer), pos, pos_byte);
4640 w->start_at_line_beg = !NILP (bolp); 4658 w->start_at_line_beg = !NILP (bolp);
4641 w->update_mode_line = 1; 4659 w->update_mode_line = 1;
4642 w->last_modified = 0; 4660 w->last_modified = 0;
@@ -4730,10 +4748,10 @@ scroll_command (Lisp_Object n, int direction)
4730 4748
4731 /* If selected window's buffer isn't current, make it current for 4749 /* If selected window's buffer isn't current, make it current for
4732 the moment. But don't screw up if window_scroll gets an error. */ 4750 the moment. But don't screw up if window_scroll gets an error. */
4733 if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) 4751 if (XBUFFER (WVAR (XWINDOW (selected_window), buffer)) != current_buffer)
4734 { 4752 {
4735 record_unwind_protect (save_excursion_restore, save_excursion_save ()); 4753 record_unwind_protect (save_excursion_restore, save_excursion_save ());
4736 Fset_buffer (XWINDOW (selected_window)->buffer); 4754 Fset_buffer (WVAR (XWINDOW (selected_window), buffer));
4737 4755
4738 /* Make redisplay consider other windows than just selected_window. */ 4756 /* Make redisplay consider other windows than just selected_window. */
4739 ++windows_or_buffers_changed; 4757 ++windows_or_buffers_changed;
@@ -4848,8 +4866,8 @@ specifies the window to scroll. This takes precedence over
4848 record_unwind_protect (save_excursion_restore, save_excursion_save ()); 4866 record_unwind_protect (save_excursion_restore, save_excursion_save ());
4849 ++windows_or_buffers_changed; 4867 ++windows_or_buffers_changed;
4850 4868
4851 Fset_buffer (w->buffer); 4869 Fset_buffer (WVAR (w, buffer));
4852 SET_PT (marker_position (w->pointm)); 4870 SET_PT (marker_position (WVAR (w, pointm)));
4853 4871
4854 if (NILP (arg)) 4872 if (NILP (arg))
4855 window_scroll (window, 1, 1, 1); 4873 window_scroll (window, 1, 1, 1);
@@ -4863,7 +4881,7 @@ specifies the window to scroll. This takes precedence over
4863 window_scroll (window, XINT (arg), 0, 1); 4881 window_scroll (window, XINT (arg), 0, 1);
4864 } 4882 }
4865 4883
4866 set_marker_both (w->pointm, Qnil, PT, PT_BYTE); 4884 set_marker_both (WVAR (w, pointm), Qnil, PT, PT_BYTE);
4867 unbind_to (count, Qnil); 4885 unbind_to (count, Qnil);
4868 4886
4869 return Qnil; 4887 return Qnil;
@@ -4941,10 +4959,10 @@ displayed_window_lines (struct window *w)
4941 int bottom_y; 4959 int bottom_y;
4942 void *itdata = NULL; 4960 void *itdata = NULL;
4943 4961
4944 if (XBUFFER (w->buffer) != current_buffer) 4962 if (XBUFFER (WVAR (w, buffer)) != current_buffer)
4945 { 4963 {
4946 old_buffer = current_buffer; 4964 old_buffer = current_buffer;
4947 set_buffer_internal (XBUFFER (w->buffer)); 4965 set_buffer_internal (XBUFFER (WVAR (w, buffer)));
4948 } 4966 }
4949 else 4967 else
4950 old_buffer = NULL; 4968 old_buffer = NULL;
@@ -4952,12 +4970,12 @@ displayed_window_lines (struct window *w)
4952 /* In case W->start is out of the accessible range, do something 4970 /* In case W->start is out of the accessible range, do something
4953 reasonable. This happens in Info mode when Info-scroll-down 4971 reasonable. This happens in Info mode when Info-scroll-down
4954 calls (recenter -1) while W->start is 1. */ 4972 calls (recenter -1) while W->start is 1. */
4955 if (XMARKER (w->start)->charpos < BEGV) 4973 if (XMARKER (WVAR (w, start))->charpos < BEGV)
4956 SET_TEXT_POS (start, BEGV, BEGV_BYTE); 4974 SET_TEXT_POS (start, BEGV, BEGV_BYTE);
4957 else if (XMARKER (w->start)->charpos > ZV) 4975 else if (XMARKER (WVAR (w, start))->charpos > ZV)
4958 SET_TEXT_POS (start, ZV, ZV_BYTE); 4976 SET_TEXT_POS (start, ZV, ZV_BYTE);
4959 else 4977 else
4960 SET_TEXT_POS_FROM_MARKER (start, w->start); 4978 SET_TEXT_POS_FROM_MARKER (start, WVAR (w, start));
4961 4979
4962 itdata = bidi_shelve_cache (); 4980 itdata = bidi_shelve_cache ();
4963 start_display (&it, w, start); 4981 start_display (&it, w, start);
@@ -4971,7 +4989,7 @@ displayed_window_lines (struct window *w)
4971 This kludge fixes a bug whereby (move-to-window-line -1) 4989 This kludge fixes a bug whereby (move-to-window-line -1)
4972 when ZV is on the last screen line 4990 when ZV is on the last screen line
4973 moves to the previous screen line instead of the last one. */ 4991 moves to the previous screen line instead of the last one. */
4974 if (! FRAME_WINDOW_P (XFRAME (w->frame))) 4992 if (! FRAME_WINDOW_P (XFRAME (WVAR (w, frame))))
4975 height++; 4993 height++;
4976 4994
4977 /* Add in empty lines at the bottom of the window. */ 4995 /* Add in empty lines at the bottom of the window. */
@@ -5006,7 +5024,7 @@ and redisplay normally--don't erase and redraw the frame. */)
5006 (register Lisp_Object arg) 5024 (register Lisp_Object arg)
5007{ 5025{
5008 struct window *w = XWINDOW (selected_window); 5026 struct window *w = XWINDOW (selected_window);
5009 struct buffer *buf = XBUFFER (w->buffer); 5027 struct buffer *buf = XBUFFER (WVAR (w, buffer));
5010 struct buffer *obuf = current_buffer; 5028 struct buffer *obuf = current_buffer;
5011 int center_p = 0; 5029 int center_p = 0;
5012 ptrdiff_t charpos, bytepos; 5030 ptrdiff_t charpos, bytepos;
@@ -5050,12 +5068,12 @@ and redisplay normally--don't erase and redraw the frame. */)
5050 /* Do this after making BUF current 5068 /* Do this after making BUF current
5051 in case scroll_margin is buffer-local. */ 5069 in case scroll_margin is buffer-local. */
5052 this_scroll_margin = 5070 this_scroll_margin =
5053 max (0, min (scroll_margin, XFASTINT (w->total_lines) / 4)); 5071 max (0, min (scroll_margin, XFASTINT (WVAR (w, total_lines)) / 4));
5054 5072
5055 /* Handle centering on a graphical frame specially. Such frames can 5073 /* Handle centering on a graphical frame specially. Such frames can
5056 have variable-height lines and centering point on the basis of 5074 have variable-height lines and centering point on the basis of
5057 line counts would lead to strange effects. */ 5075 line counts would lead to strange effects. */
5058 if (FRAME_WINDOW_P (XFRAME (w->frame))) 5076 if (FRAME_WINDOW_P (XFRAME (WVAR (w, frame))))
5059 { 5077 {
5060 if (center_p) 5078 if (center_p)
5061 { 5079 {
@@ -5172,8 +5190,8 @@ and redisplay normally--don't erase and redraw the frame. */)
5172 } 5190 }
5173 5191
5174 /* Set the new window start. */ 5192 /* Set the new window start. */
5175 set_marker_both (w->start, w->buffer, charpos, bytepos); 5193 set_marker_both (WVAR (w, start), WVAR (w, buffer), charpos, bytepos);
5176 w->window_end_valid = Qnil; 5194 WVAR (w, window_end_valid) = Qnil;
5177 5195
5178 w->optional_new_start = 1; 5196 w->optional_new_start = 1;
5179 5197
@@ -5195,7 +5213,7 @@ nor any partial-height lines at the bottom of the text area. */)
5195{ 5213{
5196 struct window *w = decode_window (window); 5214 struct window *w = decode_window (window);
5197 int pixel_height = window_box_height (w); 5215 int pixel_height = window_box_height (w);
5198 int line_height = pixel_height / FRAME_LINE_HEIGHT (XFRAME (w->frame)); 5216 int line_height = pixel_height / FRAME_LINE_HEIGHT (XFRAME (WVAR (w, frame)));
5199 return make_number (line_height); 5217 return make_number (line_height);
5200} 5218}
5201 5219
@@ -5216,24 +5234,24 @@ zero means top of window, negative means relative to bottom of window. */)
5216 int this_scroll_margin; 5234 int this_scroll_margin;
5217#endif 5235#endif
5218 5236
5219 if (!(BUFFERP (w->buffer) 5237 if (!(BUFFERP (WVAR (w, buffer))
5220 && XBUFFER (w->buffer) == current_buffer)) 5238 && XBUFFER (WVAR (w, buffer)) == current_buffer))
5221 /* This test is needed to make sure PT/PT_BYTE make sense in w->buffer 5239 /* This test is needed to make sure PT/PT_BYTE make sense in w->buffer
5222 when passed below to set_marker_both. */ 5240 when passed below to set_marker_both. */
5223 error ("move-to-window-line called from unrelated buffer"); 5241 error ("move-to-window-line called from unrelated buffer");
5224 5242
5225 window = selected_window; 5243 window = selected_window;
5226 start = marker_position (w->start); 5244 start = marker_position (WVAR (w, start));
5227 if (start < BEGV || start > ZV) 5245 if (start < BEGV || start > ZV)
5228 { 5246 {
5229 int height = window_internal_height (w); 5247 int height = window_internal_height (w);
5230 Fvertical_motion (make_number (- (height / 2)), window); 5248 Fvertical_motion (make_number (- (height / 2)), window);
5231 set_marker_both (w->start, w->buffer, PT, PT_BYTE); 5249 set_marker_both (WVAR (w, start), WVAR (w, buffer), PT, PT_BYTE);
5232 w->start_at_line_beg = !NILP (Fbolp ()); 5250 w->start_at_line_beg = !NILP (Fbolp ());
5233 w->force_start = 1; 5251 w->force_start = 1;
5234 } 5252 }
5235 else 5253 else
5236 Fgoto_char (w->start); 5254 Fgoto_char (WVAR (w, start));
5237 5255
5238 lines = displayed_window_lines (w); 5256 lines = displayed_window_lines (w);
5239 5257
@@ -5337,7 +5355,7 @@ DEFUN ("window-configuration-frame", Fwindow_configuration_frame, Swindow_config
5337 5355
5338 data = (struct save_window_data *) XVECTOR (config); 5356 data = (struct save_window_data *) XVECTOR (config);
5339 saved_windows = XVECTOR (data->saved_windows); 5357 saved_windows = XVECTOR (data->saved_windows);
5340 return XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window)->frame; 5358 return WVAR (XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window), frame);
5341} 5359}
5342 5360
5343DEFUN ("set-window-configuration", Fset_window_configuration, 5361DEFUN ("set-window-configuration", Fset_window_configuration,
@@ -5379,11 +5397,11 @@ the return value is nil. Otherwise the value is t. */)
5379 window-point of the final-selected-window to the window-point of 5397 window-point of the final-selected-window to the window-point of
5380 the current-selected-window. So we have to be careful which 5398 the current-selected-window. So we have to be careful which
5381 point of the current-buffer we copy into old_point. */ 5399 point of the current-buffer we copy into old_point. */
5382 if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer) 5400 if (EQ (WVAR (XWINDOW (data->current_window), buffer), new_current_buffer)
5383 && WINDOWP (selected_window) 5401 && WINDOWP (selected_window)
5384 && EQ (XWINDOW (selected_window)->buffer, new_current_buffer) 5402 && EQ (WVAR (XWINDOW (selected_window), buffer), new_current_buffer)
5385 && !EQ (selected_window, data->current_window)) 5403 && !EQ (selected_window, data->current_window))
5386 old_point = XMARKER (XWINDOW (data->current_window)->pointm)->charpos; 5404 old_point = XMARKER (WVAR (XWINDOW (data->current_window), pointm))->charpos;
5387 else 5405 else
5388 old_point = PT; 5406 old_point = PT;
5389 else 5407 else
@@ -5395,15 +5413,15 @@ the return value is nil. Otherwise the value is t. */)
5395 So if possible we want this arbitrary choice of "which point" to 5413 So if possible we want this arbitrary choice of "which point" to
5396 be the one from the to-be-selected-window so as to prevent this 5414 be the one from the to-be-selected-window so as to prevent this
5397 window's cursor from being copied from another window. */ 5415 window's cursor from being copied from another window. */
5398 if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer) 5416 if (EQ (WVAR (XWINDOW (data->current_window), buffer), new_current_buffer)
5399 /* If current_window = selected_window, its point is in BUF_PT. */ 5417 /* If current_window = selected_window, its point is in BUF_PT. */
5400 && !EQ (selected_window, data->current_window)) 5418 && !EQ (selected_window, data->current_window))
5401 old_point = XMARKER (XWINDOW (data->current_window)->pointm)->charpos; 5419 old_point = XMARKER (WVAR (XWINDOW (data->current_window), pointm))->charpos;
5402 else 5420 else
5403 old_point = BUF_PT (XBUFFER (new_current_buffer)); 5421 old_point = BUF_PT (XBUFFER (new_current_buffer));
5404 } 5422 }
5405 5423
5406 frame = XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window)->frame; 5424 frame = WVAR (XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window), frame);
5407 f = XFRAME (frame); 5425 f = XFRAME (frame);
5408 5426
5409 /* If f is a dead frame, don't bother rebuilding its window tree. 5427 /* If f is a dead frame, don't bother rebuilding its window tree.
@@ -5456,13 +5474,13 @@ the return value is nil. Otherwise the value is t. */)
5456 window holds garbage.) We do this now, before 5474 window holds garbage.) We do this now, before
5457 restoring the window contents, and prevent it from 5475 restoring the window contents, and prevent it from
5458 being done later on when we select a new window. */ 5476 being done later on when we select a new window. */
5459 if (! NILP (XWINDOW (selected_window)->buffer)) 5477 if (! NILP (WVAR (XWINDOW (selected_window), buffer)))
5460 { 5478 {
5461 w = XWINDOW (selected_window); 5479 w = XWINDOW (selected_window);
5462 set_marker_both (w->pointm, 5480 set_marker_both (WVAR (w, pointm),
5463 w->buffer, 5481 WVAR (w, buffer),
5464 BUF_PT (XBUFFER (w->buffer)), 5482 BUF_PT (XBUFFER (WVAR (w, buffer))),
5465 BUF_PT_BYTE (XBUFFER (w->buffer))); 5483 BUF_PT_BYTE (XBUFFER (WVAR (w, buffer))));
5466 } 5484 }
5467 5485
5468 windows_or_buffers_changed++; 5486 windows_or_buffers_changed++;
@@ -5491,60 +5509,60 @@ the return value is nil. Otherwise the value is t. */)
5491 p = SAVED_WINDOW_N (saved_windows, k); 5509 p = SAVED_WINDOW_N (saved_windows, k);
5492 window = p->window; 5510 window = p->window;
5493 w = XWINDOW (window); 5511 w = XWINDOW (window);
5494 w->next = Qnil; 5512 WVAR (w, next) = Qnil;
5495 5513
5496 if (!NILP (p->parent)) 5514 if (!NILP (p->parent))
5497 w->parent = SAVED_WINDOW_N (saved_windows, 5515 WVAR (w, parent) = SAVED_WINDOW_N (saved_windows,
5498 XFASTINT (p->parent))->window; 5516 XFASTINT (p->parent))->window;
5499 else 5517 else
5500 w->parent = Qnil; 5518 WVAR (w, parent) = Qnil;
5501 5519
5502 if (!NILP (p->prev)) 5520 if (!NILP (p->prev))
5503 { 5521 {
5504 w->prev = SAVED_WINDOW_N (saved_windows, 5522 WVAR (w, prev) = SAVED_WINDOW_N (saved_windows,
5505 XFASTINT (p->prev))->window; 5523 XFASTINT (p->prev))->window;
5506 XWINDOW (w->prev)->next = p->window; 5524 WVAR (XWINDOW (WVAR (w, prev)), next) = p->window;
5507 } 5525 }
5508 else 5526 else
5509 { 5527 {
5510 w->prev = Qnil; 5528 WVAR (w, prev) = Qnil;
5511 if (!NILP (w->parent)) 5529 if (!NILP (WVAR (w, parent)))
5512 { 5530 {
5513 if (EQ (p->total_cols, XWINDOW (w->parent)->total_cols)) 5531 if (EQ (p->total_cols, WVAR (XWINDOW (WVAR (w, parent)), total_cols)))
5514 { 5532 {
5515 XWINDOW (w->parent)->vchild = p->window; 5533 WVAR (XWINDOW (WVAR (w, parent)), vchild) = p->window;
5516 XWINDOW (w->parent)->hchild = Qnil; 5534 WVAR (XWINDOW (WVAR (w, parent)), hchild) = Qnil;
5517 } 5535 }
5518 else 5536 else
5519 { 5537 {
5520 XWINDOW (w->parent)->hchild = p->window; 5538 WVAR (XWINDOW (WVAR (w, parent)), hchild) = p->window;
5521 XWINDOW (w->parent)->vchild = Qnil; 5539 WVAR (XWINDOW (WVAR (w, parent)), vchild) = Qnil;
5522 } 5540 }
5523 } 5541 }
5524 } 5542 }
5525 5543
5526 /* If we squirreled away the buffer in the window's height, 5544 /* If we squirreled away the buffer in the window's height,
5527 restore it now. */ 5545 restore it now. */
5528 if (BUFFERP (w->total_lines)) 5546 if (BUFFERP (WVAR (w, total_lines)))
5529 w->buffer = w->total_lines; 5547 WVAR (w, buffer) = WVAR (w, total_lines);
5530 w->left_col = p->left_col; 5548 WVAR (w, left_col) = p->left_col;
5531 w->top_line = p->top_line; 5549 WVAR (w, top_line) = p->top_line;
5532 w->total_cols = p->total_cols; 5550 WVAR (w, total_cols) = p->total_cols;
5533 w->total_lines = p->total_lines; 5551 WVAR (w, total_lines) = p->total_lines;
5534 w->normal_cols = p->normal_cols; 5552 WVAR (w, normal_cols) = p->normal_cols;
5535 w->normal_lines = p->normal_lines; 5553 WVAR (w, normal_lines) = p->normal_lines;
5536 w->hscroll = XFASTINT (p->hscroll); 5554 w->hscroll = XFASTINT (p->hscroll);
5537 w->min_hscroll = XFASTINT (p->min_hscroll); 5555 w->min_hscroll = XFASTINT (p->min_hscroll);
5538 w->display_table = p->display_table; 5556 WVAR (w, display_table) = p->display_table;
5539 w->left_margin_cols = p->left_margin_cols; 5557 WVAR (w, left_margin_cols) = p->left_margin_cols;
5540 w->right_margin_cols = p->right_margin_cols; 5558 WVAR (w, right_margin_cols) = p->right_margin_cols;
5541 w->left_fringe_width = p->left_fringe_width; 5559 WVAR (w, left_fringe_width) = p->left_fringe_width;
5542 w->right_fringe_width = p->right_fringe_width; 5560 WVAR (w, right_fringe_width) = p->right_fringe_width;
5543 w->fringes_outside_margins = !NILP (p->fringes_outside_margins); 5561 w->fringes_outside_margins = !NILP (p->fringes_outside_margins);
5544 w->scroll_bar_width = p->scroll_bar_width; 5562 WVAR (w, scroll_bar_width) = p->scroll_bar_width;
5545 w->vertical_scroll_bar_type = p->vertical_scroll_bar_type; 5563 WVAR (w, vertical_scroll_bar_type) = p->vertical_scroll_bar_type;
5546 w->dedicated = p->dedicated; 5564 WVAR (w, dedicated) = p->dedicated;
5547 w->combination_limit = p->combination_limit; 5565 WVAR (w, combination_limit) = p->combination_limit;
5548 /* Restore any window parameters that have been saved. 5566 /* Restore any window parameters that have been saved.
5549 Parameters that have not been saved are left alone. */ 5567 Parameters that have not been saved are left alone. */
5550 for (tem = p->window_parameters; CONSP (tem); tem = XCDR (tem)) 5568 for (tem = p->window_parameters; CONSP (tem); tem = XCDR (tem))
@@ -5554,7 +5572,7 @@ the return value is nil. Otherwise the value is t. */)
5554 { 5572 {
5555 if (NILP (XCDR (pers))) 5573 if (NILP (XCDR (pers)))
5556 { 5574 {
5557 par = Fassq (XCAR (pers), w->window_parameters); 5575 par = Fassq (XCAR (pers), WVAR (w, window_parameters));
5558 if (CONSP (par) && !NILP (XCDR (par))) 5576 if (CONSP (par) && !NILP (XCDR (par)))
5559 /* Reset a parameter to nil if and only if it 5577 /* Reset a parameter to nil if and only if it
5560 has a non-nil association. Don't make new 5578 has a non-nil association. Don't make new
@@ -5573,45 +5591,50 @@ the return value is nil. Otherwise the value is t. */)
5573 /* Reinstall the saved buffer and pointers into it. */ 5591 /* Reinstall the saved buffer and pointers into it. */
5574 if (NILP (p->buffer)) 5592 if (NILP (p->buffer))
5575 /* An internal window. */ 5593 /* An internal window. */
5576 w->buffer = p->buffer; 5594 WVAR (w, buffer) = p->buffer;
5577 else if (!NILP (BVAR (XBUFFER (p->buffer), name))) 5595 else if (!NILP (BVAR (XBUFFER (p->buffer), name)))
5578 /* If saved buffer is alive, install it. */ 5596 /* If saved buffer is alive, install it. */
5579 { 5597 {
5580 w->buffer = p->buffer; 5598 WVAR (w, buffer) = p->buffer;
5581 w->start_at_line_beg = !NILP (p->start_at_line_beg); 5599 w->start_at_line_beg = !NILP (p->start_at_line_beg);
5582 set_marker_restricted (w->start, p->start, w->buffer); 5600 set_marker_restricted (WVAR (w, start), p->start, WVAR (w, buffer));
5583 set_marker_restricted (w->pointm, p->pointm, w->buffer); 5601 set_marker_restricted (WVAR (w, pointm), p->pointm,
5584 Fset_marker (BVAR (XBUFFER (w->buffer), mark), 5602 WVAR (w, buffer));
5585 p->mark, w->buffer); 5603 Fset_marker (BVAR (XBUFFER (WVAR (w, buffer)), mark),
5604 p->mark, WVAR (w, buffer));
5586 5605
5587 /* As documented in Fcurrent_window_configuration, don't 5606 /* As documented in Fcurrent_window_configuration, don't
5588 restore the location of point in the buffer which was 5607 restore the location of point in the buffer which was
5589 current when the window configuration was recorded. */ 5608 current when the window configuration was recorded. */
5590 if (!EQ (p->buffer, new_current_buffer) 5609 if (!EQ (p->buffer, new_current_buffer)
5591 && XBUFFER (p->buffer) == current_buffer) 5610 && XBUFFER (p->buffer) == current_buffer)
5592 Fgoto_char (w->pointm); 5611 Fgoto_char (WVAR (w, pointm));
5593 } 5612 }
5594 else if (!NILP (w->buffer) && !NILP (BVAR (XBUFFER (w->buffer), name))) 5613 else if (!NILP (WVAR (w, buffer))
5614 && !NILP (BVAR (XBUFFER (WVAR (w, buffer)), name)))
5595 /* Keep window's old buffer; make sure the markers are 5615 /* Keep window's old buffer; make sure the markers are
5596 real. */ 5616 real. */
5597 { 5617 {
5598 /* Set window markers at start of visible range. */ 5618 /* Set window markers at start of visible range. */
5599 if (XMARKER (w->start)->buffer == 0) 5619 if (XMARKER (WVAR (w, start))->buffer == 0)
5600 set_marker_restricted (w->start, make_number (0), 5620 set_marker_restricted (WVAR (w, start), make_number (0),
5601 w->buffer); 5621 WVAR (w, buffer));
5602 if (XMARKER (w->pointm)->buffer == 0) 5622 if (XMARKER (WVAR (w, pointm))->buffer == 0)
5603 set_marker_restricted_both (w->pointm, w->buffer, 5623 set_marker_restricted_both
5604 BUF_PT (XBUFFER (w->buffer)), 5624 (WVAR (w, pointm), WVAR (w, buffer),
5605 BUF_PT_BYTE (XBUFFER (w->buffer))); 5625 BUF_PT (XBUFFER (WVAR (w, buffer))),
5626 BUF_PT_BYTE (XBUFFER (WVAR (w, buffer))));
5606 w->start_at_line_beg = 1; 5627 w->start_at_line_beg = 1;
5607 } 5628 }
5608 else if (STRINGP (auto_buffer_name = 5629 else if (STRINGP (auto_buffer_name =
5609 Fwindow_parameter (window, Qauto_buffer_name)) 5630 Fwindow_parameter (window, Qauto_buffer_name))
5610 && SCHARS (auto_buffer_name) != 0 5631 && SCHARS (auto_buffer_name) != 0
5611 && !NILP (w->buffer = Fget_buffer_create (auto_buffer_name))) 5632 && !NILP (WVAR (w, buffer) = Fget_buffer_create (auto_buffer_name)))
5612 { 5633 {
5613 set_marker_restricted (w->start, make_number (0), w->buffer); 5634 set_marker_restricted (WVAR (w, start),
5614 set_marker_restricted (w->pointm, make_number (0), w->buffer); 5635 make_number (0), WVAR (w, buffer));
5636 set_marker_restricted (WVAR (w, pointm),
5637 make_number (0), WVAR (w, buffer));
5615 w->start_at_line_beg = 1; 5638 w->start_at_line_beg = 1;
5616 } 5639 }
5617 else 5640 else
@@ -5621,34 +5644,36 @@ the return value is nil. Otherwise the value is t. */)
5621 avoid showing an unimportant buffer and, if necessary, to 5644 avoid showing an unimportant buffer and, if necessary, to
5622 recreate *scratch* in the course (part of Juanma's bs-show 5645 recreate *scratch* in the course (part of Juanma's bs-show
5623 scenario from March 2011). */ 5646 scenario from March 2011). */
5624 w->buffer = other_buffer_safely (Fcurrent_buffer ()); 5647 WVAR (w, buffer) = other_buffer_safely (Fcurrent_buffer ());
5625 /* This will set the markers to beginning of visible 5648 /* This will set the markers to beginning of visible
5626 range. */ 5649 range. */
5627 set_marker_restricted (w->start, make_number (0), w->buffer); 5650 set_marker_restricted (WVAR (w, start),
5628 set_marker_restricted (w->pointm, make_number (0), w->buffer); 5651 make_number (0), WVAR (w, buffer));
5652 set_marker_restricted (WVAR (w, pointm),
5653 make_number (0), WVAR (w, buffer));
5629 w->start_at_line_beg = 1; 5654 w->start_at_line_beg = 1;
5630 if (!NILP (w->dedicated)) 5655 if (!NILP (WVAR (w, dedicated)))
5631 /* Record this window as dead. */ 5656 /* Record this window as dead. */
5632 dead_windows = Fcons (window, dead_windows); 5657 dead_windows = Fcons (window, dead_windows);
5633 /* Make sure window is no more dedicated. */ 5658 /* Make sure window is no more dedicated. */
5634 w->dedicated = Qnil; 5659 WVAR (w, dedicated) = Qnil;
5635 } 5660 }
5636 } 5661 }
5637 5662
5638 FRAME_ROOT_WINDOW (f) = data->root_window; 5663 FRAME_ROOT_WINDOW (f) = data->root_window;
5639 /* Arrange *not* to restore point in the buffer that was 5664 /* Arrange *not* to restore point in the buffer that was
5640 current when the window configuration was saved. */ 5665 current when the window configuration was saved. */
5641 if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer)) 5666 if (EQ (WVAR (XWINDOW (data->current_window), buffer), new_current_buffer))
5642 set_marker_restricted (XWINDOW (data->current_window)->pointm, 5667 set_marker_restricted (WVAR (XWINDOW (data->current_window), pointm),
5643 make_number (old_point), 5668 make_number (old_point),
5644 XWINDOW (data->current_window)->buffer); 5669 WVAR (XWINDOW (data->current_window), buffer));
5645 5670
5646 /* In the following call to `select-window', prevent "swapping out 5671 /* In the following call to `select-window', prevent "swapping out
5647 point" in the old selected window using the buffer that has 5672 point" in the old selected window using the buffer that has
5648 been restored into it. We already swapped out that point from 5673 been restored into it. We already swapped out that point from
5649 that window's old buffer. */ 5674 that window's old buffer. */
5650 select_window (data->current_window, Qnil, 1); 5675 select_window (data->current_window, Qnil, 1);
5651 BVAR (XBUFFER (XWINDOW (selected_window)->buffer), last_selected_window) 5676 BVAR (XBUFFER (WVAR (XWINDOW (selected_window), buffer)), last_selected_window)
5652 = selected_window; 5677 = selected_window;
5653 5678
5654 if (NILP (data->focus_frame) 5679 if (NILP (data->focus_frame)
@@ -5675,14 +5700,14 @@ the return value is nil. Otherwise the value is t. */)
5675 /* Now, free glyph matrices in windows that were not reused. */ 5700 /* Now, free glyph matrices in windows that were not reused. */
5676 for (i = n = 0; i < n_leaf_windows; ++i) 5701 for (i = n = 0; i < n_leaf_windows; ++i)
5677 { 5702 {
5678 if (NILP (leaf_windows[i]->buffer)) 5703 if (NILP (WVAR (leaf_windows[i], buffer)))
5679 { 5704 {
5680 /* Assert it's not reused as a combination. */ 5705 /* Assert it's not reused as a combination. */
5681 eassert (NILP (leaf_windows[i]->hchild) 5706 eassert (NILP (WVAR (leaf_windows[i], hchild))
5682 && NILP (leaf_windows[i]->vchild)); 5707 && NILP (WVAR (leaf_windows[i], vchild)));
5683 free_window_matrices (leaf_windows[i]); 5708 free_window_matrices (leaf_windows[i]);
5684 } 5709 }
5685 else if (EQ (leaf_windows[i]->buffer, new_current_buffer)) 5710 else if (EQ (WVAR (leaf_windows[i], buffer), new_current_buffer))
5686 ++n; 5711 ++n;
5687 } 5712 }
5688 5713
@@ -5727,28 +5752,28 @@ delete_all_child_windows (Lisp_Object window)
5727 5752
5728 w = XWINDOW (window); 5753 w = XWINDOW (window);
5729 5754
5730 if (!NILP (w->next)) 5755 if (!NILP (WVAR (w, next)))
5731 /* Delete WINDOW's siblings (we traverse postorderly). */ 5756 /* Delete WINDOW's siblings (we traverse postorderly). */
5732 delete_all_child_windows (w->next); 5757 delete_all_child_windows (WVAR (w, next));
5733 5758
5734 w->total_lines = w->buffer; /* See Fset_window_configuration for excuse. */ 5759 WVAR (w, total_lines) = WVAR (w, buffer); /* See Fset_window_configuration for excuse. */
5735 5760
5736 if (!NILP (w->vchild)) 5761 if (!NILP (WVAR (w, vchild)))
5737 { 5762 {
5738 delete_all_child_windows (w->vchild); 5763 delete_all_child_windows (WVAR (w, vchild));
5739 w->vchild = Qnil; 5764 WVAR (w, vchild) = Qnil;
5740 } 5765 }
5741 else if (!NILP (w->hchild)) 5766 else if (!NILP (WVAR (w, hchild)))
5742 { 5767 {
5743 delete_all_child_windows (w->hchild); 5768 delete_all_child_windows (WVAR (w, hchild));
5744 w->hchild = Qnil; 5769 WVAR (w, hchild) = Qnil;
5745 } 5770 }
5746 else if (!NILP (w->buffer)) 5771 else if (!NILP (WVAR (w, buffer)))
5747 { 5772 {
5748 unshow_buffer (w); 5773 unshow_buffer (w);
5749 unchain_marker (XMARKER (w->pointm)); 5774 unchain_marker (XMARKER (WVAR (w, pointm)));
5750 unchain_marker (XMARKER (w->start)); 5775 unchain_marker (XMARKER (WVAR (w, start)));
5751 w->buffer = Qnil; 5776 WVAR (w, buffer) = Qnil;
5752 } 5777 }
5753 5778
5754 Vwindow_list = Qnil; 5779 Vwindow_list = Qnil;
@@ -5758,12 +5783,12 @@ static int
5758count_windows (register struct window *window) 5783count_windows (register struct window *window)
5759{ 5784{
5760 register int count = 1; 5785 register int count = 1;
5761 if (!NILP (window->next)) 5786 if (!NILP (WVAR (window, next)))
5762 count += count_windows (XWINDOW (window->next)); 5787 count += count_windows (XWINDOW (WVAR (window, next)));
5763 if (!NILP (window->vchild)) 5788 if (!NILP (WVAR (window, vchild)))
5764 count += count_windows (XWINDOW (window->vchild)); 5789 count += count_windows (XWINDOW (WVAR (window, vchild)));
5765 if (!NILP (window->hchild)) 5790 if (!NILP (WVAR (window, hchild)))
5766 count += count_windows (XWINDOW (window->hchild)); 5791 count += count_windows (XWINDOW (WVAR (window, hchild)));
5767 return count; 5792 return count;
5768} 5793}
5769 5794
@@ -5775,14 +5800,14 @@ get_leaf_windows (struct window *w, struct window **flat, int i)
5775{ 5800{
5776 while (w) 5801 while (w)
5777 { 5802 {
5778 if (!NILP (w->hchild)) 5803 if (!NILP (WVAR (w, hchild)))
5779 i = get_leaf_windows (XWINDOW (w->hchild), flat, i); 5804 i = get_leaf_windows (XWINDOW (WVAR (w, hchild)), flat, i);
5780 else if (!NILP (w->vchild)) 5805 else if (!NILP (WVAR (w, vchild)))
5781 i = get_leaf_windows (XWINDOW (w->vchild), flat, i); 5806 i = get_leaf_windows (XWINDOW (WVAR (w, vchild)), flat, i);
5782 else 5807 else
5783 flat[i++] = w; 5808 flat[i++] = w;
5784 5809
5785 w = NILP (w->next) ? 0 : XWINDOW (w->next); 5810 w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next));
5786 } 5811 }
5787 5812
5788 return i; 5813 return i;
@@ -5835,32 +5860,32 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
5835 register struct window *w; 5860 register struct window *w;
5836 register Lisp_Object tem, pers, par; 5861 register Lisp_Object tem, pers, par;
5837 5862
5838 for (;!NILP (window); window = w->next) 5863 for (;!NILP (window); window = WVAR (w, next))
5839 { 5864 {
5840 p = SAVED_WINDOW_N (vector, i); 5865 p = SAVED_WINDOW_N (vector, i);
5841 w = XWINDOW (window); 5866 w = XWINDOW (window);
5842 5867
5843 XSETFASTINT (w->temslot, i); i++; 5868 XSETFASTINT (WVAR (w, temslot), i); i++;
5844 p->window = window; 5869 p->window = window;
5845 p->buffer = w->buffer; 5870 p->buffer = WVAR (w, buffer);
5846 p->left_col = w->left_col; 5871 p->left_col = WVAR (w, left_col);
5847 p->top_line = w->top_line; 5872 p->top_line = WVAR (w, top_line);
5848 p->total_cols = w->total_cols; 5873 p->total_cols = WVAR (w, total_cols);
5849 p->total_lines = w->total_lines; 5874 p->total_lines = WVAR (w, total_lines);
5850 p->normal_cols = w->normal_cols; 5875 p->normal_cols = WVAR (w, normal_cols);
5851 p->normal_lines = w->normal_lines; 5876 p->normal_lines = WVAR (w, normal_lines);
5852 XSETFASTINT (p->hscroll, w->hscroll); 5877 XSETFASTINT (p->hscroll, w->hscroll);
5853 XSETFASTINT (p->min_hscroll, w->min_hscroll); 5878 XSETFASTINT (p->min_hscroll, w->min_hscroll);
5854 p->display_table = w->display_table; 5879 p->display_table = WVAR (w, display_table);
5855 p->left_margin_cols = w->left_margin_cols; 5880 p->left_margin_cols = WVAR (w, left_margin_cols);
5856 p->right_margin_cols = w->right_margin_cols; 5881 p->right_margin_cols = WVAR (w, right_margin_cols);
5857 p->left_fringe_width = w->left_fringe_width; 5882 p->left_fringe_width = WVAR (w, left_fringe_width);
5858 p->right_fringe_width = w->right_fringe_width; 5883 p->right_fringe_width = WVAR (w, right_fringe_width);
5859 p->fringes_outside_margins = w->fringes_outside_margins ? Qt : Qnil; 5884 p->fringes_outside_margins = w->fringes_outside_margins ? Qt : Qnil;
5860 p->scroll_bar_width = w->scroll_bar_width; 5885 p->scroll_bar_width = WVAR (w, scroll_bar_width);
5861 p->vertical_scroll_bar_type = w->vertical_scroll_bar_type; 5886 p->vertical_scroll_bar_type = WVAR (w, vertical_scroll_bar_type);
5862 p->dedicated = w->dedicated; 5887 p->dedicated = WVAR (w, dedicated);
5863 p->combination_limit = w->combination_limit; 5888 p->combination_limit = WVAR (w, combination_limit);
5864 p->window_parameters = Qnil; 5889 p->window_parameters = Qnil;
5865 5890
5866 if (!NILP (Vwindow_persistent_parameters)) 5891 if (!NILP (Vwindow_persistent_parameters))
@@ -5893,7 +5918,7 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
5893 /* Save values for persistent window parameters. */ 5918 /* Save values for persistent window parameters. */
5894 if (CONSP (pers) && !NILP (XCDR (pers))) 5919 if (CONSP (pers) && !NILP (XCDR (pers)))
5895 { 5920 {
5896 par = Fassq (XCAR (pers), w->window_parameters); 5921 par = Fassq (XCAR (pers), WVAR (w, window_parameters));
5897 if (NILP (par)) 5922 if (NILP (par))
5898 /* If the window has no value for the parameter, 5923 /* If the window has no value for the parameter,
5899 make one. */ 5924 make one. */
@@ -5909,24 +5934,24 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
5909 } 5934 }
5910 } 5935 }
5911 5936
5912 if (!NILP (w->buffer)) 5937 if (!NILP (WVAR (w, buffer)))
5913 { 5938 {
5914 /* Save w's value of point in the window configuration. If w 5939 /* Save w's value of point in the window configuration. If w
5915 is the selected window, then get the value of point from 5940 is the selected window, then get the value of point from
5916 the buffer; pointm is garbage in the selected window. */ 5941 the buffer; pointm is garbage in the selected window. */
5917 if (EQ (window, selected_window)) 5942 if (EQ (window, selected_window))
5918 p->pointm = build_marker (XBUFFER (w->buffer), 5943 p->pointm = build_marker (XBUFFER (WVAR (w, buffer)),
5919 BUF_PT (XBUFFER (w->buffer)), 5944 BUF_PT (XBUFFER (WVAR (w, buffer))),
5920 BUF_PT_BYTE (XBUFFER (w->buffer))); 5945 BUF_PT_BYTE (XBUFFER (WVAR (w, buffer))));
5921 else 5946 else
5922 p->pointm = Fcopy_marker (w->pointm, Qnil); 5947 p->pointm = Fcopy_marker (WVAR (w, pointm), Qnil);
5923 XMARKER (p->pointm)->insertion_type 5948 XMARKER (p->pointm)->insertion_type
5924 = !NILP (Vwindow_point_insertion_type); 5949 = !NILP (Vwindow_point_insertion_type);
5925 5950
5926 p->start = Fcopy_marker (w->start, Qnil); 5951 p->start = Fcopy_marker (WVAR (w, start), Qnil);
5927 p->start_at_line_beg = w->start_at_line_beg ? Qt : Qnil; 5952 p->start_at_line_beg = w->start_at_line_beg ? Qt : Qnil;
5928 5953
5929 tem = BVAR (XBUFFER (w->buffer), mark); 5954 tem = BVAR (XBUFFER (WVAR (w, buffer)), mark);
5930 p->mark = Fcopy_marker (tem, Qnil); 5955 p->mark = Fcopy_marker (tem, Qnil);
5931 } 5956 }
5932 else 5957 else
@@ -5937,20 +5962,20 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
5937 p->start_at_line_beg = Qnil; 5962 p->start_at_line_beg = Qnil;
5938 } 5963 }
5939 5964
5940 if (NILP (w->parent)) 5965 if (NILP (WVAR (w, parent)))
5941 p->parent = Qnil; 5966 p->parent = Qnil;
5942 else 5967 else
5943 p->parent = XWINDOW (w->parent)->temslot; 5968 p->parent = WVAR (XWINDOW (WVAR (w, parent)), temslot);
5944 5969
5945 if (NILP (w->prev)) 5970 if (NILP (WVAR (w, prev)))
5946 p->prev = Qnil; 5971 p->prev = Qnil;
5947 else 5972 else
5948 p->prev = XWINDOW (w->prev)->temslot; 5973 p->prev = WVAR (XWINDOW (WVAR (w, prev)), temslot);
5949 5974
5950 if (!NILP (w->vchild)) 5975 if (!NILP (WVAR (w, vchild)))
5951 i = save_window_save (w->vchild, vector, i); 5976 i = save_window_save (WVAR (w, vchild), vector, i);
5952 if (!NILP (w->hchild)) 5977 if (!NILP (WVAR (w, hchild)))
5953 i = save_window_save (w->hchild, vector, i); 5978 i = save_window_save (WVAR (w, hchild), vector, i);
5954 } 5979 }
5955 5980
5956 return i; 5981 return i;
@@ -6039,11 +6064,11 @@ means no margin. */)
6039 right_width = Qnil; 6064 right_width = Qnil;
6040 } 6065 }
6041 6066
6042 if (!EQ (w->left_margin_cols, left_width) 6067 if (!EQ (WVAR (w, left_margin_cols), left_width)
6043 || !EQ (w->right_margin_cols, right_width)) 6068 || !EQ (WVAR (w, right_margin_cols), right_width))
6044 { 6069 {
6045 w->left_margin_cols = left_width; 6070 WVAR (w, left_margin_cols) = left_width;
6046 w->right_margin_cols = right_width; 6071 WVAR (w, right_margin_cols) = right_width;
6047 6072
6048 adjust_window_margins (w); 6073 adjust_window_margins (w);
6049 6074
@@ -6065,7 +6090,7 @@ as nil. */)
6065 (Lisp_Object window) 6090 (Lisp_Object window)
6066{ 6091{
6067 struct window *w = decode_window (window); 6092 struct window *w = decode_window (window);
6068 return Fcons (w->left_margin_cols, w->right_margin_cols); 6093 return Fcons (WVAR (w, left_margin_cols), WVAR (w, right_margin_cols));
6069} 6094}
6070 6095
6071 6096
@@ -6099,18 +6124,18 @@ display marginal areas and the text area. */)
6099 6124
6100 /* Do nothing on a tty. */ 6125 /* Do nothing on a tty. */
6101 if (FRAME_WINDOW_P (WINDOW_XFRAME (w)) 6126 if (FRAME_WINDOW_P (WINDOW_XFRAME (w))
6102 && (!EQ (w->left_fringe_width, left_width) 6127 && (!EQ (WVAR (w, left_fringe_width), left_width)
6103 || !EQ (w->right_fringe_width, right_width) 6128 || !EQ (WVAR (w, right_fringe_width), right_width)
6104 || w->fringes_outside_margins != outside)) 6129 || w->fringes_outside_margins != outside))
6105 { 6130 {
6106 w->left_fringe_width = left_width; 6131 WVAR (w, left_fringe_width) = left_width;
6107 w->right_fringe_width = right_width; 6132 WVAR (w, right_fringe_width) = right_width;
6108 w->fringes_outside_margins = outside; 6133 w->fringes_outside_margins = outside;
6109 6134
6110 adjust_window_margins (w); 6135 adjust_window_margins (w);
6111 6136
6112 clear_glyph_matrix (w->current_matrix); 6137 clear_glyph_matrix (w->current_matrix);
6113 w->window_end_valid = Qnil; 6138 WVAR (w, window_end_valid) = Qnil;
6114 6139
6115 ++windows_or_buffers_changed; 6140 ++windows_or_buffers_changed;
6116 adjust_glyphs (XFRAME (WINDOW_FRAME (w))); 6141 adjust_glyphs (XFRAME (WINDOW_FRAME (w)));
@@ -6170,16 +6195,16 @@ Fourth parameter HORIZONTAL-TYPE is currently unused. */)
6170 || EQ (vertical_type, Qt))) 6195 || EQ (vertical_type, Qt)))
6171 error ("Invalid type of vertical scroll bar"); 6196 error ("Invalid type of vertical scroll bar");
6172 6197
6173 if (!EQ (w->scroll_bar_width, width) 6198 if (!EQ (WVAR (w, scroll_bar_width), width)
6174 || !EQ (w->vertical_scroll_bar_type, vertical_type)) 6199 || !EQ (WVAR (w, vertical_scroll_bar_type), vertical_type))
6175 { 6200 {
6176 w->scroll_bar_width = width; 6201 WVAR (w, scroll_bar_width) = width;
6177 w->vertical_scroll_bar_type = vertical_type; 6202 WVAR (w, vertical_scroll_bar_type) = vertical_type;
6178 6203
6179 adjust_window_margins (w); 6204 adjust_window_margins (w);
6180 6205
6181 clear_glyph_matrix (w->current_matrix); 6206 clear_glyph_matrix (w->current_matrix);
6182 w->window_end_valid = Qnil; 6207 WVAR (w, window_end_valid) = Qnil;
6183 6208
6184 ++windows_or_buffers_changed; 6209 ++windows_or_buffers_changed;
6185 adjust_glyphs (XFRAME (WINDOW_FRAME (w))); 6210 adjust_glyphs (XFRAME (WINDOW_FRAME (w)));
@@ -6203,7 +6228,7 @@ value. */)
6203 ? WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) 6228 ? WINDOW_CONFIG_SCROLL_BAR_WIDTH (w)
6204 : WINDOW_SCROLL_BAR_AREA_WIDTH (w))), 6229 : WINDOW_SCROLL_BAR_AREA_WIDTH (w))),
6205 Fcons (make_number (WINDOW_SCROLL_BAR_COLS (w)), 6230 Fcons (make_number (WINDOW_SCROLL_BAR_COLS (w)),
6206 Fcons (w->vertical_scroll_bar_type, 6231 Fcons (WVAR (w, vertical_scroll_bar_type),
6207 Fcons (Qnil, Qnil)))); 6232 Fcons (Qnil, Qnil))));
6208} 6233}
6209 6234
@@ -6229,7 +6254,7 @@ optional second arg PIXELS-P means value is measured in pixels. */)
6229 else 6254 else
6230 CHECK_WINDOW (window); 6255 CHECK_WINDOW (window);
6231 w = XWINDOW (window); 6256 w = XWINDOW (window);
6232 f = XFRAME (w->frame); 6257 f = XFRAME (WVAR (w, frame));
6233 6258
6234 if (FRAME_WINDOW_P (f)) 6259 if (FRAME_WINDOW_P (f))
6235 result = (NILP (pixels_p) 6260 result = (NILP (pixels_p)
@@ -6263,7 +6288,7 @@ If PIXELS-P is non-nil, the return value is VSCROLL. */)
6263 CHECK_NUMBER_OR_FLOAT (vscroll); 6288 CHECK_NUMBER_OR_FLOAT (vscroll);
6264 6289
6265 w = XWINDOW (window); 6290 w = XWINDOW (window);
6266 f = XFRAME (w->frame); 6291 f = XFRAME (WVAR (w, frame));
6267 6292
6268 if (FRAME_WINDOW_P (f)) 6293 if (FRAME_WINDOW_P (f))
6269 { 6294 {
@@ -6282,7 +6307,7 @@ If PIXELS-P is non-nil, the return value is VSCROLL. */)
6282 adjust_glyphs (f); 6307 adjust_glyphs (f);
6283 6308
6284 /* Prevent redisplay shortcuts. */ 6309 /* Prevent redisplay shortcuts. */
6285 XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; 6310 XBUFFER (WVAR (w, buffer))->prevent_redisplay_optimizations_p = 1;
6286 } 6311 }
6287 } 6312 }
6288 6313
@@ -6316,14 +6341,14 @@ foreach_window_1 (struct window *w, int (*fn) (struct window *, void *), void *u
6316 6341
6317 for (cont = 1; w && cont;) 6342 for (cont = 1; w && cont;)
6318 { 6343 {
6319 if (!NILP (w->hchild)) 6344 if (!NILP (WVAR (w, hchild)))
6320 cont = foreach_window_1 (XWINDOW (w->hchild), fn, user_data); 6345 cont = foreach_window_1 (XWINDOW (WVAR (w, hchild)), fn, user_data);
6321 else if (!NILP (w->vchild)) 6346 else if (!NILP (WVAR (w, vchild)))
6322 cont = foreach_window_1 (XWINDOW (w->vchild), fn, user_data); 6347 cont = foreach_window_1 (XWINDOW (WVAR (w, vchild)), fn, user_data);
6323 else 6348 else
6324 cont = fn (w, user_data); 6349 cont = fn (w, user_data);
6325 6350
6326 w = NILP (w->next) ? 0 : XWINDOW (w->next); 6351 w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next));
6327 } 6352 }
6328 6353
6329 return cont; 6354 return cont;
diff --git a/src/window.h b/src/window.h
index 16aecd0f01d..ece58d2cf97 100644
--- a/src/window.h
+++ b/src/window.h
@@ -86,142 +86,150 @@ struct cursor_pos
86 int hpos, vpos; 86 int hpos, vpos;
87}; 87};
88 88
89/* Most code should use this macro to access Lisp fields in struct window. */
90
91#define WVAR(w, field) ((w)->INTERNAL_FIELD (field))
92
89struct window 93struct window
90 { 94 {
91 /* This is for Lisp; the terminal code does not refer to it. */ 95 /* This is for Lisp; the terminal code does not refer to it. */
92 struct vectorlike_header header; 96 struct vectorlike_header header;
93 97
94 /* The frame this window is on. */ 98 /* The frame this window is on. */
95 Lisp_Object frame; 99 Lisp_Object INTERNAL_FIELD (frame);
96 100
97 /* Following (to right or down) and preceding (to left or up) child 101 /* Following (to right or down) and preceding (to left or up) child
98 at same level of tree. */ 102 at same level of tree. */
99 Lisp_Object next, prev; 103 Lisp_Object INTERNAL_FIELD (next);
104 Lisp_Object INTERNAL_FIELD (prev);
100 105
101 /* First child of this window: vchild is used if this is a vertical 106 /* First child of this window: vchild is used if this is a vertical
102 combination, hchild if this is a horizontal combination. Of the 107 combination, hchild if this is a horizontal combination. Of the
103 fields vchild, hchild and buffer, one and only one is non-nil 108 fields vchild, hchild and buffer, one and only one is non-nil
104 unless the window is dead. */ 109 unless the window is dead. */
105 Lisp_Object hchild, vchild; 110 Lisp_Object INTERNAL_FIELD (hchild);
111 Lisp_Object INTERNAL_FIELD (vchild);
106 112
107 /* The window this one is a child of. */ 113 /* The window this one is a child of. */
108 Lisp_Object parent; 114 Lisp_Object INTERNAL_FIELD (parent);
109 115
110 /* The upper left corner coordinates of this window, as integers 116 /* The upper left corner coordinates of this window, as integers
111 relative to upper left corner of frame = 0, 0. */ 117 relative to upper left corner of frame = 0, 0. */
112 Lisp_Object left_col; 118 Lisp_Object INTERNAL_FIELD (left_col);
113 Lisp_Object top_line; 119 Lisp_Object INTERNAL_FIELD (top_line);
114 120
115 /* The size of the window. */ 121 /* The size of the window. */
116 Lisp_Object total_lines; 122 Lisp_Object INTERNAL_FIELD (total_lines);
117 Lisp_Object total_cols; 123 Lisp_Object INTERNAL_FIELD (total_cols);
118 124
119 /* The normal size of the window. */ 125 /* The normal size of the window. */
120 Lisp_Object normal_lines; 126 Lisp_Object INTERNAL_FIELD (normal_lines);
121 Lisp_Object normal_cols; 127 Lisp_Object INTERNAL_FIELD (normal_cols);
122 128
123 /* New sizes of the window. */ 129 /* New sizes of the window. */
124 Lisp_Object new_total; 130 Lisp_Object INTERNAL_FIELD (new_total);
125 Lisp_Object new_normal; 131 Lisp_Object INTERNAL_FIELD (new_normal);
126 132
127 /* The buffer displayed in this window. Of the fields vchild, 133 /* The buffer displayed in this window. Of the fields vchild,
128 hchild and buffer, one and only one is non-nil unless the window 134 hchild and buffer, one and only one is non-nil unless the window
129 is dead. */ 135 is dead. */
130 Lisp_Object buffer; 136 Lisp_Object INTERNAL_FIELD (buffer);
131 137
132 /* A marker pointing to where in the text to start displaying. 138 /* A marker pointing to where in the text to start displaying.
133 BIDI Note: This is the _logical-order_ start, i.e. the smallest 139 BIDI Note: This is the _logical-order_ start, i.e. the smallest
134 buffer position visible in the window, not necessarily the 140 buffer position visible in the window, not necessarily the
135 character displayed in the top left corner of the window. */ 141 character displayed in the top left corner of the window. */
136 Lisp_Object start; 142 Lisp_Object INTERNAL_FIELD (start);
137 143
138 /* A marker pointing to where in the text point is in this window, 144 /* A marker pointing to where in the text point is in this window,
139 used only when the window is not selected. 145 used only when the window is not selected.
140 This exists so that when multiple windows show one buffer 146 This exists so that when multiple windows show one buffer
141 each one can have its own value of point. */ 147 each one can have its own value of point. */
142 Lisp_Object pointm; 148 Lisp_Object INTERNAL_FIELD (pointm);
143 149
144 /* No permanent meaning; used by save-window-excursion's 150 /* No permanent meaning; used by save-window-excursion's
145 bookkeeping. */ 151 bookkeeping. */
146 Lisp_Object temslot; 152 Lisp_Object INTERNAL_FIELD (temslot);
147 153
148 /* This window's vertical scroll bar. This field is only for use 154 /* This window's vertical scroll bar. This field is only for use
149 by the window-system-dependent code which implements the 155 by the window-system-dependent code which implements the
150 scroll bars; it can store anything it likes here. If this 156 scroll bars; it can store anything it likes here. If this
151 window is newly created and we haven't displayed a scroll bar in 157 window is newly created and we haven't displayed a scroll bar in
152 it yet, or if the frame doesn't have any scroll bars, this is nil. */ 158 it yet, or if the frame doesn't have any scroll bars, this is nil. */
153 Lisp_Object vertical_scroll_bar; 159 Lisp_Object INTERNAL_FIELD (vertical_scroll_bar);
154 160
155 /* Width of left and right marginal areas. A value of nil means 161 /* Width of left and right marginal areas. A value of nil means
156 no margin. */ 162 no margin. */
157 Lisp_Object left_margin_cols, right_margin_cols; 163 Lisp_Object INTERNAL_FIELD (left_margin_cols);
164 Lisp_Object INTERNAL_FIELD (right_margin_cols);
158 165
159 /* Width of left and right fringes. 166 /* Width of left and right fringes.
160 A value of nil or t means use frame values. */ 167 A value of nil or t means use frame values. */
161 Lisp_Object left_fringe_width, right_fringe_width; 168 Lisp_Object INTERNAL_FIELD (left_fringe_width);
169 Lisp_Object INTERNAL_FIELD (right_fringe_width);
162 170
163 /* Pixel width of scroll bars. 171 /* Pixel width of scroll bars.
164 A value of nil or t means use frame values. */ 172 A value of nil or t means use frame values. */
165 Lisp_Object scroll_bar_width; 173 Lisp_Object INTERNAL_FIELD (scroll_bar_width);
166 174
167 /* Type of vertical scroll bar. A value of nil means 175 /* Type of vertical scroll bar. A value of nil means
168 no scroll bar. A value of t means use frame value. */ 176 no scroll bar. A value of t means use frame value. */
169 Lisp_Object vertical_scroll_bar_type; 177 Lisp_Object INTERNAL_FIELD (vertical_scroll_bar_type);
170 178
171 /* Z - the buffer position of the last glyph in the current matrix 179 /* Z - the buffer position of the last glyph in the current matrix
172 of W. Only valid if WINDOW_END_VALID is not nil. */ 180 of W. Only valid if WINDOW_END_VALID is not nil. */
173 Lisp_Object window_end_pos; 181 Lisp_Object INTERNAL_FIELD (window_end_pos);
174 /* Glyph matrix row of the last glyph in the current matrix 182 /* Glyph matrix row of the last glyph in the current matrix
175 of W. Only valid if WINDOW_END_VALID is not nil. */ 183 of W. Only valid if WINDOW_END_VALID is not nil. */
176 Lisp_Object window_end_vpos; 184 Lisp_Object INTERNAL_FIELD (window_end_vpos);
177 /* t if window_end_pos is truly valid. 185 /* t if window_end_pos is truly valid.
178 This is nil if nontrivial redisplay is preempted 186 This is nil if nontrivial redisplay is preempted
179 since in that case the frame image that window_end_pos 187 since in that case the frame image that window_end_pos
180 did not get onto the frame. */ 188 did not get onto the frame. */
181 Lisp_Object window_end_valid; 189 Lisp_Object INTERNAL_FIELD (window_end_valid);
182 190
183 /* Display-table to use for displaying chars in this window. 191 /* Display-table to use for displaying chars in this window.
184 Nil means use the buffer's own display-table. */ 192 Nil means use the buffer's own display-table. */
185 Lisp_Object display_table; 193 Lisp_Object INTERNAL_FIELD (display_table);
186 194
187 /* Non-nil usually means window is marked as dedicated. 195 /* Non-nil usually means window is marked as dedicated.
188 Note Lisp code may set this to something beyond Qnil 196 Note Lisp code may set this to something beyond Qnil
189 and Qt, so bitfield can't be used here. */ 197 and Qt, so bitfield can't be used here. */
190 Lisp_Object dedicated; 198 Lisp_Object INTERNAL_FIELD (dedicated);
191 199
192 /* Line number and position of a line somewhere above the top of the 200 /* Line number and position of a line somewhere above the top of the
193 screen. If this field is nil, it means we don't have a base 201 screen. If this field is nil, it means we don't have a base
194 line. */ 202 line. */
195 Lisp_Object base_line_number; 203 Lisp_Object INTERNAL_FIELD (base_line_number);
196 /* If this field is nil, it means we don't have a base line. 204 /* If this field is nil, it means we don't have a base line.
197 If it is a buffer, it means don't display the line number 205 If it is a buffer, it means don't display the line number
198 as long as the window shows that buffer. */ 206 as long as the window shows that buffer. */
199 Lisp_Object base_line_pos; 207 Lisp_Object INTERNAL_FIELD (base_line_pos);
200 208
201 /* If we have highlighted the region (or any part of it), 209 /* If we have highlighted the region (or any part of it),
202 this is the mark position that we used, as an integer. */ 210 this is the mark position that we used, as an integer. */
203 Lisp_Object region_showing; 211 Lisp_Object INTERNAL_FIELD (region_showing);
204 212
205 /* The column number currently displayed in this window's mode line, 213 /* The column number currently displayed in this window's mode line,
206 or nil if column numbers are not being displayed. */ 214 or nil if column numbers are not being displayed. */
207 Lisp_Object column_number_displayed; 215 Lisp_Object INTERNAL_FIELD (column_number_displayed);
208 216
209 /* If redisplay in this window goes beyond this buffer position, 217 /* If redisplay in this window goes beyond this buffer position,
210 must run the redisplay-end-trigger-hook. */ 218 must run the redisplay-end-trigger-hook. */
211 Lisp_Object redisplay_end_trigger; 219 Lisp_Object INTERNAL_FIELD (redisplay_end_trigger);
212 220
213 /* t means this window's child windows are not (re-)combined. */ 221 /* t means this window's child windows are not (re-)combined. */
214 Lisp_Object combination_limit; 222 Lisp_Object INTERNAL_FIELD (combination_limit);
215 223
216 /* Alist of <buffer, window-start, window-point> triples listing 224 /* Alist of <buffer, window-start, window-point> triples listing
217 buffers previously shown in this window. */ 225 buffers previously shown in this window. */
218 Lisp_Object prev_buffers; 226 Lisp_Object INTERNAL_FIELD (prev_buffers);
219 227
220 /* List of buffers re-shown in this window. */ 228 /* List of buffers re-shown in this window. */
221 Lisp_Object next_buffers; 229 Lisp_Object INTERNAL_FIELD (next_buffers);
222 230
223 /* An alist with parameters. */ 231 /* An alist with parameters. */
224 Lisp_Object window_parameters; 232 Lisp_Object INTERNAL_FIELD (window_parameters);
225 233
226 /* No Lisp data may follow below this point without changing 234 /* No Lisp data may follow below this point without changing
227 mark_object in alloc.c. The member current_matrix must be the 235 mark_object in alloc.c. The member current_matrix must be the
@@ -388,13 +396,13 @@ struct window
388 This includes scroll bars and fringes. */ 396 This includes scroll bars and fringes. */
389 397
390#define WINDOW_TOTAL_COLS(W) \ 398#define WINDOW_TOTAL_COLS(W) \
391 (XFASTINT ((W)->total_cols)) 399 (XFASTINT (WVAR (W, total_cols)))
392 400
393/* Return the height of window W in canonical line units. 401/* Return the height of window W in canonical line units.
394 This includes header and mode lines, if any. */ 402 This includes header and mode lines, if any. */
395 403
396#define WINDOW_TOTAL_LINES(W) \ 404#define WINDOW_TOTAL_LINES(W) \
397 (XFASTINT ((W)->total_lines)) 405 (XFASTINT (WVAR (W, total_lines)))
398 406
399/* Return the total pixel width of window W. */ 407/* Return the total pixel width of window W. */
400 408
@@ -422,7 +430,7 @@ struct window
422 This includes a left-hand scroll bar, if any. */ 430 This includes a left-hand scroll bar, if any. */
423 431
424#define WINDOW_LEFT_EDGE_COL(W) \ 432#define WINDOW_LEFT_EDGE_COL(W) \
425 (XFASTINT ((W)->left_col)) 433 (XFASTINT (WVAR (W, left_col)))
426 434
427/* Return the canonical frame column before which window W ends. 435/* Return the canonical frame column before which window W ends.
428 This includes a right-hand scroll bar, if any. */ 436 This includes a right-hand scroll bar, if any. */
@@ -434,7 +442,7 @@ struct window
434 This includes a header line, if any. */ 442 This includes a header line, if any. */
435 443
436#define WINDOW_TOP_EDGE_LINE(W) \ 444#define WINDOW_TOP_EDGE_LINE(W) \
437 (XFASTINT ((W)->top_line)) 445 (XFASTINT (WVAR (W, top_line)))
438 446
439/* Return the canonical frame line before which window W ends. 447/* Return the canonical frame line before which window W ends.
440 This includes a mode line, if any. */ 448 This includes a mode line, if any. */
@@ -539,31 +547,31 @@ struct window
539/* Width of left margin area in columns. */ 547/* Width of left margin area in columns. */
540 548
541#define WINDOW_LEFT_MARGIN_COLS(W) \ 549#define WINDOW_LEFT_MARGIN_COLS(W) \
542 (NILP ((W)->left_margin_cols) \ 550 (NILP (WVAR (W, left_margin_cols)) \
543 ? 0 \ 551 ? 0 \
544 : XINT ((W)->left_margin_cols)) 552 : XINT (WVAR (W, left_margin_cols)))
545 553
546/* Width of right marginal area in columns. */ 554/* Width of right marginal area in columns. */
547 555
548#define WINDOW_RIGHT_MARGIN_COLS(W) \ 556#define WINDOW_RIGHT_MARGIN_COLS(W) \
549 (NILP ((W)->right_margin_cols) \ 557 (NILP (WVAR (W, right_margin_cols)) \
550 ? 0 \ 558 ? 0 \
551 : XINT ((W)->right_margin_cols)) 559 : XINT (WVAR (W, right_margin_cols)))
552 560
553/* Width of left margin area in pixels. */ 561/* Width of left margin area in pixels. */
554 562
555#define WINDOW_LEFT_MARGIN_WIDTH(W) \ 563#define WINDOW_LEFT_MARGIN_WIDTH(W) \
556 (NILP ((W)->left_margin_cols) \ 564 (NILP (WVAR (W, left_margin_cols)) \
557 ? 0 \ 565 ? 0 \
558 : (XINT ((W)->left_margin_cols) \ 566 : (XINT (WVAR (W, left_margin_cols)) \
559 * WINDOW_FRAME_COLUMN_WIDTH (W))) 567 * WINDOW_FRAME_COLUMN_WIDTH (W)))
560 568
561/* Width of right marginal area in pixels. */ 569/* Width of right marginal area in pixels. */
562 570
563#define WINDOW_RIGHT_MARGIN_WIDTH(W) \ 571#define WINDOW_RIGHT_MARGIN_WIDTH(W) \
564 (NILP ((W)->right_margin_cols) \ 572 (NILP (WVAR (W, right_margin_cols)) \
565 ? 0 \ 573 ? 0 \
566 : (XINT ((W)->right_margin_cols) \ 574 : (XINT (WVAR (W, right_margin_cols)) \
567 * WINDOW_FRAME_COLUMN_WIDTH (W))) 575 * WINDOW_FRAME_COLUMN_WIDTH (W)))
568 576
569/* Total width of fringes reserved for drawing truncation bitmaps, 577/* Total width of fringes reserved for drawing truncation bitmaps,
@@ -573,8 +581,8 @@ struct window
573 able to split windows horizontally nicely. */ 581 able to split windows horizontally nicely. */
574 582
575#define WINDOW_FRINGE_COLS(W) \ 583#define WINDOW_FRINGE_COLS(W) \
576 ((INTEGERP ((W)->left_fringe_width) \ 584 ((INTEGERP (WVAR (W, left_fringe_width)) \
577 || INTEGERP ((W)->right_fringe_width)) \ 585 || INTEGERP (WVAR (W, right_fringe_width))) \
578 ? ((WINDOW_LEFT_FRINGE_WIDTH (W) \ 586 ? ((WINDOW_LEFT_FRINGE_WIDTH (W) \
579 + WINDOW_RIGHT_FRINGE_WIDTH (W) \ 587 + WINDOW_RIGHT_FRINGE_WIDTH (W) \
580 + WINDOW_FRAME_COLUMN_WIDTH (W) - 1) \ 588 + WINDOW_FRAME_COLUMN_WIDTH (W) - 1) \
@@ -596,13 +604,13 @@ struct window
596/* Pixel-width of the left and right fringe. */ 604/* Pixel-width of the left and right fringe. */
597 605
598#define WINDOW_LEFT_FRINGE_WIDTH(W) \ 606#define WINDOW_LEFT_FRINGE_WIDTH(W) \
599 (INTEGERP ((W)->left_fringe_width) \ 607 (INTEGERP (WVAR (W, left_fringe_width)) \
600 ? XFASTINT ((W)->left_fringe_width) \ 608 ? XFASTINT (WVAR (W, left_fringe_width)) \
601 : FRAME_LEFT_FRINGE_WIDTH (WINDOW_XFRAME (W))) 609 : FRAME_LEFT_FRINGE_WIDTH (WINDOW_XFRAME (W)))
602 610
603#define WINDOW_RIGHT_FRINGE_WIDTH(W) \ 611#define WINDOW_RIGHT_FRINGE_WIDTH(W) \
604 (INTEGERP ((W)->right_fringe_width) \ 612 (INTEGERP (WVAR (W, right_fringe_width)) \
605 ? XFASTINT ((W)->right_fringe_width) \ 613 ? XFASTINT (WVAR (W, right_fringe_width)) \
606 : FRAME_RIGHT_FRINGE_WIDTH (WINDOW_XFRAME (W))) 614 : FRAME_RIGHT_FRINGE_WIDTH (WINDOW_XFRAME (W)))
607 615
608/* Total width of fringes in pixels. */ 616/* Total width of fringes in pixels. */
@@ -619,36 +627,36 @@ struct window
619 and which side they are on. */ 627 and which side they are on. */
620 628
621#define WINDOW_VERTICAL_SCROLL_BAR_TYPE(w) \ 629#define WINDOW_VERTICAL_SCROLL_BAR_TYPE(w) \
622 (EQ ((w)->vertical_scroll_bar_type, Qt) \ 630 (EQ (WVAR (w, vertical_scroll_bar_type), Qt) \
623 ? FRAME_VERTICAL_SCROLL_BAR_TYPE (WINDOW_XFRAME (w)) \ 631 ? FRAME_VERTICAL_SCROLL_BAR_TYPE (WINDOW_XFRAME (w)) \
624 : EQ ((w)->vertical_scroll_bar_type, Qleft) \ 632 : EQ (WVAR (w, vertical_scroll_bar_type), Qleft) \
625 ? vertical_scroll_bar_left \ 633 ? vertical_scroll_bar_left \
626 : EQ ((w)->vertical_scroll_bar_type, Qright) \ 634 : EQ (WVAR (w, vertical_scroll_bar_type), Qright) \
627 ? vertical_scroll_bar_right \ 635 ? vertical_scroll_bar_right \
628 : vertical_scroll_bar_none) \ 636 : vertical_scroll_bar_none) \
629 637
630#define WINDOW_HAS_VERTICAL_SCROLL_BAR(w) \ 638#define WINDOW_HAS_VERTICAL_SCROLL_BAR(w) \
631 (EQ ((w)->vertical_scroll_bar_type, Qt) \ 639 (EQ (WVAR (w, vertical_scroll_bar_type), Qt) \
632 ? FRAME_HAS_VERTICAL_SCROLL_BARS (WINDOW_XFRAME (w)) \ 640 ? FRAME_HAS_VERTICAL_SCROLL_BARS (WINDOW_XFRAME (w)) \
633 : !NILP ((w)->vertical_scroll_bar_type)) 641 : !NILP (WVAR (w, vertical_scroll_bar_type)))
634 642
635#define WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT(w) \ 643#define WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT(w) \
636 (EQ ((w)->vertical_scroll_bar_type, Qt) \ 644 (EQ (WVAR (w, vertical_scroll_bar_type), Qt) \
637 ? FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (WINDOW_XFRAME (w)) \ 645 ? FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (WINDOW_XFRAME (w)) \
638 : EQ ((w)->vertical_scroll_bar_type, Qleft)) 646 : EQ (WVAR (w, vertical_scroll_bar_type), Qleft))
639 647
640#define WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT(w) \ 648#define WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT(w) \
641 (EQ ((w)->vertical_scroll_bar_type, Qt) \ 649 (EQ (WVAR (w, vertical_scroll_bar_type), Qt) \
642 ? FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (WINDOW_XFRAME (w))\ 650 ? FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (WINDOW_XFRAME (w))\
643 : EQ ((w)->vertical_scroll_bar_type, Qright)) 651 : EQ (WVAR (w, vertical_scroll_bar_type), Qright))
644 652
645/* Width that a scroll bar in window W should have, if there is one. 653/* Width that a scroll bar in window W should have, if there is one.
646 Measured in pixels. If scroll bars are turned off, this is still 654 Measured in pixels. If scroll bars are turned off, this is still
647 nonzero. */ 655 nonzero. */
648 656
649#define WINDOW_CONFIG_SCROLL_BAR_WIDTH(w) \ 657#define WINDOW_CONFIG_SCROLL_BAR_WIDTH(w) \
650 (INTEGERP ((w)->scroll_bar_width) \ 658 (INTEGERP (WVAR (w, scroll_bar_width)) \
651 ? XFASTINT ((w)->scroll_bar_width) \ 659 ? XFASTINT (WVAR (w, scroll_bar_width)) \
652 : FRAME_CONFIG_SCROLL_BAR_WIDTH (WINDOW_XFRAME (w))) 660 : FRAME_CONFIG_SCROLL_BAR_WIDTH (WINDOW_XFRAME (w)))
653 661
654/* Width that a scroll bar in window W should have, if there is one. 662/* Width that a scroll bar in window W should have, if there is one.
@@ -656,8 +664,8 @@ struct window
656 this is still nonzero. */ 664 this is still nonzero. */
657 665
658#define WINDOW_CONFIG_SCROLL_BAR_COLS(w) \ 666#define WINDOW_CONFIG_SCROLL_BAR_COLS(w) \
659 (INTEGERP ((w)->scroll_bar_width) \ 667 (INTEGERP (WVAR (w, scroll_bar_width)) \
660 ? ((XFASTINT ((w)->scroll_bar_width) \ 668 ? ((XFASTINT (WVAR (w, scroll_bar_width)) \
661 + WINDOW_FRAME_COLUMN_WIDTH (w) - 1) \ 669 + WINDOW_FRAME_COLUMN_WIDTH (w) - 1) \
662 / WINDOW_FRAME_COLUMN_WIDTH (w)) \ 670 / WINDOW_FRAME_COLUMN_WIDTH (w)) \
663 : FRAME_CONFIG_SCROLL_BAR_COLS (WINDOW_XFRAME (w))) 671 : FRAME_CONFIG_SCROLL_BAR_COLS (WINDOW_XFRAME (w)))
@@ -880,7 +888,7 @@ struct glyph *get_phys_cursor_glyph (struct window *w);
880/* Value is non-zero if WINDOW is a live window. */ 888/* Value is non-zero if WINDOW is a live window. */
881 889
882#define WINDOW_LIVE_P(WINDOW) \ 890#define WINDOW_LIVE_P(WINDOW) \
883 (WINDOWP ((WINDOW)) && !NILP (XWINDOW ((WINDOW))->buffer)) 891 (WINDOWP ((WINDOW)) && !NILP (WVAR (XWINDOW ((WINDOW)), buffer)))
884 892
885 893
886/* These used to be in lisp.h. */ 894/* These used to be in lisp.h. */
diff --git a/src/xdisp.c b/src/xdisp.c
index 36196e876c9..153e139b043 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -984,7 +984,7 @@ window_text_bottom_y (struct window *w)
984int 984int
985window_box_width (struct window *w, int area) 985window_box_width (struct window *w, int area)
986{ 986{
987 int cols = XFASTINT (w->total_cols); 987 int cols = XFASTINT (WVAR (w, total_cols));
988 int pixels = 0; 988 int pixels = 0;
989 989
990 if (!w->pseudo_window_p) 990 if (!w->pseudo_window_p)
@@ -993,22 +993,22 @@ window_box_width (struct window *w, int area)
993 993
994 if (area == TEXT_AREA) 994 if (area == TEXT_AREA)
995 { 995 {
996 if (INTEGERP (w->left_margin_cols)) 996 if (INTEGERP (WVAR (w, left_margin_cols)))
997 cols -= XFASTINT (w->left_margin_cols); 997 cols -= XFASTINT (WVAR (w, left_margin_cols));
998 if (INTEGERP (w->right_margin_cols)) 998 if (INTEGERP (WVAR (w, right_margin_cols)))
999 cols -= XFASTINT (w->right_margin_cols); 999 cols -= XFASTINT (WVAR (w, right_margin_cols));
1000 pixels = -WINDOW_TOTAL_FRINGE_WIDTH (w); 1000 pixels = -WINDOW_TOTAL_FRINGE_WIDTH (w);
1001 } 1001 }
1002 else if (area == LEFT_MARGIN_AREA) 1002 else if (area == LEFT_MARGIN_AREA)
1003 { 1003 {
1004 cols = (INTEGERP (w->left_margin_cols) 1004 cols = (INTEGERP (WVAR (w, left_margin_cols))
1005 ? XFASTINT (w->left_margin_cols) : 0); 1005 ? XFASTINT (WVAR (w, left_margin_cols)) : 0);
1006 pixels = 0; 1006 pixels = 0;
1007 } 1007 }
1008 else if (area == RIGHT_MARGIN_AREA) 1008 else if (area == RIGHT_MARGIN_AREA)
1009 { 1009 {
1010 cols = (INTEGERP (w->right_margin_cols) 1010 cols = (INTEGERP (WVAR (w, right_margin_cols))
1011 ? XFASTINT (w->right_margin_cols) : 0); 1011 ? XFASTINT (WVAR (w, right_margin_cols)) : 0);
1012 pixels = 0; 1012 pixels = 0;
1013 } 1013 }
1014 } 1014 }
@@ -1023,7 +1023,7 @@ window_box_width (struct window *w, int area)
1023int 1023int
1024window_box_height (struct window *w) 1024window_box_height (struct window *w)
1025{ 1025{
1026 struct frame *f = XFRAME (w->frame); 1026 struct frame *f = XFRAME (WVAR (w, frame));
1027 int height = WINDOW_TOTAL_HEIGHT (w); 1027 int height = WINDOW_TOTAL_HEIGHT (w);
1028 1028
1029 eassert (height >= 0); 1029 eassert (height >= 0);
@@ -1112,7 +1112,7 @@ window_box_right_offset (struct window *w, int area)
1112int 1112int
1113window_box_left (struct window *w, int area) 1113window_box_left (struct window *w, int area)
1114{ 1114{
1115 struct frame *f = XFRAME (w->frame); 1115 struct frame *f = XFRAME (WVAR (w, frame));
1116 int x; 1116 int x;
1117 1117
1118 if (w->pseudo_window_p) 1118 if (w->pseudo_window_p)
@@ -1288,13 +1288,13 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
1288 if (FRAME_INITIAL_P (XFRAME (WINDOW_FRAME (w)))) 1288 if (FRAME_INITIAL_P (XFRAME (WINDOW_FRAME (w))))
1289 return visible_p; 1289 return visible_p;
1290 1290
1291 if (XBUFFER (w->buffer) != current_buffer) 1291 if (XBUFFER (WVAR (w, buffer)) != current_buffer)
1292 { 1292 {
1293 old_buffer = current_buffer; 1293 old_buffer = current_buffer;
1294 set_buffer_internal_1 (XBUFFER (w->buffer)); 1294 set_buffer_internal_1 (XBUFFER (WVAR (w, buffer)));
1295 } 1295 }
1296 1296
1297 SET_TEXT_POS_FROM_MARKER (top, w->start); 1297 SET_TEXT_POS_FROM_MARKER (top, WVAR (w, start));
1298 /* Scrolling a minibuffer window via scroll bar when the echo area 1298 /* Scrolling a minibuffer window via scroll bar when the echo area
1299 shows long text sometimes resets the minibuffer contents behind 1299 shows long text sometimes resets the minibuffer contents behind
1300 our backs. */ 1300 our backs. */
@@ -1310,7 +1310,7 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
1310 if (WINDOW_WANTS_HEADER_LINE_P (w)) 1310 if (WINDOW_WANTS_HEADER_LINE_P (w))
1311 current_header_line_height 1311 current_header_line_height
1312 = display_mode_line (w, HEADER_LINE_FACE_ID, 1312 = display_mode_line (w, HEADER_LINE_FACE_ID,
1313 BVAR (current_buffer, header_line_format)); 1313 BVAR (current_buffer, header_line_format));
1314 1314
1315 start_display (&it, w, top); 1315 start_display (&it, w, top);
1316 move_it_to (&it, charpos, -1, it.last_visible_y-1, -1, 1316 move_it_to (&it, charpos, -1, it.last_visible_y-1, -1,
@@ -1913,7 +1913,7 @@ frame_to_window_pixel_xy (struct window *w, int *x, int *y)
1913 { 1913 {
1914 /* A pseudo-window is always full-width, and starts at the 1914 /* A pseudo-window is always full-width, and starts at the
1915 left edge of the frame, plus a frame border. */ 1915 left edge of the frame, plus a frame border. */
1916 struct frame *f = XFRAME (w->frame); 1916 struct frame *f = XFRAME (WVAR (w, frame));
1917 *x -= FRAME_INTERNAL_BORDER_WIDTH (f); 1917 *x -= FRAME_INTERNAL_BORDER_WIDTH (f);
1918 *y = FRAME_TO_WINDOW_PIXEL_Y (w, *y); 1918 *y = FRAME_TO_WINDOW_PIXEL_Y (w, *y);
1919 } 1919 }
@@ -2522,11 +2522,11 @@ static void
2522check_window_end (struct window *w) 2522check_window_end (struct window *w)
2523{ 2523{
2524 if (!MINI_WINDOW_P (w) 2524 if (!MINI_WINDOW_P (w)
2525 && !NILP (w->window_end_valid)) 2525 && !NILP (WVAR (w, window_end_valid)))
2526 { 2526 {
2527 struct glyph_row *row; 2527 struct glyph_row *row;
2528 eassert ((row = MATRIX_ROW (w->current_matrix, 2528 eassert ((row = MATRIX_ROW (w->current_matrix,
2529 XFASTINT (w->window_end_vpos)), 2529 XFASTINT (WVAR (w, window_end_vpos))),
2530 !row->enabled_p 2530 !row->enabled_p
2531 || MATRIX_ROW_DISPLAYS_TEXT_P (row) 2531 || MATRIX_ROW_DISPLAYS_TEXT_P (row)
2532 || MATRIX_ROW_VPOS (row, w->current_matrix) == 0)); 2532 || MATRIX_ROW_VPOS (row, w->current_matrix) == 0));
@@ -2591,7 +2591,8 @@ init_iterator (struct it *it, struct window *w,
2591 2591
2592 /* Perhaps remap BASE_FACE_ID to a user-specified alternative. */ 2592 /* Perhaps remap BASE_FACE_ID to a user-specified alternative. */
2593 if (! NILP (Vface_remapping_alist)) 2593 if (! NILP (Vface_remapping_alist))
2594 remapped_base_face_id = lookup_basic_face (XFRAME (w->frame), base_face_id); 2594 remapped_base_face_id
2595 = lookup_basic_face (XFRAME (WVAR (w, frame)), base_face_id);
2595 2596
2596 /* Use one of the mode line rows of W's desired matrix if 2597 /* Use one of the mode line rows of W's desired matrix if
2597 appropriate. */ 2598 appropriate. */
@@ -2619,7 +2620,7 @@ init_iterator (struct it *it, struct window *w,
2619 /* The window in which we iterate over current_buffer: */ 2620 /* The window in which we iterate over current_buffer: */
2620 XSETWINDOW (it->window, w); 2621 XSETWINDOW (it->window, w);
2621 it->w = w; 2622 it->w = w;
2622 it->f = XFRAME (w->frame); 2623 it->f = XFRAME (WVAR (w, frame));
2623 2624
2624 it->cmp_it.id = -1; 2625 it->cmp_it.id = -1;
2625 2626
@@ -2659,9 +2660,9 @@ init_iterator (struct it *it, struct window *w,
2659 is invisible. >0 means lines indented more than this value are 2660 is invisible. >0 means lines indented more than this value are
2660 invisible. */ 2661 invisible. */
2661 it->selective = (INTEGERP (BVAR (current_buffer, selective_display)) 2662 it->selective = (INTEGERP (BVAR (current_buffer, selective_display))
2662 ? clip_to_bounds (-1, XINT (BVAR (current_buffer, 2663 ? clip_to_bounds
2663 selective_display)), 2664 (-1, XINT (BVAR (current_buffer, selective_display)),
2664 PTRDIFF_MAX) 2665 PTRDIFF_MAX)
2665 : (!NILP (BVAR (current_buffer, selective_display)) 2666 : (!NILP (BVAR (current_buffer, selective_display))
2666 ? -1 : 0)); 2667 ? -1 : 0));
2667 it->selective_display_ellipsis_p 2668 it->selective_display_ellipsis_p
@@ -2703,13 +2704,13 @@ init_iterator (struct it *it, struct window *w,
2703 2704
2704 /* Get the position at which the redisplay_end_trigger hook should 2705 /* Get the position at which the redisplay_end_trigger hook should
2705 be run, if it is to be run at all. */ 2706 be run, if it is to be run at all. */
2706 if (MARKERP (w->redisplay_end_trigger) 2707 if (MARKERP (WVAR (w, redisplay_end_trigger))
2707 && XMARKER (w->redisplay_end_trigger)->buffer != 0) 2708 && XMARKER (WVAR (w, redisplay_end_trigger))->buffer != 0)
2708 it->redisplay_end_trigger_charpos 2709 it->redisplay_end_trigger_charpos
2709 = marker_position (w->redisplay_end_trigger); 2710 = marker_position (WVAR (w, redisplay_end_trigger));
2710 else if (INTEGERP (w->redisplay_end_trigger)) 2711 else if (INTEGERP (WVAR (w, redisplay_end_trigger)))
2711 it->redisplay_end_trigger_charpos = 2712 it->redisplay_end_trigger_charpos =
2712 clip_to_bounds (PTRDIFF_MIN, XINT (w->redisplay_end_trigger), PTRDIFF_MAX); 2713 clip_to_bounds (PTRDIFF_MIN, XINT (WVAR (w, redisplay_end_trigger)), PTRDIFF_MAX);
2713 2714
2714 it->tab_width = SANE_TAB_WIDTH (current_buffer); 2715 it->tab_width = SANE_TAB_WIDTH (current_buffer);
2715 2716
@@ -4407,7 +4408,7 @@ handle_display_prop (struct it *it)
4407 if it was a text property. */ 4408 if it was a text property. */
4408 4409
4409 if (!STRINGP (it->string)) 4410 if (!STRINGP (it->string))
4410 object = it->w->buffer; 4411 object = WVAR (it->w, buffer);
4411 4412
4412 display_replaced_p = handle_display_spec (it, propval, object, overlay, 4413 display_replaced_p = handle_display_spec (it, propval, object, overlay,
4413 position, bufpos, 4414 position, bufpos,
@@ -4815,7 +4816,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
4815 it->what = IT_IMAGE; 4816 it->what = IT_IMAGE;
4816 it->image_id = -1; /* no image */ 4817 it->image_id = -1; /* no image */
4817 it->position = start_pos; 4818 it->position = start_pos;
4818 it->object = NILP (object) ? it->w->buffer : object; 4819 it->object = NILP (object) ? WVAR (it->w, buffer) : object;
4819 it->method = GET_FROM_IMAGE; 4820 it->method = GET_FROM_IMAGE;
4820 it->from_overlay = Qnil; 4821 it->from_overlay = Qnil;
4821 it->face_id = face_id; 4822 it->face_id = face_id;
@@ -4961,7 +4962,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
4961 it->what = IT_IMAGE; 4962 it->what = IT_IMAGE;
4962 it->image_id = lookup_image (it->f, value); 4963 it->image_id = lookup_image (it->f, value);
4963 it->position = start_pos; 4964 it->position = start_pos;
4964 it->object = NILP (object) ? it->w->buffer : object; 4965 it->object = NILP (object) ? WVAR (it->w, buffer) : object;
4965 it->method = GET_FROM_IMAGE; 4966 it->method = GET_FROM_IMAGE;
4966 4967
4967 /* Say that we haven't consumed the characters with 4968 /* Say that we haven't consumed the characters with
@@ -5784,7 +5785,7 @@ pop_it (struct it *it)
5784 it->object = p->u.stretch.object; 5785 it->object = p->u.stretch.object;
5785 break; 5786 break;
5786 case GET_FROM_BUFFER: 5787 case GET_FROM_BUFFER:
5787 it->object = it->w->buffer; 5788 it->object = WVAR (it->w, buffer);
5788 break; 5789 break;
5789 case GET_FROM_STRING: 5790 case GET_FROM_STRING:
5790 it->object = it->string; 5791 it->object = it->string;
@@ -5797,7 +5798,7 @@ pop_it (struct it *it)
5797 else 5798 else
5798 { 5799 {
5799 it->method = GET_FROM_BUFFER; 5800 it->method = GET_FROM_BUFFER;
5800 it->object = it->w->buffer; 5801 it->object = WVAR (it->w, buffer);
5801 } 5802 }
5802 } 5803 }
5803 it->end_charpos = p->end_charpos; 5804 it->end_charpos = p->end_charpos;
@@ -6235,7 +6236,7 @@ reseat_1 (struct it *it, struct text_pos pos, int set_stop_p)
6235 IT_STRING_BYTEPOS (*it) = -1; 6236 IT_STRING_BYTEPOS (*it) = -1;
6236 it->string = Qnil; 6237 it->string = Qnil;
6237 it->method = GET_FROM_BUFFER; 6238 it->method = GET_FROM_BUFFER;
6238 it->object = it->w->buffer; 6239 it->object = WVAR (it->w, buffer);
6239 it->area = TEXT_AREA; 6240 it->area = TEXT_AREA;
6240 it->multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters)); 6241 it->multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters));
6241 it->sp = 0; 6242 it->sp = 0;
@@ -7084,7 +7085,7 @@ set_iterator_to_next (struct it *it, int reseat_p)
7084 else 7085 else
7085 { 7086 {
7086 it->method = GET_FROM_BUFFER; 7087 it->method = GET_FROM_BUFFER;
7087 it->object = it->w->buffer; 7088 it->object = WVAR (it->w, buffer);
7088 } 7089 }
7089 7090
7090 it->dpvec = NULL; 7091 it->dpvec = NULL;
@@ -7659,7 +7660,7 @@ next_element_from_ellipsis (struct it *it)
7659 setting face_before_selective_p. */ 7660 setting face_before_selective_p. */
7660 it->saved_face_id = it->face_id; 7661 it->saved_face_id = it->face_id;
7661 it->method = GET_FROM_BUFFER; 7662 it->method = GET_FROM_BUFFER;
7662 it->object = it->w->buffer; 7663 it->object = WVAR (it->w, buffer);
7663 reseat_at_next_visible_line_start (it, 1); 7664 reseat_at_next_visible_line_start (it, 1);
7664 it->face_before_selective_p = 1; 7665 it->face_before_selective_p = 1;
7665 } 7666 }
@@ -7923,7 +7924,7 @@ next_element_from_buffer (struct it *it)
7923 7924
7924 /* Record what we have and where it came from. */ 7925 /* Record what we have and where it came from. */
7925 it->what = IT_CHARACTER; 7926 it->what = IT_CHARACTER;
7926 it->object = it->w->buffer; 7927 it->object = WVAR (it->w, buffer);
7927 it->position = it->current.pos; 7928 it->position = it->current.pos;
7928 7929
7929 /* Normally we return the character found above, except when we 7930 /* Normally we return the character found above, except when we
@@ -7980,7 +7981,7 @@ run_redisplay_end_trigger_hook (struct it *it)
7980 7981
7981 /* Since we are *trying* to run these functions, don't try to run 7982 /* Since we are *trying* to run these functions, don't try to run
7982 them again, even if they get an error. */ 7983 them again, even if they get an error. */
7983 it->w->redisplay_end_trigger = Qnil; 7984 WVAR (it->w, redisplay_end_trigger) = Qnil;
7984 Frun_hook_with_args (3, args); 7985 Frun_hook_with_args (3, args);
7985 7986
7986 /* Notice if it changed the face of the character we are on. */ 7987 /* Notice if it changed the face of the character we are on. */
@@ -8029,7 +8030,7 @@ next_element_from_composition (struct it *it)
8029 return 0; 8030 return 0;
8030 } 8031 }
8031 it->position = it->current.pos; 8032 it->position = it->current.pos;
8032 it->object = it->w->buffer; 8033 it->object = WVAR (it->w, buffer);
8033 it->c = composition_update_it (&it->cmp_it, IT_CHARPOS (*it), 8034 it->c = composition_update_it (&it->cmp_it, IT_CHARPOS (*it),
8034 IT_BYTEPOS (*it), Qnil); 8035 IT_BYTEPOS (*it), Qnil);
8035 } 8036 }
@@ -8890,7 +8891,7 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int to_x, int to_y, int to_vpos
8890 && it->current_x == it->last_visible_x - 1 8891 && it->current_x == it->last_visible_x - 1
8891 && it->c != '\n' 8892 && it->c != '\n'
8892 && it->c != '\t' 8893 && it->c != '\t'
8893 && it->vpos < XFASTINT (it->w->window_end_vpos)) 8894 && it->vpos < XFASTINT (WVAR (it->w, window_end_vpos)))
8894 { 8895 {
8895 it->continuation_lines_width += it->current_x; 8896 it->continuation_lines_width += it->current_x;
8896 it->current_x = it->hpos = it->max_ascent = it->max_descent = 0; 8897 it->current_x = it->hpos = it->max_ascent = it->max_descent = 0;
@@ -9644,7 +9645,7 @@ message3_nolog (Lisp_Object m, ptrdiff_t nbytes, int multibyte)
9644 /* Get the frame containing the mini-buffer 9645 /* Get the frame containing the mini-buffer
9645 that the selected frame is using. */ 9646 that the selected frame is using. */
9646 mini_window = FRAME_MINIBUF_WINDOW (sf); 9647 mini_window = FRAME_MINIBUF_WINDOW (sf);
9647 frame = XWINDOW (mini_window)->frame; 9648 frame = WVAR (XWINDOW (mini_window), frame);
9648 f = XFRAME (frame); 9649 f = XFRAME (frame);
9649 9650
9650 FRAME_SAMPLE_VISIBILITY (f); 9651 FRAME_SAMPLE_VISIBILITY (f);
@@ -9970,8 +9971,8 @@ with_echo_area_buffer (struct window *w, int which,
9970 set_buffer_internal_1 (XBUFFER (buffer)); 9971 set_buffer_internal_1 (XBUFFER (buffer));
9971 if (w) 9972 if (w)
9972 { 9973 {
9973 w->buffer = buffer; 9974 WVAR (w, buffer) = buffer;
9974 set_marker_both (w->pointm, buffer, BEG, BEG_BYTE); 9975 set_marker_both (WVAR (w, pointm), buffer, BEG, BEG_BYTE);
9975 } 9976 }
9976 9977
9977 BVAR (current_buffer, undo_list) = Qt; 9978 BVAR (current_buffer, undo_list) = Qt;
@@ -10019,9 +10020,9 @@ with_echo_area_buffer_unwind_data (struct window *w)
10019 if (w) 10020 if (w)
10020 { 10021 {
10021 XSETWINDOW (tmp, w); ASET (vector, i, tmp); ++i; 10022 XSETWINDOW (tmp, w); ASET (vector, i, tmp); ++i;
10022 ASET (vector, i, w->buffer); ++i; 10023 ASET (vector, i, WVAR (w, buffer)); ++i;
10023 ASET (vector, i, make_number (XMARKER (w->pointm)->charpos)); ++i; 10024 ASET (vector, i, make_number (XMARKER (WVAR (w, pointm))->charpos)); ++i;
10024 ASET (vector, i, make_number (XMARKER (w->pointm)->bytepos)); ++i; 10025 ASET (vector, i, make_number (XMARKER (WVAR (w, pointm))->bytepos)); ++i;
10025 } 10026 }
10026 else 10027 else
10027 { 10028 {
@@ -10055,8 +10056,8 @@ unwind_with_echo_area_buffer (Lisp_Object vector)
10055 charpos = AREF (vector, 5); 10056 charpos = AREF (vector, 5);
10056 bytepos = AREF (vector, 6); 10057 bytepos = AREF (vector, 6);
10057 10058
10058 w->buffer = buffer; 10059 WVAR (w, buffer) = buffer;
10059 set_marker_both (w->pointm, buffer, 10060 set_marker_both (WVAR (w, pointm), buffer,
10060 XFASTINT (charpos), XFASTINT (bytepos)); 10061 XFASTINT (charpos), XFASTINT (bytepos));
10061 } 10062 }
10062 10063
@@ -10195,7 +10196,7 @@ display_echo_area_1 (ptrdiff_t a1, Lisp_Object a2, ptrdiff_t a3, ptrdiff_t a4)
10195 window_height_changed_p = resize_mini_window (w, 0); 10196 window_height_changed_p = resize_mini_window (w, 0);
10196 10197
10197 /* Use the starting position chosen by resize_mini_window. */ 10198 /* Use the starting position chosen by resize_mini_window. */
10198 SET_TEXT_POS_FROM_MARKER (start, w->start); 10199 SET_TEXT_POS_FROM_MARKER (start, WVAR (w, start));
10199 10200
10200 /* Display. */ 10201 /* Display. */
10201 clear_glyph_matrix (w->desired_matrix); 10202 clear_glyph_matrix (w->desired_matrix);
@@ -10266,15 +10267,15 @@ resize_mini_window_1 (ptrdiff_t a1, Lisp_Object exactly, ptrdiff_t a3, ptrdiff_t
10266int 10267int
10267resize_mini_window (struct window *w, int exact_p) 10268resize_mini_window (struct window *w, int exact_p)
10268{ 10269{
10269 struct frame *f = XFRAME (w->frame); 10270 struct frame *f = XFRAME (WVAR (w, frame));
10270 int window_height_changed_p = 0; 10271 int window_height_changed_p = 0;
10271 10272
10272 eassert (MINI_WINDOW_P (w)); 10273 eassert (MINI_WINDOW_P (w));
10273 10274
10274 /* By default, start display at the beginning. */ 10275 /* By default, start display at the beginning. */
10275 set_marker_both (w->start, w->buffer, 10276 set_marker_both (WVAR (w, start), WVAR (w, buffer),
10276 BUF_BEGV (XBUFFER (w->buffer)), 10277 BUF_BEGV (XBUFFER (WVAR (w, buffer))),
10277 BUF_BEGV_BYTE (XBUFFER (w->buffer))); 10278 BUF_BEGV_BYTE (XBUFFER (WVAR (w, buffer))));
10278 10279
10279 /* Don't resize windows while redisplaying a window; it would 10280 /* Don't resize windows while redisplaying a window; it would
10280 confuse redisplay functions when the size of the window they are 10281 confuse redisplay functions when the size of the window they are
@@ -10301,10 +10302,10 @@ resize_mini_window (struct window *w, int exact_p)
10301 struct text_pos start; 10302 struct text_pos start;
10302 struct buffer *old_current_buffer = NULL; 10303 struct buffer *old_current_buffer = NULL;
10303 10304
10304 if (current_buffer != XBUFFER (w->buffer)) 10305 if (current_buffer != XBUFFER (WVAR (w, buffer)))
10305 { 10306 {
10306 old_current_buffer = current_buffer; 10307 old_current_buffer = current_buffer;
10307 set_buffer_internal (XBUFFER (w->buffer)); 10308 set_buffer_internal (XBUFFER (WVAR (w, buffer)));
10308 } 10309 }
10309 10310
10310 init_iterator (&it, w, BEGV, BEGV_BYTE, NULL, DEFAULT_FACE_ID); 10311 init_iterator (&it, w, BEGV, BEGV_BYTE, NULL, DEFAULT_FACE_ID);
@@ -10346,7 +10347,7 @@ resize_mini_window (struct window *w, int exact_p)
10346 } 10347 }
10347 else 10348 else
10348 SET_TEXT_POS (start, BEGV, BEGV_BYTE); 10349 SET_TEXT_POS (start, BEGV, BEGV_BYTE);
10349 SET_MARKER_FROM_TEXT_POS (w->start, start); 10350 SET_MARKER_FROM_TEXT_POS (WVAR (w, start), start);
10350 10351
10351 if (EQ (Vresize_mini_windows, Qgrow_only)) 10352 if (EQ (Vresize_mini_windows, Qgrow_only))
10352 { 10353 {
@@ -11053,7 +11054,8 @@ x_consider_frame_title (Lisp_Object frame)
11053 (f, current_buffer, selected_window, 0)); 11054 (f, current_buffer, selected_window, 0));
11054 11055
11055 Fselect_window (FVAR (f, selected_window), Qt); 11056 Fselect_window (FVAR (f, selected_window), Qt);
11056 set_buffer_internal_1 (XBUFFER (XWINDOW (FVAR (f, selected_window))->buffer)); 11057 set_buffer_internal_1
11058 (XBUFFER (WVAR (XWINDOW (FVAR (f, selected_window)), buffer)));
11057 fmt = FRAME_ICONIFIED_P (f) ? Vicon_title_format : Vframe_title_format; 11059 fmt = FRAME_ICONIFIED_P (f) ? Vicon_title_format : Vframe_title_format;
11058 11060
11059 mode_line_target = MODE_LINE_TITLE; 11061 mode_line_target = MODE_LINE_TITLE;
@@ -11171,8 +11173,9 @@ prepare_menu_bars (void)
11171#ifdef HAVE_NS 11173#ifdef HAVE_NS
11172 if (windows_or_buffers_changed 11174 if (windows_or_buffers_changed
11173 && FRAME_NS_P (f)) 11175 && FRAME_NS_P (f))
11174 ns_set_doc_edited (f, Fbuffer_modified_p 11176 ns_set_doc_edited
11175 (XWINDOW (FVAR (f, selected_window))->buffer)); 11177 (f, Fbuffer_modified_p
11178 (WVAR (XWINDOW (FVAR (f, selected_window)), buffer)));
11176#endif 11179#endif
11177 UNGCPRO; 11180 UNGCPRO;
11178 } 11181 }
@@ -11237,19 +11240,19 @@ update_menu_bar (struct frame *f, int save_match_data, int hooks_run)
11237 /* This used to test w->update_mode_line, but we believe 11240 /* This used to test w->update_mode_line, but we believe
11238 there is no need to recompute the menu in that case. */ 11241 there is no need to recompute the menu in that case. */
11239 || update_mode_lines 11242 || update_mode_lines
11240 || ((BUF_SAVE_MODIFF (XBUFFER (w->buffer)) 11243 || ((BUF_SAVE_MODIFF (XBUFFER (WVAR (w, buffer)))
11241 < BUF_MODIFF (XBUFFER (w->buffer))) 11244 < BUF_MODIFF (XBUFFER (WVAR (w, buffer))))
11242 != w->last_had_star) 11245 != w->last_had_star)
11243 || ((!NILP (Vtransient_mark_mode) 11246 || ((!NILP (Vtransient_mark_mode)
11244 && !NILP (BVAR (XBUFFER (w->buffer), mark_active))) 11247 && !NILP (BVAR (XBUFFER (WVAR (w, buffer)), mark_active)))
11245 != !NILP (w->region_showing))) 11248 != !NILP (WVAR (w, region_showing))))
11246 { 11249 {
11247 struct buffer *prev = current_buffer; 11250 struct buffer *prev = current_buffer;
11248 ptrdiff_t count = SPECPDL_INDEX (); 11251 ptrdiff_t count = SPECPDL_INDEX ();
11249 11252
11250 specbind (Qinhibit_menubar_update, Qt); 11253 specbind (Qinhibit_menubar_update, Qt);
11251 11254
11252 set_buffer_internal_1 (XBUFFER (w->buffer)); 11255 set_buffer_internal_1 (XBUFFER (WVAR (w, buffer)));
11253 if (save_match_data) 11256 if (save_match_data)
11254 record_unwind_save_match_data (); 11257 record_unwind_save_match_data ();
11255 if (NILP (Voverriding_local_map_menu_flag)) 11258 if (NILP (Voverriding_local_map_menu_flag))
@@ -11435,12 +11438,12 @@ update_tool_bar (struct frame *f, int save_match_data)
11435 if (windows_or_buffers_changed 11438 if (windows_or_buffers_changed
11436 || w->update_mode_line 11439 || w->update_mode_line
11437 || update_mode_lines 11440 || update_mode_lines
11438 || ((BUF_SAVE_MODIFF (XBUFFER (w->buffer)) 11441 || ((BUF_SAVE_MODIFF (XBUFFER (WVAR (w, buffer)))
11439 < BUF_MODIFF (XBUFFER (w->buffer))) 11442 < BUF_MODIFF (XBUFFER (WVAR (w, buffer))))
11440 != w->last_had_star) 11443 != w->last_had_star)
11441 || ((!NILP (Vtransient_mark_mode) 11444 || ((!NILP (Vtransient_mark_mode)
11442 && !NILP (BVAR (XBUFFER (w->buffer), mark_active))) 11445 && !NILP (BVAR (XBUFFER (WVAR (w, buffer)), mark_active)))
11443 != !NILP (w->region_showing))) 11446 != !NILP (WVAR (w, region_showing))))
11444 { 11447 {
11445 struct buffer *prev = current_buffer; 11448 struct buffer *prev = current_buffer;
11446 ptrdiff_t count = SPECPDL_INDEX (); 11449 ptrdiff_t count = SPECPDL_INDEX ();
@@ -11451,7 +11454,7 @@ update_tool_bar (struct frame *f, int save_match_data)
11451 /* Set current_buffer to the buffer of the selected 11454 /* Set current_buffer to the buffer of the selected
11452 window of the frame, so that we get the right local 11455 window of the frame, so that we get the right local
11453 keymaps. */ 11456 keymaps. */
11454 set_buffer_internal_1 (XBUFFER (w->buffer)); 11457 set_buffer_internal_1 (XBUFFER (WVAR (w, buffer)));
11455 11458
11456 /* Save match data, if we must. */ 11459 /* Save match data, if we must. */
11457 if (save_match_data) 11460 if (save_match_data)
@@ -12321,10 +12324,10 @@ hscroll_window_tree (Lisp_Object window)
12321 { 12324 {
12322 struct window *w = XWINDOW (window); 12325 struct window *w = XWINDOW (window);
12323 12326
12324 if (WINDOWP (w->hchild)) 12327 if (WINDOWP (WVAR (w, hchild)))
12325 hscrolled_p |= hscroll_window_tree (w->hchild); 12328 hscrolled_p |= hscroll_window_tree (WVAR (w, hchild));
12326 else if (WINDOWP (w->vchild)) 12329 else if (WINDOWP (WVAR (w, vchild)))
12327 hscrolled_p |= hscroll_window_tree (w->vchild); 12330 hscrolled_p |= hscroll_window_tree (WVAR (w, vchild));
12328 else if (w->cursor.vpos >= 0) 12331 else if (w->cursor.vpos >= 0)
12329 { 12332 {
12330 int h_margin; 12333 int h_margin;
@@ -12344,7 +12347,7 @@ hscroll_window_tree (Lisp_Object window)
12344 /* Scroll when cursor is inside this scroll margin. */ 12347 /* Scroll when cursor is inside this scroll margin. */
12345 h_margin = hscroll_margin * WINDOW_FRAME_COLUMN_WIDTH (w); 12348 h_margin = hscroll_margin * WINDOW_FRAME_COLUMN_WIDTH (w);
12346 12349
12347 if (!NILP (Fbuffer_local_value (Qauto_hscroll_mode, w->buffer)) 12350 if (!NILP (Fbuffer_local_value (Qauto_hscroll_mode, WVAR (w, buffer)))
12348 /* For left-to-right rows, hscroll when cursor is either 12351 /* For left-to-right rows, hscroll when cursor is either
12349 (i) inside the right hscroll margin, or (ii) if it is 12352 (i) inside the right hscroll margin, or (ii) if it is
12350 inside the left margin and the window is already 12353 inside the left margin and the window is already
@@ -12379,13 +12382,13 @@ hscroll_window_tree (Lisp_Object window)
12379 12382
12380 /* Find point in a display of infinite width. */ 12383 /* Find point in a display of infinite width. */
12381 saved_current_buffer = current_buffer; 12384 saved_current_buffer = current_buffer;
12382 current_buffer = XBUFFER (w->buffer); 12385 current_buffer = XBUFFER (WVAR (w, buffer));
12383 12386
12384 if (w == XWINDOW (selected_window)) 12387 if (w == XWINDOW (selected_window))
12385 pt = PT; 12388 pt = PT;
12386 else 12389 else
12387 { 12390 {
12388 pt = marker_position (w->pointm); 12391 pt = marker_position (WVAR (w, pointm));
12389 pt = max (BEGV, pt); 12392 pt = max (BEGV, pt);
12390 pt = min (ZV, pt); 12393 pt = min (ZV, pt);
12391 } 12394 }
@@ -12436,14 +12439,14 @@ hscroll_window_tree (Lisp_Object window)
12436 redisplay. */ 12439 redisplay. */
12437 if (w->hscroll != hscroll) 12440 if (w->hscroll != hscroll)
12438 { 12441 {
12439 XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; 12442 XBUFFER (WVAR (w, buffer))->prevent_redisplay_optimizations_p = 1;
12440 w->hscroll = hscroll; 12443 w->hscroll = hscroll;
12441 hscrolled_p = 1; 12444 hscrolled_p = 1;
12442 } 12445 }
12443 } 12446 }
12444 } 12447 }
12445 12448
12446 window = w->next; 12449 window = WVAR (w, next);
12447 } 12450 }
12448 12451
12449 /* Value is non-zero if hscroll of any leaf window has been changed. */ 12452 /* Value is non-zero if hscroll of any leaf window has been changed. */
@@ -12525,9 +12528,9 @@ debug_method_add (struct window *w, char const *fmt, ...)
12525 if (trace_redisplay_p) 12528 if (trace_redisplay_p)
12526 fprintf (stderr, "%p (%s): %s\n", 12529 fprintf (stderr, "%p (%s): %s\n",
12527 w, 12530 w,
12528 ((BUFFERP (w->buffer) 12531 ((BUFFERP (WVAR (w, buffer))
12529 && STRINGP (BVAR (XBUFFER (w->buffer), name))) 12532 && STRINGP (BVAR (XBUFFER (WVAR (w, buffer)), name)))
12530 ? SSDATA (BVAR (XBUFFER (w->buffer), name)) 12533 ? SSDATA (BVAR (XBUFFER (WVAR (w, buffer)), name))
12531 : "no buffer"), 12534 : "no buffer"),
12532 method + len); 12535 method + len);
12533} 12536}
@@ -12592,8 +12595,8 @@ text_outside_line_unchanged_p (struct window *w,
12592 require to redisplay the whole paragraph. It might be worthwhile 12595 require to redisplay the whole paragraph. It might be worthwhile
12593 to find the paragraph limits and widen the range of redisplayed 12596 to find the paragraph limits and widen the range of redisplayed
12594 lines to that, but for now just give up this optimization. */ 12597 lines to that, but for now just give up this optimization. */
12595 if (!NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering)) 12598 if (!NILP (BVAR (XBUFFER (WVAR (w, buffer)), bidi_display_reordering))
12596 && NILP (BVAR (XBUFFER (w->buffer), bidi_paragraph_direction))) 12599 && NILP (BVAR (XBUFFER (WVAR (w, buffer)), bidi_paragraph_direction)))
12597 unchanged_p = 0; 12600 unchanged_p = 0;
12598 } 12601 }
12599 12602
@@ -12805,7 +12808,7 @@ static inline void
12805reconsider_clip_changes (struct window *w, struct buffer *b) 12808reconsider_clip_changes (struct window *w, struct buffer *b)
12806{ 12809{
12807 if (b->clip_changed 12810 if (b->clip_changed
12808 && !NILP (w->window_end_valid) 12811 && !NILP (WVAR (w, window_end_valid))
12809 && w->current_matrix->buffer == b 12812 && w->current_matrix->buffer == b
12810 && w->current_matrix->zv == BUF_ZV (b) 12813 && w->current_matrix->zv == BUF_ZV (b)
12811 && w->current_matrix->begv == BUF_BEGV (b)) 12814 && w->current_matrix->begv == BUF_BEGV (b))
@@ -12817,20 +12820,20 @@ reconsider_clip_changes (struct window *w, struct buffer *b)
12817 b->clip_changed has already been set to 1, we can skip this 12820 b->clip_changed has already been set to 1, we can skip this
12818 check. */ 12821 check. */
12819 if (!b->clip_changed 12822 if (!b->clip_changed
12820 && BUFFERP (w->buffer) && !NILP (w->window_end_valid)) 12823 && BUFFERP (WVAR (w, buffer)) && !NILP (WVAR (w, window_end_valid)))
12821 { 12824 {
12822 ptrdiff_t pt; 12825 ptrdiff_t pt;
12823 12826
12824 if (w == XWINDOW (selected_window)) 12827 if (w == XWINDOW (selected_window))
12825 pt = PT; 12828 pt = PT;
12826 else 12829 else
12827 pt = marker_position (w->pointm); 12830 pt = marker_position (WVAR (w, pointm));
12828 12831
12829 if ((w->current_matrix->buffer != XBUFFER (w->buffer) 12832 if ((w->current_matrix->buffer != XBUFFER (WVAR (w, buffer))
12830 || pt != w->last_point) 12833 || pt != w->last_point)
12831 && check_point_in_composition (w->current_matrix->buffer, 12834 && check_point_in_composition (w->current_matrix->buffer,
12832 w->last_point, 12835 w->last_point,
12833 XBUFFER (w->buffer), pt)) 12836 XBUFFER (WVAR (w, buffer)), pt))
12834 b->clip_changed = 1; 12837 b->clip_changed = 1;
12835 } 12838 }
12836} 12839}
@@ -12913,7 +12916,7 @@ redisplay_internal (void)
12913 /* Don't examine these until after testing Vinhibit_redisplay. 12916 /* Don't examine these until after testing Vinhibit_redisplay.
12914 When Emacs is shutting down, perhaps because its connection to 12917 When Emacs is shutting down, perhaps because its connection to
12915 X has dropped, we should not look at them at all. */ 12918 X has dropped, we should not look at them at all. */
12916 fr = XFRAME (w->frame); 12919 fr = XFRAME (WVAR (w, frame));
12917 sf = SELECTED_FRAME (); 12920 sf = SELECTED_FRAME ();
12918 12921
12919 if (!fr->glyphs_initialized_p) 12922 if (!fr->glyphs_initialized_p)
@@ -13049,18 +13052,18 @@ redisplay_internal (void)
13049 specbind (Qinhibit_point_motion_hooks, Qt); 13052 specbind (Qinhibit_point_motion_hooks, Qt);
13050 13053
13051 /* If %c is in the mode line, update it if needed. */ 13054 /* If %c is in the mode line, update it if needed. */
13052 if (!NILP (w->column_number_displayed) 13055 if (!NILP (WVAR (w, column_number_displayed))
13053 /* This alternative quickly identifies a common case 13056 /* This alternative quickly identifies a common case
13054 where no change is needed. */ 13057 where no change is needed. */
13055 && !(PT == w->last_point 13058 && !(PT == w->last_point
13056 && w->last_modified >= MODIFF 13059 && w->last_modified >= MODIFF
13057 && w->last_overlay_modified >= OVERLAY_MODIFF) 13060 && w->last_overlay_modified >= OVERLAY_MODIFF)
13058 && (XFASTINT (w->column_number_displayed) != current_column ())) 13061 && (XFASTINT (WVAR (w, column_number_displayed)) != current_column ()))
13059 w->update_mode_line = 1; 13062 w->update_mode_line = 1;
13060 13063
13061 unbind_to (count1, Qnil); 13064 unbind_to (count1, Qnil);
13062 13065
13063 FRAME_SCROLL_BOTTOM_VPOS (XFRAME (w->frame)) = -1; 13066 FRAME_SCROLL_BOTTOM_VPOS (XFRAME (WVAR (w, frame))) = -1;
13064 13067
13065 /* The variable buffer_shared is set in redisplay_window and 13068 /* The variable buffer_shared is set in redisplay_window and
13066 indicates that we redisplay a buffer in different windows. See 13069 indicates that we redisplay a buffer in different windows. See
@@ -13144,11 +13147,11 @@ redisplay_internal (void)
13144 the whole window. The assignment to this_line_start_pos prevents 13147 the whole window. The assignment to this_line_start_pos prevents
13145 the optimization directly below this if-statement. */ 13148 the optimization directly below this if-statement. */
13146 if (((!NILP (Vtransient_mark_mode) 13149 if (((!NILP (Vtransient_mark_mode)
13147 && !NILP (BVAR (XBUFFER (w->buffer), mark_active))) 13150 && !NILP (BVAR (XBUFFER (WVAR (w, buffer)), mark_active)))
13148 != !NILP (w->region_showing)) 13151 != !NILP (WVAR (w, region_showing)))
13149 || (!NILP (w->region_showing) 13152 || (!NILP (WVAR (w, region_showing))
13150 && !EQ (w->region_showing, 13153 && !EQ (WVAR (w, region_showing),
13151 Fmarker_position (BVAR (XBUFFER (w->buffer), mark))))) 13154 Fmarker_position (BVAR (XBUFFER (WVAR (w, buffer)), mark)))))
13152 CHARPOS (this_line_start_pos) = 0; 13155 CHARPOS (this_line_start_pos) = 0;
13153 13156
13154 /* Optimize the case that only the line containing the cursor in the 13157 /* Optimize the case that only the line containing the cursor in the
@@ -13162,11 +13165,11 @@ redisplay_internal (void)
13162 && !w->update_mode_line 13165 && !w->update_mode_line
13163 && !current_buffer->clip_changed 13166 && !current_buffer->clip_changed
13164 && !current_buffer->prevent_redisplay_optimizations_p 13167 && !current_buffer->prevent_redisplay_optimizations_p
13165 && FRAME_VISIBLE_P (XFRAME (w->frame)) 13168 && FRAME_VISIBLE_P (XFRAME (WVAR (w, frame)))
13166 && !FRAME_OBSCURED_P (XFRAME (w->frame)) 13169 && !FRAME_OBSCURED_P (XFRAME (WVAR (w, frame)))
13167 /* Make sure recorded data applies to current buffer, etc. */ 13170 /* Make sure recorded data applies to current buffer, etc. */
13168 && this_line_buffer == current_buffer 13171 && this_line_buffer == current_buffer
13169 && current_buffer == XBUFFER (w->buffer) 13172 && current_buffer == XBUFFER (WVAR (w, buffer))
13170 && !w->force_start 13173 && !w->force_start
13171 && !w->optional_new_start 13174 && !w->optional_new_start
13172 /* Point must be on the line that we have info recorded about. */ 13175 /* Point must be on the line that we have info recorded about. */
@@ -13264,13 +13267,13 @@ redisplay_internal (void)
13264 adjusted. */ 13267 adjusted. */
13265 if ((it.glyph_row - 1)->displays_text_p) 13268 if ((it.glyph_row - 1)->displays_text_p)
13266 { 13269 {
13267 if (XFASTINT (w->window_end_vpos) < this_line_vpos) 13270 if (XFASTINT (WVAR (w, window_end_vpos)) < this_line_vpos)
13268 XSETINT (w->window_end_vpos, this_line_vpos); 13271 XSETINT (WVAR (w, window_end_vpos), this_line_vpos);
13269 } 13272 }
13270 else if (XFASTINT (w->window_end_vpos) == this_line_vpos 13273 else if (XFASTINT (WVAR (w, window_end_vpos)) == this_line_vpos
13271 && this_line_vpos > 0) 13274 && this_line_vpos > 0)
13272 XSETINT (w->window_end_vpos, this_line_vpos - 1); 13275 XSETINT (WVAR (w, window_end_vpos), this_line_vpos - 1);
13273 w->window_end_valid = Qnil; 13276 WVAR (w, window_end_valid) = Qnil;
13274 13277
13275 /* Update hint: No need to try to scroll in update_window. */ 13278 /* Update hint: No need to try to scroll in update_window. */
13276 w->desired_matrix->no_scrolling_p = 1; 13279 w->desired_matrix->no_scrolling_p = 1;
@@ -13316,7 +13319,7 @@ redisplay_internal (void)
13316 && (EQ (selected_window, 13319 && (EQ (selected_window,
13317 BVAR (current_buffer, last_selected_window)) 13320 BVAR (current_buffer, last_selected_window))
13318 || highlight_nonselected_windows) 13321 || highlight_nonselected_windows)
13319 && NILP (w->region_showing) 13322 && NILP (WVAR (w, region_showing))
13320 && NILP (Vshow_trailing_whitespace) 13323 && NILP (Vshow_trailing_whitespace)
13321 && !cursor_in_echo_area) 13324 && !cursor_in_echo_area)
13322 { 13325 {
@@ -13477,7 +13480,7 @@ redisplay_internal (void)
13477 Lisp_Object mini_window = FRAME_MINIBUF_WINDOW (sf); 13480 Lisp_Object mini_window = FRAME_MINIBUF_WINDOW (sf);
13478 struct frame *mini_frame; 13481 struct frame *mini_frame;
13479 13482
13480 displayed_buffer = XBUFFER (XWINDOW (selected_window)->buffer); 13483 displayed_buffer = XBUFFER (WVAR (XWINDOW (selected_window), buffer));
13481 /* Use list_of_error, not Qerror, so that 13484 /* Use list_of_error, not Qerror, so that
13482 we catch only errors and don't run the debugger. */ 13485 we catch only errors and don't run the debugger. */
13483 internal_condition_case_1 (redisplay_window_1, selected_window, 13486 internal_condition_case_1 (redisplay_window_1, selected_window,
@@ -13543,7 +13546,7 @@ redisplay_internal (void)
13543 /* If we pause after scrolling, some rows in the current 13546 /* If we pause after scrolling, some rows in the current
13544 matrices of some windows are not valid. */ 13547 matrices of some windows are not valid. */
13545 if (!WINDOW_FULL_WIDTH_P (w) 13548 if (!WINDOW_FULL_WIDTH_P (w)
13546 && !FRAME_WINDOW_P (XFRAME (w->frame))) 13549 && !FRAME_WINDOW_P (XFRAME (WVAR (w, frame))))
13547 update_mode_lines = 1; 13550 update_mode_lines = 1;
13548 } 13551 }
13549 else 13552 else
@@ -13701,9 +13704,9 @@ unwind_redisplay (Lisp_Object val)
13701static void 13704static void
13702mark_window_display_accurate_1 (struct window *w, int accurate_p) 13705mark_window_display_accurate_1 (struct window *w, int accurate_p)
13703{ 13706{
13704 if (BUFFERP (w->buffer)) 13707 if (BUFFERP (WVAR (w, buffer)))
13705 { 13708 {
13706 struct buffer *b = XBUFFER (w->buffer); 13709 struct buffer *b = XBUFFER (WVAR (w, buffer));
13707 13710
13708 w->last_modified = accurate_p ? BUF_MODIFF(b) : 0; 13711 w->last_modified = accurate_p ? BUF_MODIFF(b) : 0;
13709 w->last_overlay_modified = accurate_p ? BUF_OVERLAY_MODIFF(b) : 0; 13712 w->last_overlay_modified = accurate_p ? BUF_OVERLAY_MODIFF(b) : 0;
@@ -13730,13 +13733,13 @@ mark_window_display_accurate_1 (struct window *w, int accurate_p)
13730 if (w == XWINDOW (selected_window)) 13733 if (w == XWINDOW (selected_window))
13731 w->last_point = BUF_PT (b); 13734 w->last_point = BUF_PT (b);
13732 else 13735 else
13733 w->last_point = XMARKER (w->pointm)->charpos; 13736 w->last_point = XMARKER (WVAR (w, pointm))->charpos;
13734 } 13737 }
13735 } 13738 }
13736 13739
13737 if (accurate_p) 13740 if (accurate_p)
13738 { 13741 {
13739 w->window_end_valid = w->buffer; 13742 WVAR (w, window_end_valid) = WVAR (w, buffer);
13740 w->update_mode_line = 0; 13743 w->update_mode_line = 0;
13741 } 13744 }
13742} 13745}
@@ -13752,15 +13755,15 @@ mark_window_display_accurate (Lisp_Object window, int accurate_p)
13752{ 13755{
13753 struct window *w; 13756 struct window *w;
13754 13757
13755 for (; !NILP (window); window = w->next) 13758 for (; !NILP (window); window = WVAR (w, next))
13756 { 13759 {
13757 w = XWINDOW (window); 13760 w = XWINDOW (window);
13758 mark_window_display_accurate_1 (w, accurate_p); 13761 mark_window_display_accurate_1 (w, accurate_p);
13759 13762
13760 if (!NILP (w->vchild)) 13763 if (!NILP (WVAR (w, vchild)))
13761 mark_window_display_accurate (w->vchild, accurate_p); 13764 mark_window_display_accurate (WVAR (w, vchild), accurate_p);
13762 if (!NILP (w->hchild)) 13765 if (!NILP (WVAR (w, hchild)))
13763 mark_window_display_accurate (w->hchild, accurate_p); 13766 mark_window_display_accurate (WVAR (w, hchild), accurate_p);
13764 } 13767 }
13765 13768
13766 if (accurate_p) 13769 if (accurate_p)
@@ -13820,13 +13823,13 @@ redisplay_windows (Lisp_Object window)
13820 { 13823 {
13821 struct window *w = XWINDOW (window); 13824 struct window *w = XWINDOW (window);
13822 13825
13823 if (!NILP (w->hchild)) 13826 if (!NILP (WVAR (w, hchild)))
13824 redisplay_windows (w->hchild); 13827 redisplay_windows (WVAR (w, hchild));
13825 else if (!NILP (w->vchild)) 13828 else if (!NILP (WVAR (w, vchild)))
13826 redisplay_windows (w->vchild); 13829 redisplay_windows (WVAR (w, vchild));
13827 else if (!NILP (w->buffer)) 13830 else if (!NILP (WVAR (w, buffer)))
13828 { 13831 {
13829 displayed_buffer = XBUFFER (w->buffer); 13832 displayed_buffer = XBUFFER (WVAR (w, buffer));
13830 /* Use list_of_error, not Qerror, so that 13833 /* Use list_of_error, not Qerror, so that
13831 we catch only errors and don't run the debugger. */ 13834 we catch only errors and don't run the debugger. */
13832 internal_condition_case_1 (redisplay_window_0, window, 13835 internal_condition_case_1 (redisplay_window_0, window,
@@ -13834,7 +13837,7 @@ redisplay_windows (Lisp_Object window)
13834 redisplay_window_error); 13837 redisplay_window_error);
13835 } 13838 }
13836 13839
13837 window = w->next; 13840 window = WVAR (w, next);
13838 } 13841 }
13839} 13842}
13840 13843
@@ -14468,7 +14471,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
14468 && !MATRIX_ROW_CONTINUATION_LINE_P (row) 14471 && !MATRIX_ROW_CONTINUATION_LINE_P (row)
14469 && row->x == 0) 14472 && row->x == 0)
14470 { 14473 {
14471 this_line_buffer = XBUFFER (w->buffer); 14474 this_line_buffer = XBUFFER (WVAR (w, buffer));
14472 14475
14473 CHARPOS (this_line_start_pos) 14476 CHARPOS (this_line_start_pos)
14474 = MATRIX_ROW_START_CHARPOS (row) + delta; 14477 = MATRIX_ROW_START_CHARPOS (row) + delta;
@@ -14502,19 +14505,19 @@ static inline struct text_pos
14502run_window_scroll_functions (Lisp_Object window, struct text_pos startp) 14505run_window_scroll_functions (Lisp_Object window, struct text_pos startp)
14503{ 14506{
14504 struct window *w = XWINDOW (window); 14507 struct window *w = XWINDOW (window);
14505 SET_MARKER_FROM_TEXT_POS (w->start, startp); 14508 SET_MARKER_FROM_TEXT_POS (WVAR (w, start), startp);
14506 14509
14507 if (current_buffer != XBUFFER (w->buffer)) 14510 if (current_buffer != XBUFFER (WVAR (w, buffer)))
14508 abort (); 14511 abort ();
14509 14512
14510 if (!NILP (Vwindow_scroll_functions)) 14513 if (!NILP (Vwindow_scroll_functions))
14511 { 14514 {
14512 run_hook_with_args_2 (Qwindow_scroll_functions, window, 14515 run_hook_with_args_2 (Qwindow_scroll_functions, window,
14513 make_number (CHARPOS (startp))); 14516 make_number (CHARPOS (startp)));
14514 SET_TEXT_POS_FROM_MARKER (startp, w->start); 14517 SET_TEXT_POS_FROM_MARKER (startp, WVAR (w, start));
14515 /* In case the hook functions switch buffers. */ 14518 /* In case the hook functions switch buffers. */
14516 if (current_buffer != XBUFFER (w->buffer)) 14519 if (current_buffer != XBUFFER (WVAR (w, buffer)))
14517 set_buffer_internal_1 (XBUFFER (w->buffer)); 14520 set_buffer_internal_1 (XBUFFER (WVAR (w, buffer)));
14518 } 14521 }
14519 14522
14520 return startp; 14523 return startp;
@@ -14604,7 +14607,7 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
14604 int temp_scroll_step, int last_line_misfit) 14607 int temp_scroll_step, int last_line_misfit)
14605{ 14608{
14606 struct window *w = XWINDOW (window); 14609 struct window *w = XWINDOW (window);
14607 struct frame *f = XFRAME (w->frame); 14610 struct frame *f = XFRAME (WVAR (w, frame));
14608 struct text_pos pos, startp; 14611 struct text_pos pos, startp;
14609 struct it it; 14612 struct it it;
14610 int this_scroll_margin, scroll_max, rc, height; 14613 int this_scroll_margin, scroll_max, rc, height;
@@ -14618,7 +14621,7 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
14618 debug_method_add (w, "try_scrolling"); 14621 debug_method_add (w, "try_scrolling");
14619#endif 14622#endif
14620 14623
14621 SET_TEXT_POS_FROM_MARKER (startp, w->start); 14624 SET_TEXT_POS_FROM_MARKER (startp, WVAR (w, start));
14622 14625
14623 /* Compute scroll margin height in pixels. We scroll when point is 14626 /* Compute scroll margin height in pixels. We scroll when point is
14624 within this distance from the top or bottom of the window. */ 14627 within this distance from the top or bottom of the window. */
@@ -14844,7 +14847,7 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
14844 if (!just_this_one_p 14847 if (!just_this_one_p
14845 || current_buffer->clip_changed 14848 || current_buffer->clip_changed
14846 || BEG_UNCHANGED < CHARPOS (startp)) 14849 || BEG_UNCHANGED < CHARPOS (startp))
14847 w->base_line_number = Qnil; 14850 WVAR (w, base_line_number) = Qnil;
14848 14851
14849 /* If cursor ends up on a partially visible line, 14852 /* If cursor ends up on a partially visible line,
14850 treat that as being off the bottom of the screen. */ 14853 treat that as being off the bottom of the screen. */
@@ -14879,7 +14882,7 @@ compute_window_start_on_continuation_line (struct window *w)
14879 struct text_pos pos, start_pos; 14882 struct text_pos pos, start_pos;
14880 int window_start_changed_p = 0; 14883 int window_start_changed_p = 0;
14881 14884
14882 SET_TEXT_POS_FROM_MARKER (start_pos, w->start); 14885 SET_TEXT_POS_FROM_MARKER (start_pos, WVAR (w, start));
14883 14886
14884 /* If window start is on a continuation line... Window start may be 14887 /* If window start is on a continuation line... Window start may be
14885 < BEGV in case there's invisible text at the start of the 14888 < BEGV in case there's invisible text at the start of the
@@ -14927,7 +14930,7 @@ compute_window_start_on_continuation_line (struct window *w)
14927 } 14930 }
14928 14931
14929 /* Set the window start there. */ 14932 /* Set the window start there. */
14930 SET_MARKER_FROM_TEXT_POS (w->start, pos); 14933 SET_MARKER_FROM_TEXT_POS (WVAR (w, start), pos);
14931 window_start_changed_p = 1; 14934 window_start_changed_p = 1;
14932 } 14935 }
14933 } 14936 }
@@ -14963,7 +14966,7 @@ static int
14963try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_step) 14966try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_step)
14964{ 14967{
14965 struct window *w = XWINDOW (window); 14968 struct window *w = XWINDOW (window);
14966 struct frame *f = XFRAME (w->frame); 14969 struct frame *f = XFRAME (WVAR (w, frame));
14967 int rc = CURSOR_MOVEMENT_CANNOT_BE_USED; 14970 int rc = CURSOR_MOVEMENT_CANNOT_BE_USED;
14968 14971
14969#ifdef GLYPH_DEBUG 14972#ifdef GLYPH_DEBUG
@@ -14994,7 +14997,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
14994 set the cursor. */ 14997 set the cursor. */
14995 && !(!NILP (Vtransient_mark_mode) 14998 && !(!NILP (Vtransient_mark_mode)
14996 && !NILP (BVAR (current_buffer, mark_active))) 14999 && !NILP (BVAR (current_buffer, mark_active)))
14997 && NILP (w->region_showing) 15000 && NILP (WVAR (w, region_showing))
14998 && NILP (Vshow_trailing_whitespace) 15001 && NILP (Vshow_trailing_whitespace)
14999 /* This code is not used for mini-buffer for the sake of the case 15002 /* This code is not used for mini-buffer for the sake of the case
15000 of redisplaying to replace an echo area message; since in 15003 of redisplaying to replace an echo area message; since in
@@ -15008,8 +15011,8 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
15008 larger than the window. This should really be fixed in 15011 larger than the window. This should really be fixed in
15009 window.c. I don't have this on my list, now, so we do 15012 window.c. I don't have this on my list, now, so we do
15010 approximately the same as the old redisplay code. --gerd. */ 15013 approximately the same as the old redisplay code. --gerd. */
15011 && INTEGERP (w->window_end_vpos) 15014 && INTEGERP (WVAR (w, window_end_vpos))
15012 && XFASTINT (w->window_end_vpos) < w->current_matrix->nrows 15015 && XFASTINT (WVAR (w, window_end_vpos)) < w->current_matrix->nrows
15013 && (FRAME_WINDOW_P (f) 15016 && (FRAME_WINDOW_P (f)
15014 || !overlay_arrow_in_current_buffer_p ())) 15017 || !overlay_arrow_in_current_buffer_p ()))
15015 { 15018 {
@@ -15146,7 +15149,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
15146 must_scroll = 1; 15149 must_scroll = 1;
15147 } 15150 }
15148 else if (rc != CURSOR_MOVEMENT_SUCCESS 15151 else if (rc != CURSOR_MOVEMENT_SUCCESS
15149 && !NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering))) 15152 && !NILP (BVAR (XBUFFER (WVAR (w, buffer)), bidi_display_reordering)))
15150 { 15153 {
15151 struct glyph_row *row1; 15154 struct glyph_row *row1;
15152 15155
@@ -15209,7 +15212,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
15209 else if (scroll_p) 15212 else if (scroll_p)
15210 rc = CURSOR_MOVEMENT_MUST_SCROLL; 15213 rc = CURSOR_MOVEMENT_MUST_SCROLL;
15211 else if (rc != CURSOR_MOVEMENT_SUCCESS 15214 else if (rc != CURSOR_MOVEMENT_SUCCESS
15212 && !NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering))) 15215 && !NILP (BVAR (XBUFFER (WVAR (w, buffer)), bidi_display_reordering)))
15213 { 15216 {
15214 /* With bidi-reordered rows, there could be more than 15217 /* With bidi-reordered rows, there could be more than
15215 one candidate row whose start and end positions 15218 one candidate row whose start and end positions
@@ -15316,12 +15319,12 @@ set_vertical_scroll_bar (struct window *w)
15316 || (w == XWINDOW (minibuf_window) 15319 || (w == XWINDOW (minibuf_window)
15317 && NILP (echo_area_buffer[0]))) 15320 && NILP (echo_area_buffer[0])))
15318 { 15321 {
15319 struct buffer *buf = XBUFFER (w->buffer); 15322 struct buffer *buf = XBUFFER (WVAR (w, buffer));
15320 whole = BUF_ZV (buf) - BUF_BEGV (buf); 15323 whole = BUF_ZV (buf) - BUF_BEGV (buf);
15321 start = marker_position (w->start) - BUF_BEGV (buf); 15324 start = marker_position (WVAR (w, start)) - BUF_BEGV (buf);
15322 /* I don't think this is guaranteed to be right. For the 15325 /* I don't think this is guaranteed to be right. For the
15323 moment, we'll pretend it is. */ 15326 moment, we'll pretend it is. */
15324 end = BUF_Z (buf) - XFASTINT (w->window_end_pos) - BUF_BEGV (buf); 15327 end = BUF_Z (buf) - XFASTINT (WVAR (w, window_end_pos)) - BUF_BEGV (buf);
15325 15328
15326 if (end < start) 15329 if (end < start)
15327 end = start; 15330 end = start;
@@ -15332,8 +15335,8 @@ set_vertical_scroll_bar (struct window *w)
15332 start = end = whole = 0; 15335 start = end = whole = 0;
15333 15336
15334 /* Indicate what this scroll bar ought to be displaying now. */ 15337 /* Indicate what this scroll bar ought to be displaying now. */
15335 if (FRAME_TERMINAL (XFRAME (w->frame))->set_vertical_scroll_bar_hook) 15338 if (FRAME_TERMINAL (XFRAME (WVAR (w, frame)))->set_vertical_scroll_bar_hook)
15336 (*FRAME_TERMINAL (XFRAME (w->frame))->set_vertical_scroll_bar_hook) 15339 (*FRAME_TERMINAL (XFRAME (WVAR (w, frame)))->set_vertical_scroll_bar_hook)
15337 (w, end - start, whole, start); 15340 (w, end - start, whole, start);
15338} 15341}
15339 15342
@@ -15349,8 +15352,8 @@ static void
15349redisplay_window (Lisp_Object window, int just_this_one_p) 15352redisplay_window (Lisp_Object window, int just_this_one_p)
15350{ 15353{
15351 struct window *w = XWINDOW (window); 15354 struct window *w = XWINDOW (window);
15352 struct frame *f = XFRAME (w->frame); 15355 struct frame *f = XFRAME (WVAR (w, frame));
15353 struct buffer *buffer = XBUFFER (w->buffer); 15356 struct buffer *buffer = XBUFFER (WVAR (w, buffer));
15354 struct buffer *old = current_buffer; 15357 struct buffer *old = current_buffer;
15355 struct text_pos lpoint, opoint, startp; 15358 struct text_pos lpoint, opoint, startp;
15356 int update_mode_line; 15359 int update_mode_line;
@@ -15373,7 +15376,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15373 opoint = lpoint; 15376 opoint = lpoint;
15374 15377
15375 /* W must be a leaf window here. */ 15378 /* W must be a leaf window here. */
15376 eassert (!NILP (w->buffer)); 15379 eassert (!NILP (WVAR (w, buffer)));
15377#ifdef GLYPH_DEBUG 15380#ifdef GLYPH_DEBUG
15378 *w->desired_matrix->method = 0; 15381 *w->desired_matrix->method = 0;
15379#endif 15382#endif
@@ -15403,10 +15406,10 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15403 else if ((w != XWINDOW (minibuf_window) 15406 else if ((w != XWINDOW (minibuf_window)
15404 || minibuf_level == 0) 15407 || minibuf_level == 0)
15405 /* When buffer is nonempty, redisplay window normally. */ 15408 /* When buffer is nonempty, redisplay window normally. */
15406 && BUF_Z (XBUFFER (w->buffer)) == BUF_BEG (XBUFFER (w->buffer)) 15409 && BUF_Z (XBUFFER (WVAR (w, buffer))) == BUF_BEG (XBUFFER (WVAR (w, buffer)))
15407 /* Quail displays non-mini buffers in minibuffer window. 15410 /* Quail displays non-mini buffers in minibuffer window.
15408 In that case, redisplay the window normally. */ 15411 In that case, redisplay the window normally. */
15409 && !NILP (Fmemq (w->buffer, Vminibuffer_list))) 15412 && !NILP (Fmemq (WVAR (w, buffer), Vminibuffer_list)))
15410 { 15413 {
15411 /* W is a mini-buffer window, but it's not active, so clear 15414 /* W is a mini-buffer window, but it's not active, so clear
15412 it. */ 15415 it. */
@@ -15428,10 +15431,10 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15428 value. */ 15431 value. */
15429 /* Really select the buffer, for the sake of buffer-local 15432 /* Really select the buffer, for the sake of buffer-local
15430 variables. */ 15433 variables. */
15431 set_buffer_internal_1 (XBUFFER (w->buffer)); 15434 set_buffer_internal_1 (XBUFFER (WVAR (w, buffer)));
15432 15435
15433 current_matrix_up_to_date_p 15436 current_matrix_up_to_date_p
15434 = (!NILP (w->window_end_valid) 15437 = (!NILP (WVAR (w, window_end_valid))
15435 && !current_buffer->clip_changed 15438 && !current_buffer->clip_changed
15436 && !current_buffer->prevent_redisplay_optimizations_p 15439 && !current_buffer->prevent_redisplay_optimizations_p
15437 && w->last_modified >= MODIFF 15440 && w->last_modified >= MODIFF
@@ -15455,7 +15458,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15455 specbind (Qinhibit_point_motion_hooks, Qt); 15458 specbind (Qinhibit_point_motion_hooks, Qt);
15456 15459
15457 buffer_unchanged_p 15460 buffer_unchanged_p
15458 = (!NILP (w->window_end_valid) 15461 = (!NILP (WVAR (w, window_end_valid))
15459 && !current_buffer->clip_changed 15462 && !current_buffer->clip_changed
15460 && w->last_modified >= MODIFF 15463 && w->last_modified >= MODIFF
15461 && w->last_overlay_modified >= OVERLAY_MODIFF); 15464 && w->last_overlay_modified >= OVERLAY_MODIFF);
@@ -15466,10 +15469,10 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15466 { 15469 {
15467 /* If window starts on a continuation line, maybe adjust the 15470 /* If window starts on a continuation line, maybe adjust the
15468 window start in case the window's width changed. */ 15471 window start in case the window's width changed. */
15469 if (XMARKER (w->start)->buffer == current_buffer) 15472 if (XMARKER (WVAR (w, start))->buffer == current_buffer)
15470 compute_window_start_on_continuation_line (w); 15473 compute_window_start_on_continuation_line (w);
15471 15474
15472 w->window_end_valid = Qnil; 15475 WVAR (w, window_end_valid) = Qnil;
15473 } 15476 }
15474 15477
15475 /* Some sanity checks. */ 15478 /* Some sanity checks. */
@@ -15480,13 +15483,13 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15480 abort (); 15483 abort ();
15481 15484
15482 /* If %c is in mode line, update it if needed. */ 15485 /* If %c is in mode line, update it if needed. */
15483 if (!NILP (w->column_number_displayed) 15486 if (!NILP (WVAR (w, column_number_displayed))
15484 /* This alternative quickly identifies a common case 15487 /* This alternative quickly identifies a common case
15485 where no change is needed. */ 15488 where no change is needed. */
15486 && !(PT == w->last_point 15489 && !(PT == w->last_point
15487 && w->last_modified >= MODIFF 15490 && w->last_modified >= MODIFF
15488 && w->last_overlay_modified >= OVERLAY_MODIFF) 15491 && w->last_overlay_modified >= OVERLAY_MODIFF)
15489 && (XFASTINT (w->column_number_displayed) != current_column ())) 15492 && (XFASTINT (WVAR (w, column_number_displayed)) != current_column ()))
15490 update_mode_line = 1; 15493 update_mode_line = 1;
15491 15494
15492 /* Count number of windows showing the selected buffer. An indirect 15495 /* Count number of windows showing the selected buffer. An indirect
@@ -15495,7 +15498,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15495 { 15498 {
15496 struct buffer *current_base, *window_base; 15499 struct buffer *current_base, *window_base;
15497 current_base = current_buffer; 15500 current_base = current_buffer;
15498 window_base = XBUFFER (XWINDOW (selected_window)->buffer); 15501 window_base = XBUFFER (WVAR (XWINDOW (selected_window), buffer));
15499 if (current_base->base_buffer) 15502 if (current_base->base_buffer)
15500 current_base = current_base->base_buffer; 15503 current_base = current_base->base_buffer;
15501 if (window_base->base_buffer) 15504 if (window_base->base_buffer)
@@ -15508,19 +15511,19 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15508 window, set up appropriate value. */ 15511 window, set up appropriate value. */
15509 if (!EQ (window, selected_window)) 15512 if (!EQ (window, selected_window))
15510 { 15513 {
15511 ptrdiff_t new_pt = XMARKER (w->pointm)->charpos; 15514 ptrdiff_t new_pt = XMARKER (WVAR (w, pointm))->charpos;
15512 ptrdiff_t new_pt_byte = marker_byte_position (w->pointm); 15515 ptrdiff_t new_pt_byte = marker_byte_position (WVAR (w, pointm));
15513 if (new_pt < BEGV) 15516 if (new_pt < BEGV)
15514 { 15517 {
15515 new_pt = BEGV; 15518 new_pt = BEGV;
15516 new_pt_byte = BEGV_BYTE; 15519 new_pt_byte = BEGV_BYTE;
15517 set_marker_both (w->pointm, Qnil, BEGV, BEGV_BYTE); 15520 set_marker_both (WVAR (w, pointm), Qnil, BEGV, BEGV_BYTE);
15518 } 15521 }
15519 else if (new_pt > (ZV - 1)) 15522 else if (new_pt > (ZV - 1))
15520 { 15523 {
15521 new_pt = ZV; 15524 new_pt = ZV;
15522 new_pt_byte = ZV_BYTE; 15525 new_pt_byte = ZV_BYTE;
15523 set_marker_both (w->pointm, Qnil, ZV, ZV_BYTE); 15526 set_marker_both (WVAR (w, pointm), Qnil, ZV, ZV_BYTE);
15524 } 15527 }
15525 15528
15526 /* We don't use SET_PT so that the point-motion hooks don't run. */ 15529 /* We don't use SET_PT so that the point-motion hooks don't run. */
@@ -15536,8 +15539,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15536 { 15539 {
15537 struct Lisp_Char_Table *disptab = buffer_display_table (); 15540 struct Lisp_Char_Table *disptab = buffer_display_table ();
15538 15541
15539 if (! disptab_matches_widthtab (disptab, 15542 if (! disptab_matches_widthtab
15540 XVECTOR (BVAR (current_buffer, width_table)))) 15543 (disptab, XVECTOR (BVAR (current_buffer, width_table))))
15541 { 15544 {
15542 invalidate_region_cache (current_buffer, 15545 invalidate_region_cache (current_buffer,
15543 current_buffer->width_run_cache, 15546 current_buffer->width_run_cache,
@@ -15547,10 +15550,10 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15547 } 15550 }
15548 15551
15549 /* If window-start is screwed up, choose a new one. */ 15552 /* If window-start is screwed up, choose a new one. */
15550 if (XMARKER (w->start)->buffer != current_buffer) 15553 if (XMARKER (WVAR (w, start))->buffer != current_buffer)
15551 goto recenter; 15554 goto recenter;
15552 15555
15553 SET_TEXT_POS_FROM_MARKER (startp, w->start); 15556 SET_TEXT_POS_FROM_MARKER (startp, WVAR (w, start));
15554 15557
15555 /* If someone specified a new starting point but did not insist, 15558 /* If someone specified a new starting point but did not insist,
15556 check whether it can be used. */ 15559 check whether it can be used. */
@@ -15580,11 +15583,11 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15580 15583
15581 w->force_start = 0; 15584 w->force_start = 0;
15582 w->vscroll = 0; 15585 w->vscroll = 0;
15583 w->window_end_valid = Qnil; 15586 WVAR (w, window_end_valid) = Qnil;
15584 15587
15585 /* Forget any recorded base line for line number display. */ 15588 /* Forget any recorded base line for line number display. */
15586 if (!buffer_unchanged_p) 15589 if (!buffer_unchanged_p)
15587 w->base_line_number = Qnil; 15590 WVAR (w, base_line_number) = Qnil;
15588 15591
15589 /* Redisplay the mode line. Select the buffer properly for that. 15592 /* Redisplay the mode line. Select the buffer properly for that.
15590 Also, run the hook window-scroll-functions 15593 Also, run the hook window-scroll-functions
@@ -15649,7 +15652,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15649 MATRIX_ROW_START_BYTEPOS (row)); 15652 MATRIX_ROW_START_BYTEPOS (row));
15650 15653
15651 if (w != XWINDOW (selected_window)) 15654 if (w != XWINDOW (selected_window))
15652 set_marker_both (w->pointm, Qnil, PT, PT_BYTE); 15655 set_marker_both (WVAR (w, pointm), Qnil, PT, PT_BYTE);
15653 else if (current_buffer == old) 15656 else if (current_buffer == old)
15654 SET_TEXT_POS (lpoint, PT, PT_BYTE); 15657 SET_TEXT_POS (lpoint, PT, PT_BYTE);
15655 15658
@@ -15751,7 +15754,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15751 sets it. So, we need to check the return value of 15754 sets it. So, we need to check the return value of
15752 compute_window_start_on_continuation_line. (See also 15755 compute_window_start_on_continuation_line. (See also
15753 bug#197). */ 15756 bug#197). */
15754 && XMARKER (w->start)->buffer == current_buffer 15757 && XMARKER (WVAR (w, start))->buffer == current_buffer
15755 && compute_window_start_on_continuation_line (w) 15758 && compute_window_start_on_continuation_line (w)
15756 /* It doesn't make sense to force the window start like we 15759 /* It doesn't make sense to force the window start like we
15757 do at label force_start if it is already known that point 15760 do at label force_start if it is already known that point
@@ -15762,7 +15765,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15762 && pos_visible_p (w, PT, &d1, &d2, &d3, &d4, &d5, &d6)) 15765 && pos_visible_p (w, PT, &d1, &d2, &d3, &d4, &d5, &d6))
15763 { 15766 {
15764 w->force_start = 1; 15767 w->force_start = 1;
15765 SET_TEXT_POS_FROM_MARKER (startp, w->start); 15768 SET_TEXT_POS_FROM_MARKER (startp, WVAR (w, start));
15766 goto force_start; 15769 goto force_start;
15767 } 15770 }
15768 15771
@@ -15798,7 +15801,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15798 || current_buffer->clip_changed 15801 || current_buffer->clip_changed
15799 || BEG_UNCHANGED < CHARPOS (startp)) 15802 || BEG_UNCHANGED < CHARPOS (startp))
15800 /* Forget any recorded base line for line number display. */ 15803 /* Forget any recorded base line for line number display. */
15801 w->base_line_number = Qnil; 15804 WVAR (w, base_line_number) = Qnil;
15802 15805
15803 if (!cursor_row_fully_visible_p (w, 1, 0)) 15806 if (!cursor_row_fully_visible_p (w, 1, 0))
15804 { 15807 {
@@ -15869,7 +15872,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15869 15872
15870 /* Forget any previously recorded base line for line number display. */ 15873 /* Forget any previously recorded base line for line number display. */
15871 if (!buffer_unchanged_p) 15874 if (!buffer_unchanged_p)
15872 w->base_line_number = Qnil; 15875 WVAR (w, base_line_number) = Qnil;
15873 15876
15874 /* Determine the window start relative to point. */ 15877 /* Determine the window start relative to point. */
15875 init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID); 15878 init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID);
@@ -15972,7 +15975,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15972 /* Set the window start position here explicitly, to avoid an 15975 /* Set the window start position here explicitly, to avoid an
15973 infinite loop in case the functions in window-scroll-functions 15976 infinite loop in case the functions in window-scroll-functions
15974 get errors. */ 15977 get errors. */
15975 set_marker_both (w->start, Qnil, IT_CHARPOS (it), IT_BYTEPOS (it)); 15978 set_marker_both (WVAR (w, start), Qnil, IT_CHARPOS (it), IT_BYTEPOS (it));
15976 15979
15977 /* Run scroll hooks. */ 15980 /* Run scroll hooks. */
15978 startp = run_window_scroll_functions (window, it.current.pos); 15981 startp = run_window_scroll_functions (window, it.current.pos);
@@ -16003,8 +16006,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
16003 line.) */ 16006 line.) */
16004 if (w->cursor.vpos < 0) 16007 if (w->cursor.vpos < 0)
16005 { 16008 {
16006 if (!NILP (w->window_end_valid) 16009 if (!NILP (WVAR (w, window_end_valid))
16007 && PT >= Z - XFASTINT (w->window_end_pos)) 16010 && PT >= Z - XFASTINT (WVAR (w, window_end_pos)))
16008 { 16011 {
16009 clear_glyph_matrix (w->desired_matrix); 16012 clear_glyph_matrix (w->desired_matrix);
16010 move_it_by_lines (&it, 1); 16013 move_it_by_lines (&it, 1);
@@ -16076,7 +16079,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
16076 16079
16077 done: 16080 done:
16078 16081
16079 SET_TEXT_POS_FROM_MARKER (startp, w->start); 16082 SET_TEXT_POS_FROM_MARKER (startp, WVAR (w, start));
16080 w->start_at_line_beg = (CHARPOS (startp) == BEGV 16083 w->start_at_line_beg = (CHARPOS (startp) == BEGV
16081 || FETCH_BYTE (BYTEPOS (startp) - 1) == '\n'); 16084 || FETCH_BYTE (BYTEPOS (startp) - 1) == '\n');
16082 16085
@@ -16090,10 +16093,10 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
16090 && !FRAME_WINDOW_P (f) 16093 && !FRAME_WINDOW_P (f)
16091 && !WINDOW_FULL_WIDTH_P (w)) 16094 && !WINDOW_FULL_WIDTH_P (w))
16092 /* Line number to display. */ 16095 /* Line number to display. */
16093 || INTEGERP (w->base_line_pos) 16096 || INTEGERP (WVAR (w, base_line_pos))
16094 /* Column number is displayed and different from the one displayed. */ 16097 /* Column number is displayed and different from the one displayed. */
16095 || (!NILP (w->column_number_displayed) 16098 || (!NILP (WVAR (w, column_number_displayed))
16096 && (XFASTINT (w->column_number_displayed) != current_column ()))) 16099 && (XFASTINT (WVAR (w, column_number_displayed)) != current_column ())))
16097 /* This means that the window has a mode line. */ 16100 /* This means that the window has a mode line. */
16098 && (WINDOW_WANTS_MODELINE_P (w) 16101 && (WINDOW_WANTS_MODELINE_P (w)
16099 || WINDOW_WANTS_HEADER_LINE_P (w))) 16102 || WINDOW_WANTS_HEADER_LINE_P (w)))
@@ -16125,10 +16128,10 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
16125 } 16128 }
16126 16129
16127 if (!line_number_displayed 16130 if (!line_number_displayed
16128 && !BUFFERP (w->base_line_pos)) 16131 && !BUFFERP (WVAR (w, base_line_pos)))
16129 { 16132 {
16130 w->base_line_pos = Qnil; 16133 WVAR (w, base_line_pos) = Qnil;
16131 w->base_line_number = Qnil; 16134 WVAR (w, base_line_number) = Qnil;
16132 } 16135 }
16133 16136
16134 finish_menu_bars: 16137 finish_menu_bars:
@@ -16241,10 +16244,10 @@ try_window (Lisp_Object window, struct text_pos pos, int flags)
16241 struct window *w = XWINDOW (window); 16244 struct window *w = XWINDOW (window);
16242 struct it it; 16245 struct it it;
16243 struct glyph_row *last_text_row = NULL; 16246 struct glyph_row *last_text_row = NULL;
16244 struct frame *f = XFRAME (w->frame); 16247 struct frame *f = XFRAME (WVAR (w, frame));
16245 16248
16246 /* Make POS the new window start. */ 16249 /* Make POS the new window start. */
16247 set_marker_both (w->start, Qnil, CHARPOS (pos), BYTEPOS (pos)); 16250 set_marker_both (WVAR (w, start), Qnil, CHARPOS (pos), BYTEPOS (pos));
16248 16251
16249 /* Mark cursor position as unknown. No overlay arrow seen. */ 16252 /* Mark cursor position as unknown. No overlay arrow seen. */
16250 w->cursor.vpos = -1; 16253 w->cursor.vpos = -1;
@@ -16293,7 +16296,7 @@ try_window (Lisp_Object window, struct text_pos pos, int flags)
16293 } 16296 }
16294 16297
16295 /* If bottom moved off end of frame, change mode line percentage. */ 16298 /* If bottom moved off end of frame, change mode line percentage. */
16296 if (XFASTINT (w->window_end_pos) <= 0 16299 if (XFASTINT (WVAR (w, window_end_pos)) <= 0
16297 && Z != IT_CHARPOS (it)) 16300 && Z != IT_CHARPOS (it))
16298 w->update_mode_line = 1; 16301 w->update_mode_line = 1;
16299 16302
@@ -16305,22 +16308,23 @@ try_window (Lisp_Object window, struct text_pos pos, int flags)
16305 eassert (MATRIX_ROW_DISPLAYS_TEXT_P (last_text_row)); 16308 eassert (MATRIX_ROW_DISPLAYS_TEXT_P (last_text_row));
16306 w->window_end_bytepos 16309 w->window_end_bytepos
16307 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); 16310 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row);
16308 w->window_end_pos 16311 WVAR (w, window_end_pos)
16309 = make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row)); 16312 = make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row));
16310 w->window_end_vpos 16313 WVAR (w, window_end_vpos)
16311 = make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix)); 16314 = make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix));
16312 eassert (MATRIX_ROW (w->desired_matrix, XFASTINT (w->window_end_vpos)) 16315 eassert
16313 ->displays_text_p); 16316 (MATRIX_ROW (w->desired_matrix,
16317 XFASTINT (WVAR (w, window_end_vpos)))->displays_text_p);
16314 } 16318 }
16315 else 16319 else
16316 { 16320 {
16317 w->window_end_bytepos = Z_BYTE - ZV_BYTE; 16321 w->window_end_bytepos = Z_BYTE - ZV_BYTE;
16318 w->window_end_pos = make_number (Z - ZV); 16322 WVAR (w, window_end_pos) = make_number (Z - ZV);
16319 w->window_end_vpos = make_number (0); 16323 WVAR (w, window_end_vpos) = make_number (0);
16320 } 16324 }
16321 16325
16322 /* But that is not valid info until redisplay finishes. */ 16326 /* But that is not valid info until redisplay finishes. */
16323 w->window_end_valid = Qnil; 16327 WVAR (w, window_end_valid) = Qnil;
16324 return 1; 16328 return 1;
16325} 16329}
16326 16330
@@ -16338,7 +16342,7 @@ try_window (Lisp_Object window, struct text_pos pos, int flags)
16338static int 16342static int
16339try_window_reusing_current_matrix (struct window *w) 16343try_window_reusing_current_matrix (struct window *w)
16340{ 16344{
16341 struct frame *f = XFRAME (w->frame); 16345 struct frame *f = XFRAME (WVAR (w, frame));
16342 struct glyph_row *bottom_row; 16346 struct glyph_row *bottom_row;
16343 struct it it; 16347 struct it it;
16344 struct run run; 16348 struct run run;
@@ -16365,7 +16369,7 @@ try_window_reusing_current_matrix (struct window *w)
16365 /* Can't do this if region may have changed. */ 16369 /* Can't do this if region may have changed. */
16366 if ((!NILP (Vtransient_mark_mode) 16370 if ((!NILP (Vtransient_mark_mode)
16367 && !NILP (BVAR (current_buffer, mark_active))) 16371 && !NILP (BVAR (current_buffer, mark_active)))
16368 || !NILP (w->region_showing) 16372 || !NILP (WVAR (w, region_showing))
16369 || !NILP (Vshow_trailing_whitespace)) 16373 || !NILP (Vshow_trailing_whitespace))
16370 return 0; 16374 return 0;
16371 16375
@@ -16382,7 +16386,7 @@ try_window_reusing_current_matrix (struct window *w)
16382 16386
16383 /* The variable new_start now holds the new window start. The old 16387 /* The variable new_start now holds the new window start. The old
16384 start `start' can be determined from the current matrix. */ 16388 start `start' can be determined from the current matrix. */
16385 SET_TEXT_POS_FROM_MARKER (new_start, w->start); 16389 SET_TEXT_POS_FROM_MARKER (new_start, WVAR (w, start));
16386 start = start_row->minpos; 16390 start = start_row->minpos;
16387 start_vpos = MATRIX_ROW_VPOS (start_row, w->current_matrix); 16391 start_vpos = MATRIX_ROW_VPOS (start_row, w->current_matrix);
16388 16392
@@ -16544,9 +16548,9 @@ try_window_reusing_current_matrix (struct window *w)
16544 { 16548 {
16545 w->window_end_bytepos 16549 w->window_end_bytepos
16546 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_reused_text_row); 16550 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_reused_text_row);
16547 w->window_end_pos 16551 WVAR (w, window_end_pos)
16548 = make_number (Z - MATRIX_ROW_END_CHARPOS (last_reused_text_row)); 16552 = make_number (Z - MATRIX_ROW_END_CHARPOS (last_reused_text_row));
16549 w->window_end_vpos 16553 WVAR (w, window_end_vpos)
16550 = make_number (MATRIX_ROW_VPOS (last_reused_text_row, 16554 = make_number (MATRIX_ROW_VPOS (last_reused_text_row,
16551 w->current_matrix)); 16555 w->current_matrix));
16552 } 16556 }
@@ -16554,19 +16558,19 @@ try_window_reusing_current_matrix (struct window *w)
16554 { 16558 {
16555 w->window_end_bytepos 16559 w->window_end_bytepos
16556 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); 16560 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row);
16557 w->window_end_pos 16561 WVAR (w, window_end_pos)
16558 = make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row)); 16562 = make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row));
16559 w->window_end_vpos 16563 WVAR (w, window_end_vpos)
16560 = make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix)); 16564 = make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix));
16561 } 16565 }
16562 else 16566 else
16563 { 16567 {
16564 /* This window must be completely empty. */ 16568 /* This window must be completely empty. */
16565 w->window_end_bytepos = Z_BYTE - ZV_BYTE; 16569 w->window_end_bytepos = Z_BYTE - ZV_BYTE;
16566 w->window_end_pos = make_number (Z - ZV); 16570 WVAR (w, window_end_pos) = make_number (Z - ZV);
16567 w->window_end_vpos = make_number (0); 16571 WVAR (w, window_end_vpos) = make_number (0);
16568 } 16572 }
16569 w->window_end_valid = Qnil; 16573 WVAR (w, window_end_valid) = Qnil;
16570 16574
16571 /* Update hint: don't try scrolling again in update_window. */ 16575 /* Update hint: don't try scrolling again in update_window. */
16572 w->desired_matrix->no_scrolling_p = 1; 16576 w->desired_matrix->no_scrolling_p = 1;
@@ -16720,7 +16724,7 @@ try_window_reusing_current_matrix (struct window *w)
16720 16724
16721 /* Can't use this optimization with bidi-reordered glyph 16725 /* Can't use this optimization with bidi-reordered glyph
16722 rows, unless cursor is already at point. */ 16726 rows, unless cursor is already at point. */
16723 if (!NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering))) 16727 if (!NILP (BVAR (XBUFFER (WVAR (w, buffer)), bidi_display_reordering)))
16724 { 16728 {
16725 if (!(w->cursor.hpos >= 0 16729 if (!(w->cursor.hpos >= 0
16726 && w->cursor.hpos < row->used[TEXT_AREA] 16730 && w->cursor.hpos < row->used[TEXT_AREA]
@@ -16747,18 +16751,18 @@ try_window_reusing_current_matrix (struct window *w)
16747 { 16751 {
16748 w->window_end_bytepos 16752 w->window_end_bytepos
16749 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); 16753 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row);
16750 w->window_end_pos 16754 WVAR (w, window_end_pos)
16751 = make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row)); 16755 = make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row));
16752 w->window_end_vpos 16756 WVAR (w, window_end_vpos)
16753 = make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix)); 16757 = make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix));
16754 } 16758 }
16755 else 16759 else
16756 { 16760 {
16757 w->window_end_vpos 16761 WVAR (w, window_end_vpos)
16758 = make_number (XFASTINT (w->window_end_vpos) - nrows_scrolled); 16762 = make_number (XFASTINT (WVAR (w, window_end_vpos)) - nrows_scrolled);
16759 } 16763 }
16760 16764
16761 w->window_end_valid = Qnil; 16765 WVAR (w, window_end_valid) = Qnil;
16762 w->desired_matrix->no_scrolling_p = 1; 16766 w->desired_matrix->no_scrolling_p = 1;
16763 16767
16764#ifdef GLYPH_DEBUG 16768#ifdef GLYPH_DEBUG
@@ -16891,16 +16895,16 @@ find_first_unchanged_at_end_row (struct window *w,
16891 16895
16892 /* Display must not have been paused, otherwise the current matrix 16896 /* Display must not have been paused, otherwise the current matrix
16893 is not up to date. */ 16897 is not up to date. */
16894 eassert (!NILP (w->window_end_valid)); 16898 eassert (!NILP (WVAR (w, window_end_valid)));
16895 16899
16896 /* A value of window_end_pos >= END_UNCHANGED means that the window 16900 /* A value of window_end_pos >= END_UNCHANGED means that the window
16897 end is in the range of changed text. If so, there is no 16901 end is in the range of changed text. If so, there is no
16898 unchanged row at the end of W's current matrix. */ 16902 unchanged row at the end of W's current matrix. */
16899 if (XFASTINT (w->window_end_pos) >= END_UNCHANGED) 16903 if (XFASTINT (WVAR (w, window_end_pos)) >= END_UNCHANGED)
16900 return NULL; 16904 return NULL;
16901 16905
16902 /* Set row to the last row in W's current matrix displaying text. */ 16906 /* Set row to the last row in W's current matrix displaying text. */
16903 row = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); 16907 row = MATRIX_ROW (w->current_matrix, XFASTINT (WVAR (w, window_end_vpos)));
16904 16908
16905 /* If matrix is entirely empty, no unchanged row exists. */ 16909 /* If matrix is entirely empty, no unchanged row exists. */
16906 if (MATRIX_ROW_DISPLAYS_TEXT_P (row)) 16910 if (MATRIX_ROW_DISPLAYS_TEXT_P (row))
@@ -16911,7 +16915,7 @@ find_first_unchanged_at_end_row (struct window *w,
16911 buffer positions in the current matrix to current buffer 16915 buffer positions in the current matrix to current buffer
16912 positions for characters not in changed text. */ 16916 positions for characters not in changed text. */
16913 ptrdiff_t Z_old = 16917 ptrdiff_t Z_old =
16914 MATRIX_ROW_END_CHARPOS (row) + XFASTINT (w->window_end_pos); 16918 MATRIX_ROW_END_CHARPOS (row) + XFASTINT (WVAR (w, window_end_pos));
16915 ptrdiff_t Z_BYTE_old = 16919 ptrdiff_t Z_BYTE_old =
16916 MATRIX_ROW_END_BYTEPOS (row) + w->window_end_bytepos; 16920 MATRIX_ROW_END_BYTEPOS (row) + w->window_end_bytepos;
16917 ptrdiff_t last_unchanged_pos, last_unchanged_pos_old; 16921 ptrdiff_t last_unchanged_pos, last_unchanged_pos_old;
@@ -16959,12 +16963,12 @@ find_first_unchanged_at_end_row (struct window *w,
16959static void 16963static void
16960sync_frame_with_window_matrix_rows (struct window *w) 16964sync_frame_with_window_matrix_rows (struct window *w)
16961{ 16965{
16962 struct frame *f = XFRAME (w->frame); 16966 struct frame *f = XFRAME (WVAR (w, frame));
16963 struct glyph_row *window_row, *window_row_end, *frame_row; 16967 struct glyph_row *window_row, *window_row_end, *frame_row;
16964 16968
16965 /* Preconditions: W must be a leaf window and full-width. Its frame 16969 /* Preconditions: W must be a leaf window and full-width. Its frame
16966 must have a frame matrix. */ 16970 must have a frame matrix. */
16967 eassert (NILP (w->hchild) && NILP (w->vchild)); 16971 eassert (NILP (WVAR (w, hchild)) && NILP (WVAR (w, vchild)));
16968 eassert (WINDOW_FULL_WIDTH_P (w)); 16972 eassert (WINDOW_FULL_WIDTH_P (w));
16969 eassert (!FRAME_WINDOW_P (f)); 16973 eassert (!FRAME_WINDOW_P (f));
16970 16974
@@ -17006,7 +17010,7 @@ row_containing_pos (struct window *w, ptrdiff_t charpos,
17006{ 17010{
17007 struct glyph_row *row = start; 17011 struct glyph_row *row = start;
17008 struct glyph_row *best_row = NULL; 17012 struct glyph_row *best_row = NULL;
17009 ptrdiff_t mindif = BUF_ZV (XBUFFER (w->buffer)) + 1; 17013 ptrdiff_t mindif = BUF_ZV (XBUFFER (WVAR (w, buffer))) + 1;
17010 int last_y; 17014 int last_y;
17011 17015
17012 /* If we happen to start on a header-line, skip that. */ 17016 /* If we happen to start on a header-line, skip that. */
@@ -17042,7 +17046,7 @@ row_containing_pos (struct window *w, ptrdiff_t charpos,
17042 { 17046 {
17043 struct glyph *g; 17047 struct glyph *g;
17044 17048
17045 if (NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering)) 17049 if (NILP (BVAR (XBUFFER (WVAR (w, buffer)), bidi_display_reordering))
17046 || (!best_row && !row->continued_p)) 17050 || (!best_row && !row->continued_p))
17047 return row; 17051 return row;
17048 /* In bidi-reordered rows, there could be several rows 17052 /* In bidi-reordered rows, there could be several rows
@@ -17111,7 +17115,7 @@ row_containing_pos (struct window *w, ptrdiff_t charpos,
17111static int 17115static int
17112try_window_id (struct window *w) 17116try_window_id (struct window *w)
17113{ 17117{
17114 struct frame *f = XFRAME (w->frame); 17118 struct frame *f = XFRAME (WVAR (w, frame));
17115 struct glyph_matrix *current_matrix = w->current_matrix; 17119 struct glyph_matrix *current_matrix = w->current_matrix;
17116 struct glyph_matrix *desired_matrix = w->desired_matrix; 17120 struct glyph_matrix *desired_matrix = w->desired_matrix;
17117 struct glyph_row *last_unchanged_at_beg_row; 17121 struct glyph_row *last_unchanged_at_beg_row;
@@ -17145,7 +17149,7 @@ try_window_id (struct window *w)
17145#define GIVE_UP(X) return 0 17149#define GIVE_UP(X) return 0
17146#endif 17150#endif
17147 17151
17148 SET_TEXT_POS_FROM_MARKER (start, w->start); 17152 SET_TEXT_POS_FROM_MARKER (start, WVAR (w, start));
17149 17153
17150 /* Don't use this for mini-windows because these can show 17154 /* Don't use this for mini-windows because these can show
17151 messages and mini-buffers, and we don't handle that here. */ 17155 messages and mini-buffers, and we don't handle that here. */
@@ -17183,7 +17187,7 @@ try_window_id (struct window *w)
17183 GIVE_UP (7); 17187 GIVE_UP (7);
17184 17188
17185 /* Verify that display wasn't paused. */ 17189 /* Verify that display wasn't paused. */
17186 if (NILP (w->window_end_valid)) 17190 if (NILP (WVAR (w, window_end_valid)))
17187 GIVE_UP (8); 17191 GIVE_UP (8);
17188 17192
17189 /* Can't use this if highlighting a region because a cursor movement 17193 /* Can't use this if highlighting a region because a cursor movement
@@ -17197,7 +17201,7 @@ try_window_id (struct window *w)
17197 GIVE_UP (11); 17201 GIVE_UP (11);
17198 17202
17199 /* Likewise if showing a region. */ 17203 /* Likewise if showing a region. */
17200 if (!NILP (w->region_showing)) 17204 if (!NILP (WVAR (w, region_showing)))
17201 GIVE_UP (10); 17205 GIVE_UP (10);
17202 17206
17203 /* Can't use this if overlay arrow position and/or string have 17207 /* Can't use this if overlay arrow position and/or string have
@@ -17209,7 +17213,7 @@ try_window_id (struct window *w)
17209 wrapped line can change the wrap position, altering the line 17213 wrapped line can change the wrap position, altering the line
17210 above it. It might be worthwhile to handle this more 17214 above it. It might be worthwhile to handle this more
17211 intelligently, but for now just redisplay from scratch. */ 17215 intelligently, but for now just redisplay from scratch. */
17212 if (!NILP (BVAR (XBUFFER (w->buffer), word_wrap))) 17216 if (!NILP (BVAR (XBUFFER (WVAR (w, buffer)), word_wrap)))
17213 GIVE_UP (21); 17217 GIVE_UP (21);
17214 17218
17215 /* Under bidi reordering, adding or deleting a character in the 17219 /* Under bidi reordering, adding or deleting a character in the
@@ -17220,8 +17224,8 @@ try_window_id (struct window *w)
17220 to find the paragraph limits and widen the range of redisplayed 17224 to find the paragraph limits and widen the range of redisplayed
17221 lines to that, but for now just give up this optimization and 17225 lines to that, but for now just give up this optimization and
17222 redisplay from scratch. */ 17226 redisplay from scratch. */
17223 if (!NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering)) 17227 if (!NILP (BVAR (XBUFFER (WVAR (w, buffer)), bidi_display_reordering))
17224 && NILP (BVAR (XBUFFER (w->buffer), bidi_paragraph_direction))) 17228 && NILP (BVAR (XBUFFER (WVAR (w, buffer)), bidi_paragraph_direction)))
17225 GIVE_UP (22); 17229 GIVE_UP (22);
17226 17230
17227 /* Make sure beg_unchanged and end_unchanged are up to date. Do it 17231 /* Make sure beg_unchanged and end_unchanged are up to date. Do it
@@ -17247,7 +17251,7 @@ try_window_id (struct window *w)
17247 This case happens with stealth-fontification. Note that although 17251 This case happens with stealth-fontification. Note that although
17248 the display is unchanged, glyph positions in the matrix have to 17252 the display is unchanged, glyph positions in the matrix have to
17249 be adjusted, of course. */ 17253 be adjusted, of course. */
17250 row = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); 17254 row = MATRIX_ROW (w->current_matrix, XFASTINT (WVAR (w, window_end_vpos)));
17251 if (MATRIX_ROW_DISPLAYS_TEXT_P (row) 17255 if (MATRIX_ROW_DISPLAYS_TEXT_P (row)
17252 && ((last_changed_charpos < CHARPOS (start) 17256 && ((last_changed_charpos < CHARPOS (start)
17253 && CHARPOS (start) == BEGV) 17257 && CHARPOS (start) == BEGV)
@@ -17259,7 +17263,7 @@ try_window_id (struct window *w)
17259 17263
17260 /* Compute how many chars/bytes have been added to or removed 17264 /* Compute how many chars/bytes have been added to or removed
17261 from the buffer. */ 17265 from the buffer. */
17262 Z_old = MATRIX_ROW_END_CHARPOS (row) + XFASTINT (w->window_end_pos); 17266 Z_old = MATRIX_ROW_END_CHARPOS (row) + XFASTINT (WVAR (w, window_end_pos));
17263 Z_BYTE_old = MATRIX_ROW_END_BYTEPOS (row) + w->window_end_bytepos; 17267 Z_BYTE_old = MATRIX_ROW_END_BYTEPOS (row) + w->window_end_bytepos;
17264 Z_delta = Z - Z_old; 17268 Z_delta = Z - Z_old;
17265 Z_delta_bytes = Z_BYTE - Z_BYTE_old; 17269 Z_delta_bytes = Z_BYTE - Z_BYTE_old;
@@ -17330,7 +17334,7 @@ try_window_id (struct window *w)
17330 { 17334 {
17331 /* We have to compute the window end anew since text 17335 /* We have to compute the window end anew since text
17332 could have been added/removed after it. */ 17336 could have been added/removed after it. */
17333 w->window_end_pos 17337 WVAR (w, window_end_pos)
17334 = make_number (Z - MATRIX_ROW_END_CHARPOS (row)); 17338 = make_number (Z - MATRIX_ROW_END_CHARPOS (row));
17335 w->window_end_bytepos 17339 w->window_end_bytepos
17336 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); 17340 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row);
@@ -17366,7 +17370,7 @@ try_window_id (struct window *w)
17366 17370
17367 /* Give up if the window ends in strings. Overlay strings 17371 /* Give up if the window ends in strings. Overlay strings
17368 at the end are difficult to handle, so don't try. */ 17372 at the end are difficult to handle, so don't try. */
17369 row = MATRIX_ROW (current_matrix, XFASTINT (w->window_end_vpos)); 17373 row = MATRIX_ROW (current_matrix, XFASTINT (WVAR (w, window_end_vpos)));
17370 if (MATRIX_ROW_START_CHARPOS (row) == MATRIX_ROW_END_CHARPOS (row)) 17374 if (MATRIX_ROW_START_CHARPOS (row) == MATRIX_ROW_END_CHARPOS (row))
17371 GIVE_UP (20); 17375 GIVE_UP (20);
17372 17376
@@ -17709,7 +17713,7 @@ try_window_id (struct window *w)
17709 /* Set last_row to the glyph row in the current matrix where the 17713 /* Set last_row to the glyph row in the current matrix where the
17710 window end line is found. It has been moved up or down in 17714 window end line is found. It has been moved up or down in
17711 the matrix by dvpos. */ 17715 the matrix by dvpos. */
17712 int last_vpos = XFASTINT (w->window_end_vpos) + dvpos; 17716 int last_vpos = XFASTINT (WVAR (w, window_end_vpos)) + dvpos;
17713 struct glyph_row *last_row = MATRIX_ROW (current_matrix, last_vpos); 17717 struct glyph_row *last_row = MATRIX_ROW (current_matrix, last_vpos);
17714 17718
17715 /* If last_row is the window end line, it should display text. */ 17719 /* If last_row is the window end line, it should display text. */
@@ -17765,20 +17769,20 @@ try_window_id (struct window *w)
17765 first_unchanged_at_end_row); 17769 first_unchanged_at_end_row);
17766 eassert (row && MATRIX_ROW_DISPLAYS_TEXT_P (row)); 17770 eassert (row && MATRIX_ROW_DISPLAYS_TEXT_P (row));
17767 17771
17768 w->window_end_pos = make_number (Z - MATRIX_ROW_END_CHARPOS (row)); 17772 WVAR (w, window_end_pos) = make_number (Z - MATRIX_ROW_END_CHARPOS (row));
17769 w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); 17773 w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row);
17770 w->window_end_vpos 17774 WVAR (w, window_end_vpos)
17771 = make_number (MATRIX_ROW_VPOS (row, w->current_matrix)); 17775 = make_number (MATRIX_ROW_VPOS (row, w->current_matrix));
17772 eassert (w->window_end_bytepos >= 0); 17776 eassert (w->window_end_bytepos >= 0);
17773 IF_DEBUG (debug_method_add (w, "A")); 17777 IF_DEBUG (debug_method_add (w, "A"));
17774 } 17778 }
17775 else if (last_text_row_at_end) 17779 else if (last_text_row_at_end)
17776 { 17780 {
17777 w->window_end_pos 17781 WVAR (w, window_end_pos)
17778 = make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row_at_end)); 17782 = make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row_at_end));
17779 w->window_end_bytepos 17783 w->window_end_bytepos
17780 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row_at_end); 17784 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row_at_end);
17781 w->window_end_vpos 17785 WVAR (w, window_end_vpos)
17782 = make_number (MATRIX_ROW_VPOS (last_text_row_at_end, desired_matrix)); 17786 = make_number (MATRIX_ROW_VPOS (last_text_row_at_end, desired_matrix));
17783 eassert (w->window_end_bytepos >= 0); 17787 eassert (w->window_end_bytepos >= 0);
17784 IF_DEBUG (debug_method_add (w, "B")); 17788 IF_DEBUG (debug_method_add (w, "B"));
@@ -17788,11 +17792,11 @@ try_window_id (struct window *w)
17788 /* We have displayed either to the end of the window or at the 17792 /* We have displayed either to the end of the window or at the
17789 end of the window, i.e. the last row with text is to be found 17793 end of the window, i.e. the last row with text is to be found
17790 in the desired matrix. */ 17794 in the desired matrix. */
17791 w->window_end_pos 17795 WVAR (w, window_end_pos)
17792 = make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row)); 17796 = make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row));
17793 w->window_end_bytepos 17797 w->window_end_bytepos
17794 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); 17798 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row);
17795 w->window_end_vpos 17799 WVAR (w, window_end_vpos)
17796 = make_number (MATRIX_ROW_VPOS (last_text_row, desired_matrix)); 17800 = make_number (MATRIX_ROW_VPOS (last_text_row, desired_matrix));
17797 eassert (w->window_end_bytepos >= 0); 17801 eassert (w->window_end_bytepos >= 0);
17798 } 17802 }
@@ -17803,7 +17807,7 @@ try_window_id (struct window *w)
17803 /* Displayed to end of window, but no line containing text was 17807 /* Displayed to end of window, but no line containing text was
17804 displayed. Lines were deleted at the end of the window. */ 17808 displayed. Lines were deleted at the end of the window. */
17805 int first_vpos = WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0; 17809 int first_vpos = WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0;
17806 int vpos = XFASTINT (w->window_end_vpos); 17810 int vpos = XFASTINT (WVAR (w, window_end_vpos));
17807 struct glyph_row *current_row = current_matrix->rows + vpos; 17811 struct glyph_row *current_row = current_matrix->rows + vpos;
17808 struct glyph_row *desired_row = desired_matrix->rows + vpos; 17812 struct glyph_row *desired_row = desired_matrix->rows + vpos;
17809 17813
@@ -17821,8 +17825,8 @@ try_window_id (struct window *w)
17821 } 17825 }
17822 17826
17823 eassert (row != NULL); 17827 eassert (row != NULL);
17824 w->window_end_vpos = make_number (vpos + 1); 17828 WVAR (w, window_end_vpos) = make_number (vpos + 1);
17825 w->window_end_pos = make_number (Z - MATRIX_ROW_END_CHARPOS (row)); 17829 WVAR (w, window_end_pos) = make_number (Z - MATRIX_ROW_END_CHARPOS (row));
17826 w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); 17830 w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row);
17827 eassert (w->window_end_bytepos >= 0); 17831 eassert (w->window_end_bytepos >= 0);
17828 IF_DEBUG (debug_method_add (w, "C")); 17832 IF_DEBUG (debug_method_add (w, "C"));
@@ -17834,7 +17838,7 @@ try_window_id (struct window *w)
17834 debug_end_vpos = XFASTINT (w->window_end_vpos)); 17838 debug_end_vpos = XFASTINT (w->window_end_vpos));
17835 17839
17836 /* Record that display has not been completed. */ 17840 /* Record that display has not been completed. */
17837 w->window_end_valid = Qnil; 17841 WVAR (w, window_end_valid) = Qnil;
17838 w->desired_matrix->no_scrolling_p = 1; 17842 w->desired_matrix->no_scrolling_p = 1;
17839 return 3; 17843 return 3;
17840 17844
@@ -18064,7 +18068,7 @@ glyphs in short form, otherwise show glyphs in long form. */)
18064 (Lisp_Object glyphs) 18068 (Lisp_Object glyphs)
18065{ 18069{
18066 struct window *w = XWINDOW (selected_window); 18070 struct window *w = XWINDOW (selected_window);
18067 struct buffer *buffer = XBUFFER (w->buffer); 18071 struct buffer *buffer = XBUFFER (WVAR (w, buffer));
18068 18072
18069 fprintf (stderr, "PT = %"pI"d, BEGV = %"pI"d. ZV = %"pI"d\n", 18073 fprintf (stderr, "PT = %"pI"d, BEGV = %"pI"d. ZV = %"pI"d\n",
18070 BUF_PT (buffer), BUF_BEGV (buffer), BUF_ZV (buffer)); 18074 BUF_PT (buffer), BUF_BEGV (buffer), BUF_ZV (buffer));
@@ -18170,7 +18174,7 @@ static struct glyph_row *
18170get_overlay_arrow_glyph_row (struct window *w, Lisp_Object overlay_arrow_string) 18174get_overlay_arrow_glyph_row (struct window *w, Lisp_Object overlay_arrow_string)
18171{ 18175{
18172 struct frame *f = XFRAME (WINDOW_FRAME (w)); 18176 struct frame *f = XFRAME (WINDOW_FRAME (w));
18173 struct buffer *buffer = XBUFFER (w->buffer); 18177 struct buffer *buffer = XBUFFER (WVAR (w, buffer));
18174 struct buffer *old = current_buffer; 18178 struct buffer *old = current_buffer;
18175 const unsigned char *arrow_string = SDATA (overlay_arrow_string); 18179 const unsigned char *arrow_string = SDATA (overlay_arrow_string);
18176 int arrow_len = SCHARS (overlay_arrow_string); 18180 int arrow_len = SCHARS (overlay_arrow_string);
@@ -19247,7 +19251,7 @@ display_line (struct it *it)
19247 } 19251 }
19248 19252
19249 /* Is IT->w showing the region? */ 19253 /* Is IT->w showing the region? */
19250 it->w->region_showing = it->region_beg_charpos > 0 ? Qt : Qnil; 19254 WVAR (it->w, region_showing) = it->region_beg_charpos > 0 ? Qt : Qnil;
19251 19255
19252 /* Clear the result glyph row and enable it. */ 19256 /* Clear the result glyph row and enable it. */
19253 prepare_desired_row (row); 19257 prepare_desired_row (row);
@@ -19362,7 +19366,7 @@ display_line (struct it *it)
19362 row->glyphs[TEXT_AREA]->charpos = -1; 19366 row->glyphs[TEXT_AREA]->charpos = -1;
19363 row->displays_text_p = 0; 19367 row->displays_text_p = 0;
19364 19368
19365 if (!NILP (BVAR (XBUFFER (it->w->buffer), indicate_empty_lines)) 19369 if (!NILP (BVAR (XBUFFER (WVAR (it->w, buffer)), indicate_empty_lines))
19366 && (!MINI_WINDOW_P (it->w) 19370 && (!MINI_WINDOW_P (it->w)
19367 || (minibuf_level && EQ (it->window, minibuf_window)))) 19371 || (minibuf_level && EQ (it->window, minibuf_window))))
19368 row->indicate_empty_line_p = 1; 19372 row->indicate_empty_line_p = 1;
@@ -20185,12 +20189,12 @@ redisplay_mode_lines (Lisp_Object window, int force)
20185 { 20189 {
20186 struct window *w = XWINDOW (window); 20190 struct window *w = XWINDOW (window);
20187 20191
20188 if (WINDOWP (w->hchild)) 20192 if (WINDOWP (WVAR (w, hchild)))
20189 nwindows += redisplay_mode_lines (w->hchild, force); 20193 nwindows += redisplay_mode_lines (WVAR (w, hchild), force);
20190 else if (WINDOWP (w->vchild)) 20194 else if (WINDOWP (WVAR (w, vchild)))
20191 nwindows += redisplay_mode_lines (w->vchild, force); 20195 nwindows += redisplay_mode_lines (WVAR (w, vchild), force);
20192 else if (force 20196 else if (force
20193 || FRAME_GARBAGED_P (XFRAME (w->frame)) 20197 || FRAME_GARBAGED_P (XFRAME (WVAR (w, frame)))
20194 || !MATRIX_MODE_LINE_ROW (w->current_matrix)->enabled_p) 20198 || !MATRIX_MODE_LINE_ROW (w->current_matrix)->enabled_p)
20195 { 20199 {
20196 struct text_pos lpoint; 20200 struct text_pos lpoint;
@@ -20198,7 +20202,7 @@ redisplay_mode_lines (Lisp_Object window, int force)
20198 20202
20199 /* Set the window's buffer for the mode line display. */ 20203 /* Set the window's buffer for the mode line display. */
20200 SET_TEXT_POS (lpoint, PT, PT_BYTE); 20204 SET_TEXT_POS (lpoint, PT, PT_BYTE);
20201 set_buffer_internal_1 (XBUFFER (w->buffer)); 20205 set_buffer_internal_1 (XBUFFER (WVAR (w, buffer)));
20202 20206
20203 /* Point refers normally to the selected window. For any 20207 /* Point refers normally to the selected window. For any
20204 other window, set up appropriate value. */ 20208 other window, set up appropriate value. */
@@ -20206,7 +20210,7 @@ redisplay_mode_lines (Lisp_Object window, int force)
20206 { 20210 {
20207 struct text_pos pt; 20211 struct text_pos pt;
20208 20212
20209 SET_TEXT_POS_FROM_MARKER (pt, w->pointm); 20213 SET_TEXT_POS_FROM_MARKER (pt, WVAR (w, pointm));
20210 if (CHARPOS (pt) < BEGV) 20214 if (CHARPOS (pt) < BEGV)
20211 TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); 20215 TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE);
20212 else if (CHARPOS (pt) > (ZV - 1)) 20216 else if (CHARPOS (pt) > (ZV - 1))
@@ -20228,7 +20232,7 @@ redisplay_mode_lines (Lisp_Object window, int force)
20228 TEMP_SET_PT_BOTH (CHARPOS (lpoint), BYTEPOS (lpoint)); 20232 TEMP_SET_PT_BOTH (CHARPOS (lpoint), BYTEPOS (lpoint));
20229 } 20233 }
20230 20234
20231 window = w->next; 20235 window = WVAR (w, next);
20232 } 20236 }
20233 20237
20234 return nwindows; 20238 return nwindows;
@@ -20245,13 +20249,13 @@ display_mode_lines (struct window *w)
20245 int n = 0; 20249 int n = 0;
20246 20250
20247 old_selected_frame = selected_frame; 20251 old_selected_frame = selected_frame;
20248 selected_frame = w->frame; 20252 selected_frame = WVAR (w, frame);
20249 old_selected_window = selected_window; 20253 old_selected_window = selected_window;
20250 XSETWINDOW (selected_window, w); 20254 XSETWINDOW (selected_window, w);
20251 20255
20252 /* These will be set while the mode line specs are processed. */ 20256 /* These will be set while the mode line specs are processed. */
20253 line_number_displayed = 0; 20257 line_number_displayed = 0;
20254 w->column_number_displayed = Qnil; 20258 WVAR (w, column_number_displayed) = Qnil;
20255 20259
20256 if (WINDOW_WANTS_MODELINE_P (w)) 20260 if (WINDOW_WANTS_MODELINE_P (w))
20257 { 20261 {
@@ -20981,7 +20985,7 @@ are the selected window and the WINDOW's buffer). */)
20981 w = XWINDOW (window); 20985 w = XWINDOW (window);
20982 20986
20983 if (NILP (buffer)) 20987 if (NILP (buffer))
20984 buffer = w->buffer; 20988 buffer = WVAR (w, buffer);
20985 CHECK_BUFFER (buffer); 20989 CHECK_BUFFER (buffer);
20986 20990
20987 /* Make formatting the modeline a non-op when noninteractive, otherwise 20991 /* Make formatting the modeline a non-op when noninteractive, otherwise
@@ -21387,7 +21391,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
21387 else 21391 else
21388 { 21392 {
21389 ptrdiff_t col = current_column (); 21393 ptrdiff_t col = current_column ();
21390 w->column_number_displayed = make_number (col); 21394 WVAR (w, column_number_displayed) = make_number (col);
21391 pint2str (decode_mode_spec_buf, field_width, col); 21395 pint2str (decode_mode_spec_buf, field_width, col);
21392 return decode_mode_spec_buf; 21396 return decode_mode_spec_buf;
21393 } 21397 }
@@ -21440,33 +21444,33 @@ decode_mode_spec (struct window *w, register int c, int field_width,
21440 if (mode_line_target == MODE_LINE_TITLE) 21444 if (mode_line_target == MODE_LINE_TITLE)
21441 return ""; 21445 return "";
21442 21446
21443 startpos = XMARKER (w->start)->charpos; 21447 startpos = XMARKER (WVAR (w, start))->charpos;
21444 startpos_byte = marker_byte_position (w->start); 21448 startpos_byte = marker_byte_position (WVAR (w, start));
21445 height = WINDOW_TOTAL_LINES (w); 21449 height = WINDOW_TOTAL_LINES (w);
21446 21450
21447 /* If we decided that this buffer isn't suitable for line numbers, 21451 /* If we decided that this buffer isn't suitable for line numbers,
21448 don't forget that too fast. */ 21452 don't forget that too fast. */
21449 if (EQ (w->base_line_pos, w->buffer)) 21453 if (EQ (WVAR (w, base_line_pos), WVAR (w, buffer)))
21450 goto no_value; 21454 goto no_value;
21451 /* But do forget it, if the window shows a different buffer now. */ 21455 /* But do forget it, if the window shows a different buffer now. */
21452 else if (BUFFERP (w->base_line_pos)) 21456 else if (BUFFERP (WVAR (w, base_line_pos)))
21453 w->base_line_pos = Qnil; 21457 WVAR (w, base_line_pos) = Qnil;
21454 21458
21455 /* If the buffer is very big, don't waste time. */ 21459 /* If the buffer is very big, don't waste time. */
21456 if (INTEGERP (Vline_number_display_limit) 21460 if (INTEGERP (Vline_number_display_limit)
21457 && BUF_ZV (b) - BUF_BEGV (b) > XINT (Vline_number_display_limit)) 21461 && BUF_ZV (b) - BUF_BEGV (b) > XINT (Vline_number_display_limit))
21458 { 21462 {
21459 w->base_line_pos = Qnil; 21463 WVAR (w, base_line_pos) = Qnil;
21460 w->base_line_number = Qnil; 21464 WVAR (w, base_line_number) = Qnil;
21461 goto no_value; 21465 goto no_value;
21462 } 21466 }
21463 21467
21464 if (INTEGERP (w->base_line_number) 21468 if (INTEGERP (WVAR (w, base_line_number))
21465 && INTEGERP (w->base_line_pos) 21469 && INTEGERP (WVAR (w, base_line_pos))
21466 && XFASTINT (w->base_line_pos) <= startpos) 21470 && XFASTINT (WVAR (w, base_line_pos)) <= startpos)
21467 { 21471 {
21468 line = XFASTINT (w->base_line_number); 21472 line = XFASTINT (WVAR (w, base_line_number));
21469 linepos = XFASTINT (w->base_line_pos); 21473 linepos = XFASTINT (WVAR (w, base_line_pos));
21470 linepos_byte = buf_charpos_to_bytepos (b, linepos); 21474 linepos_byte = buf_charpos_to_bytepos (b, linepos);
21471 } 21475 }
21472 else 21476 else
@@ -21489,8 +21493,8 @@ decode_mode_spec (struct window *w, register int c, int field_width,
21489 go back past it. */ 21493 go back past it. */
21490 if (startpos == BUF_BEGV (b)) 21494 if (startpos == BUF_BEGV (b))
21491 { 21495 {
21492 w->base_line_number = make_number (topline); 21496 WVAR (w, base_line_number) = make_number (topline);
21493 w->base_line_pos = make_number (BUF_BEGV (b)); 21497 WVAR (w, base_line_pos) = make_number (BUF_BEGV (b));
21494 } 21498 }
21495 else if (nlines < height + 25 || nlines > height * 3 + 50 21499 else if (nlines < height + 25 || nlines > height * 3 + 50
21496 || linepos == BUF_BEGV (b)) 21500 || linepos == BUF_BEGV (b))
@@ -21516,13 +21520,13 @@ decode_mode_spec (struct window *w, register int c, int field_width,
21516 give up on line numbers for this window. */ 21520 give up on line numbers for this window. */
21517 if (position == limit_byte && limit == startpos - distance) 21521 if (position == limit_byte && limit == startpos - distance)
21518 { 21522 {
21519 w->base_line_pos = w->buffer; 21523 WVAR (w, base_line_pos) = WVAR (w, buffer);
21520 w->base_line_number = Qnil; 21524 WVAR (w, base_line_number) = Qnil;
21521 goto no_value; 21525 goto no_value;
21522 } 21526 }
21523 21527
21524 w->base_line_number = make_number (topline - nlines); 21528 WVAR (w, base_line_number) = make_number (topline - nlines);
21525 w->base_line_pos = make_number (BYTE_TO_CHAR (position)); 21529 WVAR (w, base_line_pos) = make_number (BYTE_TO_CHAR (position));
21526 } 21530 }
21527 21531
21528 /* Now count lines from the start pos to point. */ 21532 /* Now count lines from the start pos to point. */
@@ -21560,10 +21564,10 @@ decode_mode_spec (struct window *w, register int c, int field_width,
21560 21564
21561 case 'p': 21565 case 'p':
21562 { 21566 {
21563 ptrdiff_t pos = marker_position (w->start); 21567 ptrdiff_t pos = marker_position (WVAR (w, start));
21564 ptrdiff_t total = BUF_ZV (b) - BUF_BEGV (b); 21568 ptrdiff_t total = BUF_ZV (b) - BUF_BEGV (b);
21565 21569
21566 if (XFASTINT (w->window_end_pos) <= BUF_Z (b) - BUF_ZV (b)) 21570 if (XFASTINT (WVAR (w, window_end_pos)) <= BUF_Z (b) - BUF_ZV (b))
21567 { 21571 {
21568 if (pos <= BUF_BEGV (b)) 21572 if (pos <= BUF_BEGV (b))
21569 return "All"; 21573 return "All";
@@ -21591,8 +21595,8 @@ decode_mode_spec (struct window *w, register int c, int field_width,
21591 /* Display percentage of size above the bottom of the screen. */ 21595 /* Display percentage of size above the bottom of the screen. */
21592 case 'P': 21596 case 'P':
21593 { 21597 {
21594 ptrdiff_t toppos = marker_position (w->start); 21598 ptrdiff_t toppos = marker_position (WVAR (w, start));
21595 ptrdiff_t botpos = BUF_Z (b) - XFASTINT (w->window_end_pos); 21599 ptrdiff_t botpos = BUF_Z (b) - XFASTINT (WVAR (w, window_end_pos));
21596 ptrdiff_t total = BUF_ZV (b) - BUF_BEGV (b); 21600 ptrdiff_t total = BUF_ZV (b) - BUF_BEGV (b);
21597 21601
21598 if (botpos >= BUF_ZV (b)) 21602 if (botpos >= BUF_ZV (b))
@@ -22299,7 +22303,7 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
22299 return OK_PIXELS (WINDOW_SCROLL_BAR_AREA_WIDTH (it->w)); 22303 return OK_PIXELS (WINDOW_SCROLL_BAR_AREA_WIDTH (it->w));
22300 } 22304 }
22301 22305
22302 prop = buffer_local_value_1 (prop, it->w->buffer); 22306 prop = buffer_local_value_1 (prop, WVAR (it->w, buffer));
22303 if (EQ (prop, Qunbound)) 22307 if (EQ (prop, Qunbound))
22304 prop = Qnil; 22308 prop = Qnil;
22305 } 22309 }
@@ -22351,7 +22355,7 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
22351 return OK_PIXELS (pixels); 22355 return OK_PIXELS (pixels);
22352 } 22356 }
22353 22357
22354 car = buffer_local_value_1 (car, it->w->buffer); 22358 car = buffer_local_value_1 (car, WVAR (it->w, buffer));
22355 if (EQ (car, Qunbound)) 22359 if (EQ (car, Qunbound))
22356 car = Qnil; 22360 car = Qnil;
22357 } 22361 }
@@ -22432,7 +22436,7 @@ init_glyph_string (struct glyph_string *s,
22432{ 22436{
22433 memset (s, 0, sizeof *s); 22437 memset (s, 0, sizeof *s);
22434 s->w = w; 22438 s->w = w;
22435 s->f = XFRAME (w->frame); 22439 s->f = XFRAME (WVAR (w, frame));
22436#ifdef HAVE_NTGUI 22440#ifdef HAVE_NTGUI
22437 s->hdc = hdc; 22441 s->hdc = hdc;
22438#endif 22442#endif
@@ -22764,7 +22768,7 @@ fill_glyph_string (struct glyph_string *s, int face_id,
22764 int voffset; 22768 int voffset;
22765 int glyph_not_available_p; 22769 int glyph_not_available_p;
22766 22770
22767 eassert (s->f == XFRAME (s->w->frame)); 22771 eassert (s->f == XFRAME (WVAR (s->w, frame)));
22768 eassert (s->nchars == 0); 22772 eassert (s->nchars == 0);
22769 eassert (start >= 0 && end > start); 22773 eassert (start >= 0 && end > start);
22770 22774
@@ -24159,7 +24163,7 @@ produce_stretch_glyph (struct it *it)
24159 int n = width; 24163 int n = width;
24160 24164
24161 if (!STRINGP (object)) 24165 if (!STRINGP (object))
24162 object = it->w->buffer; 24166 object = WVAR (it->w, buffer);
24163#ifdef HAVE_WINDOW_SYSTEM 24167#ifdef HAVE_WINDOW_SYSTEM
24164 if (FRAME_WINDOW_P (it->f)) 24168 if (FRAME_WINDOW_P (it->f))
24165 append_stretch_glyph (it, object, width, height, ascent); 24169 append_stretch_glyph (it, object, width, height, ascent);
@@ -25386,7 +25390,7 @@ x_clear_end_of_line (int to_x)
25386 int from_x, from_y, to_y; 25390 int from_x, from_y, to_y;
25387 25391
25388 eassert (updated_window && updated_row); 25392 eassert (updated_window && updated_row);
25389 f = XFRAME (w->frame); 25393 f = XFRAME (WVAR (w, frame));
25390 25394
25391 if (updated_row->full_width_p) 25395 if (updated_row->full_width_p)
25392 max_x = WINDOW_TOTAL_WIDTH (w); 25396 max_x = WINDOW_TOTAL_WIDTH (w);
@@ -25544,8 +25548,8 @@ static enum text_cursor_kinds
25544get_window_cursor_type (struct window *w, struct glyph *glyph, int *width, 25548get_window_cursor_type (struct window *w, struct glyph *glyph, int *width,
25545 int *active_cursor) 25549 int *active_cursor)
25546{ 25550{
25547 struct frame *f = XFRAME (w->frame); 25551 struct frame *f = XFRAME (WVAR (w, frame));
25548 struct buffer *b = XBUFFER (w->buffer); 25552 struct buffer *b = XBUFFER (WVAR (w, buffer));
25549 int cursor_type = DEFAULT_CURSOR; 25553 int cursor_type = DEFAULT_CURSOR;
25550 Lisp_Object alt_cursor; 25554 Lisp_Object alt_cursor;
25551 int non_selected = 0; 25555 int non_selected = 0;
@@ -25856,7 +25860,7 @@ draw_phys_cursor_glyph (struct window *w, struct glyph_row *row,
25856void 25860void
25857erase_phys_cursor (struct window *w) 25861erase_phys_cursor (struct window *w)
25858{ 25862{
25859 struct frame *f = XFRAME (w->frame); 25863 struct frame *f = XFRAME (WVAR (w, frame));
25860 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); 25864 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
25861 int hpos = w->phys_cursor.hpos; 25865 int hpos = w->phys_cursor.hpos;
25862 int vpos = w->phys_cursor.vpos; 25866 int vpos = w->phys_cursor.vpos;
@@ -25975,7 +25979,7 @@ void
25975display_and_set_cursor (struct window *w, int on, 25979display_and_set_cursor (struct window *w, int on,
25976 int hpos, int vpos, int x, int y) 25980 int hpos, int vpos, int x, int y)
25977{ 25981{
25978 struct frame *f = XFRAME (w->frame); 25982 struct frame *f = XFRAME (WVAR (w, frame));
25979 int new_cursor_type; 25983 int new_cursor_type;
25980 int new_cursor_width; 25984 int new_cursor_width;
25981 int active_cursor; 25985 int active_cursor;
@@ -26096,14 +26100,14 @@ update_cursor_in_window_tree (struct window *w, int on_p)
26096{ 26100{
26097 while (w) 26101 while (w)
26098 { 26102 {
26099 if (!NILP (w->hchild)) 26103 if (!NILP (WVAR (w, hchild)))
26100 update_cursor_in_window_tree (XWINDOW (w->hchild), on_p); 26104 update_cursor_in_window_tree (XWINDOW (WVAR (w, hchild)), on_p);
26101 else if (!NILP (w->vchild)) 26105 else if (!NILP (WVAR (w, vchild)))
26102 update_cursor_in_window_tree (XWINDOW (w->vchild), on_p); 26106 update_cursor_in_window_tree (XWINDOW (WVAR (w, vchild)), on_p);
26103 else 26107 else
26104 update_window_cursor (w, on_p); 26108 update_window_cursor (w, on_p);
26105 26109
26106 w = NILP (w->next) ? 0 : XWINDOW (w->next); 26110 w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next));
26107 } 26111 }
26108} 26112}
26109 26113
@@ -26127,7 +26131,7 @@ x_update_cursor (struct frame *f, int on_p)
26127void 26131void
26128x_clear_cursor (struct window *w) 26132x_clear_cursor (struct window *w)
26129{ 26133{
26130 if (FRAME_VISIBLE_P (XFRAME (w->frame)) && w->phys_cursor_on_p) 26134 if (FRAME_VISIBLE_P (XFRAME (WVAR (w, frame))) && w->phys_cursor_on_p)
26131 update_window_cursor (w, 0); 26135 update_window_cursor (w, 0);
26132} 26136}
26133 26137
@@ -26141,7 +26145,7 @@ draw_row_with_mouse_face (struct window *w, int start_x, struct glyph_row *row,
26141 enum draw_glyphs_face draw) 26145 enum draw_glyphs_face draw)
26142{ 26146{
26143#ifdef HAVE_WINDOW_SYSTEM 26147#ifdef HAVE_WINDOW_SYSTEM
26144 if (FRAME_WINDOW_P (XFRAME (w->frame))) 26148 if (FRAME_WINDOW_P (XFRAME (WVAR (w, frame))))
26145 { 26149 {
26146 draw_glyphs (w, start_x, row, TEXT_AREA, start_hpos, end_hpos, draw, 0); 26150 draw_glyphs (w, start_x, row, TEXT_AREA, start_hpos, end_hpos, draw, 0);
26147 return; 26151 return;
@@ -26312,7 +26316,7 @@ clear_mouse_face (Mouse_HLInfo *hlinfo)
26312static int 26316static int
26313coords_in_mouse_face_p (struct window *w, int hpos, int vpos) 26317coords_in_mouse_face_p (struct window *w, int hpos, int vpos)
26314{ 26318{
26315 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); 26319 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (WVAR (w, frame)));
26316 26320
26317 /* Quickly resolve the easy cases. */ 26321 /* Quickly resolve the easy cases. */
26318 if (!(WINDOWP (hlinfo->mouse_face_window) 26322 if (!(WINDOWP (hlinfo->mouse_face_window)
@@ -26564,7 +26568,7 @@ mouse_face_from_buffer_pos (Lisp_Object window,
26564 /* Find the rows corresponding to START_CHARPOS and END_CHARPOS. */ 26568 /* Find the rows corresponding to START_CHARPOS and END_CHARPOS. */
26565 rows_from_pos_range (w, start_charpos, end_charpos, disp_string, &r1, &r2); 26569 rows_from_pos_range (w, start_charpos, end_charpos, disp_string, &r1, &r2);
26566 if (r1 == NULL) 26570 if (r1 == NULL)
26567 r1 = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); 26571 r1 = MATRIX_ROW (w->current_matrix, XFASTINT (WVAR (w, window_end_vpos)));
26568 /* If the before-string or display-string contains newlines, 26572 /* If the before-string or display-string contains newlines,
26569 rows_from_pos_range skips to its last row. Move back. */ 26573 rows_from_pos_range skips to its last row. Move back. */
26570 if (!NILP (before_string) || !NILP (disp_string)) 26574 if (!NILP (before_string) || !NILP (disp_string))
@@ -26586,7 +26590,7 @@ mouse_face_from_buffer_pos (Lisp_Object window,
26586 } 26590 }
26587 if (r2 == NULL) 26591 if (r2 == NULL)
26588 { 26592 {
26589 r2 = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); 26593 r2 = MATRIX_ROW (w->current_matrix, XFASTINT (WVAR (w, window_end_vpos)));
26590 hlinfo->mouse_face_past_end = 1; 26594 hlinfo->mouse_face_past_end = 1;
26591 } 26595 }
26592 else if (!NILP (after_string)) 26596 else if (!NILP (after_string))
@@ -26594,7 +26598,7 @@ mouse_face_from_buffer_pos (Lisp_Object window,
26594 /* If the after-string has newlines, advance to its last row. */ 26598 /* If the after-string has newlines, advance to its last row. */
26595 struct glyph_row *next; 26599 struct glyph_row *next;
26596 struct glyph_row *last 26600 struct glyph_row *last
26597 = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); 26601 = MATRIX_ROW (w->current_matrix, XFASTINT (WVAR (w, window_end_vpos)));
26598 26602
26599 for (next = r2 + 1; 26603 for (next = r2 + 1;
26600 next <= last 26604 next <= last
@@ -27259,7 +27263,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
27259 enum window_part area) 27263 enum window_part area)
27260{ 27264{
27261 struct window *w = XWINDOW (window); 27265 struct window *w = XWINDOW (window);
27262 struct frame *f = XFRAME (w->frame); 27266 struct frame *f = XFRAME (WVAR (w, frame));
27263 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); 27267 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
27264#ifdef HAVE_WINDOW_SYSTEM 27268#ifdef HAVE_WINDOW_SYSTEM
27265 Display_Info *dpyinfo; 27269 Display_Info *dpyinfo;
@@ -27343,7 +27347,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
27343 { 27347 {
27344 help_echo_string = help; 27348 help_echo_string = help;
27345 XSETWINDOW (help_echo_window, w); 27349 XSETWINDOW (help_echo_window, w);
27346 help_echo_object = w->buffer; 27350 help_echo_object = WVAR (w, buffer);
27347 help_echo_pos = charpos; 27351 help_echo_pos = charpos;
27348 } 27352 }
27349 } 27353 }
@@ -27379,7 +27383,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
27379 { 27383 {
27380 Lisp_Object default_help 27384 Lisp_Object default_help
27381 = buffer_local_value_1 (Qmode_line_default_help_echo, 27385 = buffer_local_value_1 (Qmode_line_default_help_echo,
27382 w->buffer); 27386 WVAR (w, buffer));
27383 27387
27384 if (STRINGP (default_help)) 27388 if (STRINGP (default_help))
27385 { 27389 {
@@ -27660,9 +27664,9 @@ note_mouse_highlight (struct frame *f, int x, int y)
27660 27664
27661 /* Are we in a window whose display is up to date? 27665 /* Are we in a window whose display is up to date?
27662 And verify the buffer's text has not changed. */ 27666 And verify the buffer's text has not changed. */
27663 b = XBUFFER (w->buffer); 27667 b = XBUFFER (WVAR (w, buffer));
27664 if (part == ON_TEXT 27668 if (part == ON_TEXT
27665 && EQ (w->window_end_valid, w->buffer) 27669 && EQ (WVAR (w, window_end_valid), WVAR (w, buffer))
27666 && w->last_modified == BUF_MODIFF (b) 27670 && w->last_modified == BUF_MODIFF (b)
27667 && w->last_overlay_modified == BUF_OVERLAY_MODIFF (b)) 27671 && w->last_overlay_modified == BUF_OVERLAY_MODIFF (b))
27668 { 27672 {
@@ -27869,8 +27873,8 @@ note_mouse_highlight (struct frame *f, int x, int y)
27869 if (pos > 0) 27873 if (pos > 0)
27870 { 27874 {
27871 mouse_face = get_char_property_and_overlay 27875 mouse_face = get_char_property_and_overlay
27872 (make_number (pos), Qmouse_face, w->buffer, &overlay); 27876 (make_number (pos), Qmouse_face, WVAR (w, buffer), &overlay);
27873 buffer = w->buffer; 27877 buffer = WVAR (w, buffer);
27874 disp_string = object; 27878 disp_string = object;
27875 } 27879 }
27876 } 27880 }
@@ -27896,12 +27900,12 @@ note_mouse_highlight (struct frame *f, int x, int y)
27896 is the smallest. */ 27900 is the smallest. */
27897 Lisp_Object lim1 = 27901 Lisp_Object lim1 =
27898 NILP (BVAR (XBUFFER (buffer), bidi_display_reordering)) 27902 NILP (BVAR (XBUFFER (buffer), bidi_display_reordering))
27899 ? Fmarker_position (w->start) 27903 ? Fmarker_position (WVAR (w, start))
27900 : Qnil; 27904 : Qnil;
27901 Lisp_Object lim2 = 27905 Lisp_Object lim2 =
27902 NILP (BVAR (XBUFFER (buffer), bidi_display_reordering)) 27906 NILP (BVAR (XBUFFER (buffer), bidi_display_reordering))
27903 ? make_number (BUF_Z (XBUFFER (buffer)) 27907 ? make_number (BUF_Z (XBUFFER (buffer))
27904 - XFASTINT (w->window_end_pos)) 27908 - XFASTINT (WVAR (w, window_end_pos)))
27905 : Qnil; 27909 : Qnil;
27906 27910
27907 if (NILP (overlay)) 27911 if (NILP (overlay))
@@ -27983,11 +27987,11 @@ note_mouse_highlight (struct frame *f, int x, int y)
27983 if (p > 0) 27987 if (p > 0)
27984 { 27988 {
27985 help = Fget_char_property (make_number (p), 27989 help = Fget_char_property (make_number (p),
27986 Qhelp_echo, w->buffer); 27990 Qhelp_echo, WVAR (w, buffer));
27987 if (!NILP (help)) 27991 if (!NILP (help))
27988 { 27992 {
27989 charpos = p; 27993 charpos = p;
27990 obj = w->buffer; 27994 obj = WVAR (w, buffer);
27991 } 27995 }
27992 } 27996 }
27993 } 27997 }
@@ -28038,7 +28042,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
28038 ptrdiff_t p = string_buffer_position (obj, start); 28042 ptrdiff_t p = string_buffer_position (obj, start);
28039 if (p > 0) 28043 if (p > 0)
28040 pointer = Fget_char_property (make_number (p), 28044 pointer = Fget_char_property (make_number (p),
28041 Qpointer, w->buffer); 28045 Qpointer, WVAR (w, buffer));
28042 } 28046 }
28043 } 28047 }
28044 else if (BUFFERP (obj) 28048 else if (BUFFERP (obj)
@@ -28076,7 +28080,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
28076void 28080void
28077x_clear_window_mouse_face (struct window *w) 28081x_clear_window_mouse_face (struct window *w)
28078{ 28082{
28079 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); 28083 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (WVAR (w, frame)));
28080 Lisp_Object window; 28084 Lisp_Object window;
28081 28085
28082 BLOCK_INPUT; 28086 BLOCK_INPUT;
@@ -28098,7 +28102,7 @@ cancel_mouse_face (struct frame *f)
28098 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); 28102 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
28099 28103
28100 window = hlinfo->mouse_face_window; 28104 window = hlinfo->mouse_face_window;
28101 if (! NILP (window) && XFRAME (XWINDOW (window)->frame) == f) 28105 if (! NILP (window) && XFRAME (WVAR (XWINDOW (window), frame)) == f)
28102 { 28106 {
28103 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; 28107 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
28104 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; 28108 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
@@ -28292,7 +28296,7 @@ x_draw_vertical_border (struct window *w)
28292 do it for frames with vertical scroll bars because either the 28296 do it for frames with vertical scroll bars because either the
28293 right scroll bar of a window, or the left scroll bar of its 28297 right scroll bar of a window, or the left scroll bar of its
28294 neighbor will suffice as a border. */ 28298 neighbor will suffice as a border. */
28295 if (FRAME_HAS_VERTICAL_SCROLL_BARS (XFRAME (w->frame))) 28299 if (FRAME_HAS_VERTICAL_SCROLL_BARS (XFRAME (WVAR (w, frame))))
28296 return; 28300 return;
28297 28301
28298 if (!WINDOW_RIGHTMOST_P (w) 28302 if (!WINDOW_RIGHTMOST_P (w)
@@ -28332,7 +28336,7 @@ x_draw_vertical_border (struct window *w)
28332static int 28336static int
28333expose_window (struct window *w, XRectangle *fr) 28337expose_window (struct window *w, XRectangle *fr)
28334{ 28338{
28335 struct frame *f = XFRAME (w->frame); 28339 struct frame *f = XFRAME (WVAR (w, frame));
28336 XRectangle wr, r; 28340 XRectangle wr, r;
28337 int mouse_face_overwritten_p = 0; 28341 int mouse_face_overwritten_p = 0;
28338 28342
@@ -28473,21 +28477,21 @@ expose_window (struct window *w, XRectangle *fr)
28473static int 28477static int
28474expose_window_tree (struct window *w, XRectangle *r) 28478expose_window_tree (struct window *w, XRectangle *r)
28475{ 28479{
28476 struct frame *f = XFRAME (w->frame); 28480 struct frame *f = XFRAME (WVAR (w, frame));
28477 int mouse_face_overwritten_p = 0; 28481 int mouse_face_overwritten_p = 0;
28478 28482
28479 while (w && !FRAME_GARBAGED_P (f)) 28483 while (w && !FRAME_GARBAGED_P (f))
28480 { 28484 {
28481 if (!NILP (w->hchild)) 28485 if (!NILP (WVAR (w, hchild)))
28482 mouse_face_overwritten_p 28486 mouse_face_overwritten_p
28483 |= expose_window_tree (XWINDOW (w->hchild), r); 28487 |= expose_window_tree (XWINDOW (WVAR (w, hchild)), r);
28484 else if (!NILP (w->vchild)) 28488 else if (!NILP (WVAR (w, vchild)))
28485 mouse_face_overwritten_p 28489 mouse_face_overwritten_p
28486 |= expose_window_tree (XWINDOW (w->vchild), r); 28490 |= expose_window_tree (XWINDOW (WVAR (w, vchild)), r);
28487 else 28491 else
28488 mouse_face_overwritten_p |= expose_window (w, r); 28492 mouse_face_overwritten_p |= expose_window (w, r);
28489 28493
28490 w = NILP (w->next) ? NULL : XWINDOW (w->next); 28494 w = NILP (WVAR (w, next)) ? NULL : XWINDOW (WVAR (w, next));
28491 } 28495 }
28492 28496
28493 return mouse_face_overwritten_p; 28497 return mouse_face_overwritten_p;
@@ -29279,7 +29283,7 @@ init_xdisp (void)
29279 if (!noninteractive) 29283 if (!noninteractive)
29280 { 29284 {
29281 struct window *m = XWINDOW (minibuf_window); 29285 struct window *m = XWINDOW (minibuf_window);
29282 Lisp_Object frame = m->frame; 29286 Lisp_Object frame = WVAR (m, frame);
29283 struct frame *f = XFRAME (frame); 29287 struct frame *f = XFRAME (frame);
29284 Lisp_Object root = FRAME_ROOT_WINDOW (f); 29288 Lisp_Object root = FRAME_ROOT_WINDOW (f);
29285 struct window *r = XWINDOW (root); 29289 struct window *r = XWINDOW (root);
@@ -29287,12 +29291,12 @@ init_xdisp (void)
29287 29291
29288 echo_area_window = minibuf_window; 29292 echo_area_window = minibuf_window;
29289 29293
29290 XSETFASTINT (r->top_line, FRAME_TOP_MARGIN (f)); 29294 XSETFASTINT (WVAR (r, top_line), FRAME_TOP_MARGIN (f));
29291 XSETFASTINT (r->total_lines, FRAME_LINES (f) - 1 - FRAME_TOP_MARGIN (f)); 29295 XSETFASTINT (WVAR (r, total_lines), FRAME_LINES (f) - 1 - FRAME_TOP_MARGIN (f));
29292 XSETFASTINT (r->total_cols, FRAME_COLS (f)); 29296 XSETFASTINT (WVAR (r, total_cols), FRAME_COLS (f));
29293 XSETFASTINT (m->top_line, FRAME_LINES (f) - 1); 29297 XSETFASTINT (WVAR (m, top_line), FRAME_LINES (f) - 1);
29294 XSETFASTINT (m->total_lines, 1); 29298 XSETFASTINT (WVAR (m, total_lines), 1);
29295 XSETFASTINT (m->total_cols, FRAME_COLS (f)); 29299 XSETFASTINT (WVAR (m, total_cols), FRAME_COLS (f));
29296 29300
29297 scratch_glyph_row.glyphs[TEXT_AREA] = scratch_glyphs; 29301 scratch_glyph_row.glyphs[TEXT_AREA] = scratch_glyphs;
29298 scratch_glyph_row.glyphs[TEXT_AREA + 1] 29302 scratch_glyph_row.glyphs[TEXT_AREA + 1]
diff --git a/src/xfaces.c b/src/xfaces.c
index 3d5ea9e1152..b92e0c82173 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -6031,7 +6031,7 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos,
6031 ptrdiff_t *endptr, ptrdiff_t limit, 6031 ptrdiff_t *endptr, ptrdiff_t limit,
6032 int mouse, int base_face_id) 6032 int mouse, int base_face_id)
6033{ 6033{
6034 struct frame *f = XFRAME (w->frame); 6034 struct frame *f = XFRAME (WVAR (w, frame));
6035 Lisp_Object attrs[LFACE_VECTOR_SIZE]; 6035 Lisp_Object attrs[LFACE_VECTOR_SIZE];
6036 Lisp_Object prop, position; 6036 Lisp_Object prop, position;
6037 ptrdiff_t i, noverlays; 6037 ptrdiff_t i, noverlays;
@@ -6055,9 +6055,9 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos,
6055 6055
6056 /* Get the `face' or `mouse_face' text property at POS, and 6056 /* Get the `face' or `mouse_face' text property at POS, and
6057 determine the next position at which the property changes. */ 6057 determine the next position at which the property changes. */
6058 prop = Fget_text_property (position, propname, w->buffer); 6058 prop = Fget_text_property (position, propname, WVAR (w, buffer));
6059 XSETFASTINT (limit1, (limit < endpos ? limit : endpos)); 6059 XSETFASTINT (limit1, (limit < endpos ? limit : endpos));
6060 end = Fnext_single_property_change (position, propname, w->buffer, limit1); 6060 end = Fnext_single_property_change (position, propname, WVAR (w, buffer), limit1);
6061 if (INTEGERP (end)) 6061 if (INTEGERP (end))
6062 endpos = XINT (end); 6062 endpos = XINT (end);
6063 6063
@@ -6143,7 +6143,7 @@ face_for_overlay_string (struct window *w, ptrdiff_t pos,
6143 ptrdiff_t *endptr, ptrdiff_t limit, 6143 ptrdiff_t *endptr, ptrdiff_t limit,
6144 int mouse, Lisp_Object overlay) 6144 int mouse, Lisp_Object overlay)
6145{ 6145{
6146 struct frame *f = XFRAME (w->frame); 6146 struct frame *f = XFRAME (WVAR (w, frame));
6147 Lisp_Object attrs[LFACE_VECTOR_SIZE]; 6147 Lisp_Object attrs[LFACE_VECTOR_SIZE];
6148 Lisp_Object prop, position; 6148 Lisp_Object prop, position;
6149 Lisp_Object frame; 6149 Lisp_Object frame;
@@ -6165,9 +6165,9 @@ face_for_overlay_string (struct window *w, ptrdiff_t pos,
6165 6165
6166 /* Get the `face' or `mouse_face' text property at POS, and 6166 /* Get the `face' or `mouse_face' text property at POS, and
6167 determine the next position at which the property changes. */ 6167 determine the next position at which the property changes. */
6168 prop = Fget_text_property (position, propname, w->buffer); 6168 prop = Fget_text_property (position, propname, WVAR (w, buffer));
6169 XSETFASTINT (limit1, (limit < endpos ? limit : endpos)); 6169 XSETFASTINT (limit1, (limit < endpos ? limit : endpos));
6170 end = Fnext_single_property_change (position, propname, w->buffer, limit1); 6170 end = Fnext_single_property_change (position, propname, WVAR (w, buffer), limit1);
6171 if (INTEGERP (end)) 6171 if (INTEGERP (end))
6172 endpos = XINT (end); 6172 endpos = XINT (end);
6173 6173
diff --git a/src/xfns.c b/src/xfns.c
index da7f6067a96..df66cbe1ab4 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -2260,7 +2260,7 @@ free_frame_xic (struct frame *f)
2260void 2260void
2261xic_set_preeditarea (struct window *w, int x, int y) 2261xic_set_preeditarea (struct window *w, int x, int y)
2262{ 2262{
2263 struct frame *f = XFRAME (w->frame); 2263 struct frame *f = XFRAME (WVAR (w, frame));
2264 XVaNestedList attr; 2264 XVaNestedList attr;
2265 XPoint spot; 2265 XPoint spot;
2266 2266
@@ -5069,28 +5069,28 @@ Text larger than the specified size is clipped. */)
5069 5069
5070 /* Set up the frame's root window. */ 5070 /* Set up the frame's root window. */
5071 w = XWINDOW (FRAME_ROOT_WINDOW (f)); 5071 w = XWINDOW (FRAME_ROOT_WINDOW (f));
5072 w->left_col = w->top_line = make_number (0); 5072 WVAR (w, left_col) = WVAR (w, top_line) = make_number (0);
5073 5073
5074 if (CONSP (Vx_max_tooltip_size) 5074 if (CONSP (Vx_max_tooltip_size)
5075 && RANGED_INTEGERP (1, XCAR (Vx_max_tooltip_size), INT_MAX) 5075 && RANGED_INTEGERP (1, XCAR (Vx_max_tooltip_size), INT_MAX)
5076 && RANGED_INTEGERP (1, XCDR (Vx_max_tooltip_size), INT_MAX)) 5076 && RANGED_INTEGERP (1, XCDR (Vx_max_tooltip_size), INT_MAX))
5077 { 5077 {
5078 w->total_cols = XCAR (Vx_max_tooltip_size); 5078 WVAR (w, total_cols) = XCAR (Vx_max_tooltip_size);
5079 w->total_lines = XCDR (Vx_max_tooltip_size); 5079 WVAR (w, total_lines) = XCDR (Vx_max_tooltip_size);
5080 } 5080 }
5081 else 5081 else
5082 { 5082 {
5083 w->total_cols = make_number (80); 5083 WVAR (w, total_cols) = make_number (80);
5084 w->total_lines = make_number (40); 5084 WVAR (w, total_lines) = make_number (40);
5085 } 5085 }
5086 5086
5087 FRAME_TOTAL_COLS (f) = XINT (w->total_cols); 5087 FRAME_TOTAL_COLS (f) = XINT (WVAR (w, total_cols));
5088 adjust_glyphs (f); 5088 adjust_glyphs (f);
5089 w->pseudo_window_p = 1; 5089 w->pseudo_window_p = 1;
5090 5090
5091 /* Display the tooltip text in a temporary buffer. */ 5091 /* Display the tooltip text in a temporary buffer. */
5092 old_buffer = current_buffer; 5092 old_buffer = current_buffer;
5093 set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); 5093 set_buffer_internal_1 (XBUFFER (WVAR (XWINDOW (FRAME_ROOT_WINDOW (f)), buffer)));
5094 BVAR (current_buffer, truncate_lines) = Qnil; 5094 BVAR (current_buffer, truncate_lines) = Qnil;
5095 clear_glyph_matrix (w->desired_matrix); 5095 clear_glyph_matrix (w->desired_matrix);
5096 clear_glyph_matrix (w->current_matrix); 5096 clear_glyph_matrix (w->current_matrix);
@@ -5151,7 +5151,7 @@ Text larger than the specified size is clipped. */)
5151 /* w->total_cols and FRAME_TOTAL_COLS want the width in columns, 5151 /* w->total_cols and FRAME_TOTAL_COLS want the width in columns,
5152 not in pixels. */ 5152 not in pixels. */
5153 width /= WINDOW_FRAME_COLUMN_WIDTH (w); 5153 width /= WINDOW_FRAME_COLUMN_WIDTH (w);
5154 w->total_cols = make_number (width); 5154 WVAR (w, total_cols) = make_number (width);
5155 FRAME_TOTAL_COLS (f) = width; 5155 FRAME_TOTAL_COLS (f) = width;
5156 adjust_glyphs (f); 5156 adjust_glyphs (f);
5157 clear_glyph_matrix (w->desired_matrix); 5157 clear_glyph_matrix (w->desired_matrix);
diff --git a/src/xmenu.c b/src/xmenu.c
index d1b3198cc80..e68245ba379 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -985,7 +985,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
985 if (! menubar_widget) 985 if (! menubar_widget)
986 previous_menu_items_used = 0; 986 previous_menu_items_used = 0;
987 987
988 buffer = XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer; 988 buffer = WVAR (XWINDOW (FRAME_SELECTED_WINDOW (f)), buffer);
989 specbind (Qinhibit_quit, Qt); 989 specbind (Qinhibit_quit, Qt);
990 /* Don't let the debugger step into this code 990 /* Don't let the debugger step into this code
991 because it is not reentrant. */ 991 because it is not reentrant. */
diff --git a/src/xterm.c b/src/xterm.c
index 0f386b6b6a4..e4023f9de76 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -628,7 +628,7 @@ x_draw_vertical_window_border (struct window *w, int x, int y0, int y1)
628static void 628static void
629x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritten_p) 629x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritten_p)
630{ 630{
631 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); 631 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (WVAR (w, frame)));
632 632
633 if (!w->pseudo_window_p) 633 if (!w->pseudo_window_p)
634 { 634 {
@@ -728,7 +728,7 @@ x_after_update_window_line (struct glyph_row *desired_row)
728 overhead is very small. */ 728 overhead is very small. */
729 if (windows_or_buffers_changed 729 if (windows_or_buffers_changed
730 && desired_row->full_width_p 730 && desired_row->full_width_p
731 && (f = XFRAME (w->frame), 731 && (f = XFRAME (WVAR (w, frame)),
732 width = FRAME_INTERNAL_BORDER_WIDTH (f), 732 width = FRAME_INTERNAL_BORDER_WIDTH (f),
733 width != 0) 733 width != 0)
734 && (height = desired_row->visible_height, 734 && (height = desired_row->visible_height,
@@ -3295,7 +3295,7 @@ x_ins_del_lines (struct frame *f, int vpos, int n)
3295static void 3295static void
3296x_scroll_run (struct window *w, struct run *run) 3296x_scroll_run (struct window *w, struct run *run)
3297{ 3297{
3298 struct frame *f = XFRAME (w->frame); 3298 struct frame *f = XFRAME (WVAR (w, frame));
3299 int x, y, width, height, from_y, to_y, bottom_y; 3299 int x, y, width, height, from_y, to_y, bottom_y;
3300 3300
3301 /* Get frame-relative bounding box of the text display area of W, 3301 /* Get frame-relative bounding box of the text display area of W,
@@ -4244,9 +4244,9 @@ xt_action_hook (Widget widget, XtPointer client_data, String action_name,
4244 scroll_bar_end_scroll, 0, 0); 4244 scroll_bar_end_scroll, 0, 0);
4245 w = XWINDOW (window_being_scrolled); 4245 w = XWINDOW (window_being_scrolled);
4246 4246
4247 if (!NILP (XSCROLL_BAR (w->vertical_scroll_bar)->dragging)) 4247 if (!NILP (XSCROLL_BAR (WVAR (w, vertical_scroll_bar))->dragging))
4248 { 4248 {
4249 XSCROLL_BAR (w->vertical_scroll_bar)->dragging = Qnil; 4249 XSCROLL_BAR (WVAR (w, vertical_scroll_bar))->dragging = Qnil;
4250 /* The thumb size is incorrect while dragging: fix it. */ 4250 /* The thumb size is incorrect while dragging: fix it. */
4251 set_vertical_scroll_bar (w); 4251 set_vertical_scroll_bar (w);
4252 } 4252 }
@@ -4277,7 +4277,7 @@ x_send_scroll_bar_event (Lisp_Object window, int part, int portion, int whole)
4277 XEvent event; 4277 XEvent event;
4278 XClientMessageEvent *ev = (XClientMessageEvent *) &event; 4278 XClientMessageEvent *ev = (XClientMessageEvent *) &event;
4279 struct window *w = XWINDOW (window); 4279 struct window *w = XWINDOW (window);
4280 struct frame *f = XFRAME (w->frame); 4280 struct frame *f = XFRAME (WVAR (w, frame));
4281 ptrdiff_t i; 4281 ptrdiff_t i;
4282 4282
4283 BLOCK_INPUT; 4283 BLOCK_INPUT;
@@ -4353,7 +4353,7 @@ x_scroll_bar_to_input_event (XEvent *event, struct input_event *ievent)
4353 ievent->timestamp = CurrentTime; 4353 ievent->timestamp = CurrentTime;
4354#else 4354#else
4355 ievent->timestamp = 4355 ievent->timestamp =
4356 XtLastTimestampProcessed (FRAME_X_DISPLAY (XFRAME (w->frame))); 4356 XtLastTimestampProcessed (FRAME_X_DISPLAY (XFRAME (WVAR (w, frame))));
4357#endif 4357#endif
4358 ievent->part = ev->data.l[1]; 4358 ievent->part = ev->data.l[1];
4359 ievent->code = ev->data.l[2]; 4359 ievent->code = ev->data.l[2];
@@ -4954,7 +4954,7 @@ x_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion, int positio
4954static struct scroll_bar * 4954static struct scroll_bar *
4955x_scroll_bar_create (struct window *w, int top, int left, int width, int height) 4955x_scroll_bar_create (struct window *w, int top, int left, int width, int height)
4956{ 4956{
4957 struct frame *f = XFRAME (w->frame); 4957 struct frame *f = XFRAME (WVAR (w, frame));
4958 struct scroll_bar *bar 4958 struct scroll_bar *bar
4959 = ALLOCATE_PSEUDOVECTOR (struct scroll_bar, x_window, PVEC_OTHER); 4959 = ALLOCATE_PSEUDOVECTOR (struct scroll_bar, x_window, PVEC_OTHER);
4960 4960
@@ -5180,7 +5180,7 @@ x_scroll_bar_remove (struct scroll_bar *bar)
5180#endif 5180#endif
5181 5181
5182 /* Dissociate this scroll bar from its window. */ 5182 /* Dissociate this scroll bar from its window. */
5183 XWINDOW (bar->window)->vertical_scroll_bar = Qnil; 5183 WVAR (XWINDOW (bar->window), vertical_scroll_bar) = Qnil;
5184 5184
5185 UNBLOCK_INPUT; 5185 UNBLOCK_INPUT;
5186} 5186}
@@ -5194,7 +5194,7 @@ x_scroll_bar_remove (struct scroll_bar *bar)
5194static void 5194static void
5195XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int position) 5195XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int position)
5196{ 5196{
5197 struct frame *f = XFRAME (w->frame); 5197 struct frame *f = XFRAME (WVAR (w, frame));
5198 struct scroll_bar *bar; 5198 struct scroll_bar *bar;
5199 int top, height, left, sb_left, width, sb_width; 5199 int top, height, left, sb_left, width, sb_width;
5200 int window_y, window_height; 5200 int window_y, window_height;
@@ -5245,7 +5245,7 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio
5245#endif 5245#endif
5246 5246
5247 /* Does the scroll bar exist yet? */ 5247 /* Does the scroll bar exist yet? */
5248 if (NILP (w->vertical_scroll_bar)) 5248 if (NILP (WVAR (w, vertical_scroll_bar)))
5249 { 5249 {
5250 if (width > 0 && height > 0) 5250 if (width > 0 && height > 0)
5251 { 5251 {
@@ -5268,7 +5268,7 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio
5268 /* It may just need to be moved and resized. */ 5268 /* It may just need to be moved and resized. */
5269 unsigned int mask = 0; 5269 unsigned int mask = 0;
5270 5270
5271 bar = XSCROLL_BAR (w->vertical_scroll_bar); 5271 bar = XSCROLL_BAR (WVAR (w, vertical_scroll_bar));
5272 5272
5273 BLOCK_INPUT; 5273 BLOCK_INPUT;
5274 5274
@@ -5392,7 +5392,7 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio
5392 } 5392 }
5393#endif /* not USE_TOOLKIT_SCROLL_BARS */ 5393#endif /* not USE_TOOLKIT_SCROLL_BARS */
5394 5394
5395 XSETVECTOR (w->vertical_scroll_bar, bar); 5395 XSETVECTOR (WVAR (w, vertical_scroll_bar), bar);
5396} 5396}
5397 5397
5398 5398
@@ -5436,10 +5436,10 @@ XTredeem_scroll_bar (struct window *window)
5436 struct frame *f; 5436 struct frame *f;
5437 5437
5438 /* We can't redeem this window's scroll bar if it doesn't have one. */ 5438 /* We can't redeem this window's scroll bar if it doesn't have one. */
5439 if (NILP (window->vertical_scroll_bar)) 5439 if (NILP (WVAR (window, vertical_scroll_bar)))
5440 abort (); 5440 abort ();
5441 5441
5442 bar = XSCROLL_BAR (window->vertical_scroll_bar); 5442 bar = XSCROLL_BAR (WVAR (window, vertical_scroll_bar));
5443 5443
5444 /* Unlink it from the condemned list. */ 5444 /* Unlink it from the condemned list. */
5445 f = XFRAME (WINDOW_FRAME (window)); 5445 f = XFRAME (WINDOW_FRAME (window));
@@ -5447,11 +5447,11 @@ XTredeem_scroll_bar (struct window *window)
5447 { 5447 {
5448 /* If the prev pointer is nil, it must be the first in one of 5448 /* If the prev pointer is nil, it must be the first in one of
5449 the lists. */ 5449 the lists. */
5450 if (EQ (FRAME_SCROLL_BARS (f), window->vertical_scroll_bar)) 5450 if (EQ (FRAME_SCROLL_BARS (f), WVAR (window, vertical_scroll_bar)))
5451 /* It's not condemned. Everything's fine. */ 5451 /* It's not condemned. Everything's fine. */
5452 return; 5452 return;
5453 else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f), 5453 else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f),
5454 window->vertical_scroll_bar)) 5454 WVAR (window, vertical_scroll_bar)))
5455 FRAME_CONDEMNED_SCROLL_BARS (f) = bar->next; 5455 FRAME_CONDEMNED_SCROLL_BARS (f) = bar->next;
5456 else 5456 else
5457 /* If its prev pointer is nil, it must be at the front of 5457 /* If its prev pointer is nil, it must be at the front of
@@ -5610,7 +5610,7 @@ x_scroll_bar_handle_click (struct scroll_bar *bar, XEvent *event, struct input_e
5610static void 5610static void
5611x_scroll_bar_note_movement (struct scroll_bar *bar, XEvent *event) 5611x_scroll_bar_note_movement (struct scroll_bar *bar, XEvent *event)
5612{ 5612{
5613 FRAME_PTR f = XFRAME (XWINDOW (bar->window)->frame); 5613 FRAME_PTR f = XFRAME (WVAR (XWINDOW (bar->window), frame));
5614 5614
5615 last_mouse_movement_time = event->xmotion.time; 5615 last_mouse_movement_time = event->xmotion.time;
5616 5616
@@ -6784,8 +6784,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6784 create event iff we don't leave the 6784 create event iff we don't leave the
6785 selected frame. */ 6785 selected frame. */
6786 && (focus_follows_mouse 6786 && (focus_follows_mouse
6787 || (EQ (XWINDOW (window)->frame, 6787 || (EQ (WVAR (XWINDOW (window), frame),
6788 XWINDOW (selected_window)->frame)))) 6788 WVAR (XWINDOW (selected_window), frame)))))
6789 { 6789 {
6790 inev.ie.kind = SELECT_WINDOW_EVENT; 6790 inev.ie.kind = SELECT_WINDOW_EVENT;
6791 inev.ie.frame_or_window = window; 6791 inev.ie.frame_or_window = window;
@@ -7334,7 +7334,7 @@ x_draw_hollow_cursor (struct window *w, struct glyph_row *row)
7334static void 7334static void
7335x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text_cursor_kinds kind) 7335x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text_cursor_kinds kind)
7336{ 7336{
7337 struct frame *f = XFRAME (w->frame); 7337 struct frame *f = XFRAME (WVAR (w, frame));
7338 struct glyph *cursor_glyph; 7338 struct glyph *cursor_glyph;
7339 7339
7340 /* If cursor is out of bounds, don't draw garbage. This can happen 7340 /* If cursor is out of bounds, don't draw garbage. This can happen