Separate read and write access to Lisp_Object slots of struct window.
authorDmitry Antipov <dmantipov@yandex.ru>
Mon, 6 Aug 2012 10:24:26 +0000 (14:24 +0400)
committerDmitry Antipov <dmantipov@yandex.ru>
Mon, 6 Aug 2012 10:24:26 +0000 (14:24 +0400)
* window.h (WGET, WSET): New macros similar to AREF and ASET.
* alloc.c, buffer.c, composite.c, dispextern.h, dispnew.c, editfns.c:
* fileio.c, font.c, fontset.c, frame.c, frame.h, fringe.c, indent.c:
* insdel.c, keyboard.c, keymap.c, lisp.h, minibuf.c, msdos.c, nsfns.m:
* nsmenu.m, nsterm.m, print.c, textprop.c, w32fns.c, w32menu.c:
* w32term.c, window.c, xdisp.c, xfaces.c, xfns.c, xmenu.c, xterm.c:
Adjust users.

35 files changed:
src/ChangeLog
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/msdos.c
src/nsfns.m
src/nsmenu.m
src/nsterm.m
src/print.c
src/textprop.c
src/w32fns.c
src/w32menu.c
src/w32term.c
src/window.c
src/window.h
src/xdisp.c
src/xfaces.c
src/xfns.c
src/xmenu.c
src/xterm.c

index d216ecc..f443a94 100644 (file)
@@ -1,3 +1,14 @@
+2012-08-06  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Separate read and write access to Lisp_Object slots of struct window.
+       * window.h (WGET, WSET): New macros similar to AREF and ASET.
+       * alloc.c, buffer.c, composite.c, dispextern.h, dispnew.c, editfns.c:
+       * fileio.c, font.c, fontset.c, frame.c, frame.h, fringe.c, indent.c:
+       * insdel.c, keyboard.c, keymap.c, lisp.h, minibuf.c, msdos.c, nsfns.m:
+       * nsmenu.m, nsterm.m, print.c, textprop.c, w32fns.c, w32menu.c:
+       * w32term.c, window.c, xdisp.c, xfaces.c, xfns.c, xmenu.c, xterm.c:
+       Adjust users.
+
 2012-08-06  Dmitry Antipov  <dmantipov@yandex.ru>
 
        Fix Windows build errors introduced after converting to FGET and FSET.
index 7d1ff76..0f42566 100644 (file)
@@ -6015,7 +6015,7 @@ mark_object (Lisp_Object arg)
              /* Mark glyphs for leaf windows.  Marking window
                 matrices is sufficient because frame matrices
                 use the same glyph memory.  */
-             if (NILP (WVAR (w, hchild)) && NILP (WVAR (w, vchild))
+             if (NILP (WGET (w, hchild)) && NILP (WGET (w, vchild))
                  && w->current_matrix)
                {
                  mark_glyph_matrix (w->current_matrix);
index 445f7be..6085746 100644 (file)
@@ -1560,7 +1560,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
      since anything can happen within do_yes_or_no_p.  */
 
   /* Don't kill the minibuffer now current.  */
-  if (EQ (buffer, WVAR (XWINDOW (minibuf_window), buffer)))
+  if (EQ (buffer, WGET (XWINDOW (minibuf_window), buffer)))
     return Qnil;
 
   /* When we kill an ordinary buffer which shares it's buffer text
@@ -1611,7 +1611,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
   /* If the buffer now current is shown in the minibuffer and our buffer
      is the sole other buffer give up.  */
   XSETBUFFER (tem, current_buffer);
-  if (EQ (tem, WVAR (XWINDOW (minibuf_window), buffer))
+  if (EQ (tem, WGET (XWINDOW (minibuf_window), buffer))
       && EQ (buffer, Fother_buffer (buffer, Qnil, Qnil)))
     return Qnil;
 
@@ -2193,13 +2193,13 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
     while (NILP (Fmemq (w, ws)))
       {
        ws = Fcons (w, ws);
-       if (MARKERP (WVAR (XWINDOW (w), pointm))
-           && (EQ (WVAR (XWINDOW (w), buffer), buf1)
-               || EQ (WVAR (XWINDOW (w), buffer), buf2)))
-         Fset_marker (WVAR (XWINDOW (w), pointm),
+       if (MARKERP (WGET (XWINDOW (w), pointm))
+           && (EQ (WGET (XWINDOW (w), buffer), buf1)
+               || EQ (WGET (XWINDOW (w), buffer), buf2)))
+         Fset_marker (WGET (XWINDOW (w), pointm),
                       make_number
-                      (BUF_BEGV (XBUFFER (WVAR (XWINDOW (w), buffer)))),
-                      WVAR (XWINDOW (w), buffer));
+                      (BUF_BEGV (XBUFFER (WGET (XWINDOW (w), buffer)))),
+                      WGET (XWINDOW (w), buffer));
        w = Fnext_window (w, Qt, Qt);
       }
   }
@@ -3675,7 +3675,7 @@ modify_overlay (struct buffer *buf, ptrdiff_t start, ptrdiff_t end)
 
   /* If this is a buffer not in the selected window,
      we must do other windows.  */
-  if (buf != XBUFFER (WVAR (XWINDOW (selected_window), buffer)))
+  if (buf != XBUFFER (WGET (XWINDOW (selected_window), buffer)))
     windows_or_buffers_changed = 1;
   /* If multiple windows show this buffer, we must do other windows.  */
   else if (buffer_shared > 1)
index 269bdc8..16fa3cc 100644 (file)
@@ -909,7 +909,7 @@ static Lisp_Object
 autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t limit, struct window *win, struct face *face, Lisp_Object string)
 {
   ptrdiff_t count = SPECPDL_INDEX ();
-  FRAME_PTR f = XFRAME (WVAR (win, frame));
+  FRAME_PTR f = XFRAME (WGET (win, frame));
   Lisp_Object pos = make_number (charpos);
   ptrdiff_t to;
   ptrdiff_t pt = PT, pt_byte = PT_BYTE;
@@ -945,7 +945,7 @@ autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t
     }
   else
 #endif /* not HAVE_WINDOW_SYSTEM */
-    font_object = WVAR (win, frame);
+    font_object = WGET (win, frame);
   lgstring = Fcomposition_get_gstring (pos, make_number (to), font_object,
                                       string);
   if (NILP (LGSTRING_ID (lgstring)))
index 47a3f97..0986950 100644 (file)
@@ -1379,7 +1379,7 @@ struct glyph_string
       ? current_mode_line_height                               \
       : (MATRIX_MODE_LINE_HEIGHT ((W)->current_matrix)         \
         ? MATRIX_MODE_LINE_HEIGHT ((W)->current_matrix)        \
-        : estimate_mode_line_height (XFRAME (WVAR (W, frame)), \
+        : estimate_mode_line_height (XFRAME (WGET (W, frame)), \
                                      CURRENT_MODE_LINE_FACE_ID (W))))
 
 /* Return the current height of the header line of window W.  If not
@@ -1392,7 +1392,7 @@ struct glyph_string
        ? current_header_line_height                            \
        : (MATRIX_HEADER_LINE_HEIGHT ((W)->current_matrix)      \
          ? MATRIX_HEADER_LINE_HEIGHT ((W)->current_matrix)     \
-         : estimate_mode_line_height (XFRAME (WVAR (W, frame)),\
+         : estimate_mode_line_height (XFRAME (WGET (W, frame)),\
                                       HEADER_LINE_FACE_ID)))
 
 /* Return the height of the desired mode line of window W.  */
@@ -1411,8 +1411,8 @@ struct glyph_string
      (!MINI_WINDOW_P ((W))                                             \
       && !(W)->pseudo_window_p                                         \
       && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W))))          \
-      && BUFFERP (WVAR (W, buffer))                                    \
-      && !NILP (BVAR (XBUFFER (WVAR (W, buffer)), mode_line_format))   \
+      && BUFFERP (WGET (W, buffer))                                    \
+      && !NILP (BVAR (XBUFFER (WGET (W, buffer)), mode_line_format))   \
       && WINDOW_TOTAL_LINES (W) > 1)
 
 /* Value is non-zero if window W wants a header line.  */
@@ -1421,10 +1421,10 @@ struct glyph_string
      (!MINI_WINDOW_P ((W))                                             \
       && !(W)->pseudo_window_p                                         \
       && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W))))          \
-      && BUFFERP (WVAR (W, buffer))                                    \
-      && !NILP (BVAR (XBUFFER (WVAR (W, buffer)), header_line_format)) \
+      && BUFFERP (WGET (W, buffer))                                    \
+      && !NILP (BVAR (XBUFFER (WGET (W, buffer)), header_line_format)) \
       && WINDOW_TOTAL_LINES (W) > 1                                    \
-      + !NILP (BVAR (XBUFFER (WVAR (W, buffer)), mode_line_format)))
+      + !NILP (BVAR (XBUFFER (WGET (W, buffer)), mode_line_format)))
 
 
 /* Return proper value to be used as baseline offset of font that has
index 63fc35f..10206ec 100644 (file)
@@ -268,9 +268,9 @@ add_window_display_history (struct window *w, const char *msg, int paused_p)
            "%"pMu": window %p (`%s')%s\n%s",
            history_tick++,
            w,
-           ((BUFFERP (WVAR (w, buffer))
-             && STRINGP (BVAR (XBUFFER (WVAR (w, buffer)), name)))
-            ? SSDATA (BVAR (XBUFFER (WVAR (w, buffer)), name))
+           ((BUFFERP (WGET (w, buffer))
+             && STRINGP (BVAR (XBUFFER (WGET (w, buffer)), name)))
+            ? SSDATA (BVAR (XBUFFER (WGET (w, buffer)), name))
             : "???"),
            paused_p ? " ***paused***" : "",
            msg);
@@ -408,7 +408,7 @@ margin_glyphs_to_reserve (struct window *w, int total_glyphs, Lisp_Object margin
 
   if (NUMBERP (margin))
     {
-      int width = XFASTINT (WVAR (w, total_cols));
+      int width = XFASTINT (WGET (w, total_cols));
       double d = max (0, XFLOATINT (margin));
       d = min (width / 2 - 1, d);
       n = (int) ((double) total_glyphs / width * d);
@@ -478,8 +478,8 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y
      the matrix means preventing redisplay.  */
   if (matrix->pool == NULL)
     {
-      left = margin_glyphs_to_reserve (w, dim.width, WVAR (w, left_margin_cols));
-      right = margin_glyphs_to_reserve (w, dim.width, WVAR (w, right_margin_cols));
+      left = margin_glyphs_to_reserve (w, dim.width, WGET (w, left_margin_cols));
+      right = margin_glyphs_to_reserve (w, dim.width, WGET (w, right_margin_cols));
       eassert (left >= 0 && right >= 0);
       marginal_areas_changed_p = (left != matrix->left_margin_glyphs
                                  || right != matrix->right_margin_glyphs);
@@ -518,9 +518,9 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y
       if (w)
        {
          left = margin_glyphs_to_reserve (w, dim.width,
-                                          WVAR (w, left_margin_cols));
+                                          WGET (w, left_margin_cols));
          right = margin_glyphs_to_reserve (w, dim.width,
-                                           WVAR (w, right_margin_cols));
+                                           WGET (w, right_margin_cols));
        }
       else
        left = right = 0;
@@ -643,9 +643,9 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y
 
              /* Window end is invalid, if inside of the rows that
                 are invalidated below.  */
-             if (INTEGERP (WVAR (w, window_end_vpos))
-                 && XFASTINT (WVAR (w, window_end_vpos)) >= i)
-               WVAR (w, window_end_valid) = Qnil;
+             if (INTEGERP (WGET (w, window_end_vpos))
+                 && XFASTINT (WGET (w, window_end_vpos)) >= i)
+               WSET (w, window_end_valid, Qnil);
 
              while (i < matrix->nrows)
                matrix->rows[i++].enabled_p = 0;
@@ -885,15 +885,15 @@ clear_window_matrices (struct window *w, int desired_p)
 {
   while (w)
     {
-      if (!NILP (WVAR (w, hchild)))
+      if (!NILP (WGET (w, hchild)))
        {
-         eassert (WINDOWP (WVAR (w, hchild)));
-         clear_window_matrices (XWINDOW (WVAR (w, hchild)), desired_p);
+         eassert (WINDOWP (WGET (w, hchild)));
+         clear_window_matrices (XWINDOW (WGET (w, hchild)), desired_p);
        }
-      else if (!NILP (WVAR (w, vchild)))
+      else if (!NILP (WGET (w, vchild)))
        {
-         eassert (WINDOWP (WVAR (w, vchild)));
-         clear_window_matrices (XWINDOW (WVAR (w, vchild)), desired_p);
+         eassert (WINDOWP (WGET (w, vchild)));
+         clear_window_matrices (XWINDOW (WGET (w, vchild)), desired_p);
        }
       else
        {
@@ -902,11 +902,11 @@ clear_window_matrices (struct window *w, int desired_p)
          else
            {
              clear_glyph_matrix (w->current_matrix);
-             WVAR (w, window_end_valid) = Qnil;
+             WSET (w, window_end_valid, Qnil);
            }
        }
 
-      w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next));
+      w = NILP (WGET (w, next)) ? 0 : XWINDOW (WGET (w, next));
     }
 }
 
@@ -970,7 +970,7 @@ blank_row (struct window *w, struct glyph_row *row, int y)
   clear_glyph_row (row);
   row->y = y;
   row->ascent = row->phys_ascent = 0;
-  row->height = row->phys_height = FRAME_LINE_HEIGHT (XFRAME (WVAR (w, frame)));
+  row->height = row->phys_height = FRAME_LINE_HEIGHT (XFRAME (WGET (w, frame)));
   row->visible_height = row->height;
 
   if (row->y < min_y)
@@ -1516,7 +1516,7 @@ check_matrix_invariants (struct window *w)
   struct glyph_row *row = matrix->rows;
   struct glyph_row *last_text_row = NULL;
   struct buffer *saved = current_buffer;
-  struct buffer *buffer = XBUFFER (WVAR (w, buffer));
+  struct buffer *buffer = XBUFFER (WGET (w, buffer));
   int c;
 
   /* This can sometimes happen for a fresh window.  */
@@ -1679,8 +1679,8 @@ allocate_matrices_for_frame_redisplay (Lisp_Object window, int x, int y,
      points to the mini-buffer window, if any, which is arranged
      vertically below other windows.  */
   in_horz_combination_p
-    = (!NILP (WVAR (XWINDOW (window), parent))
-       && !NILP (WVAR (XWINDOW (WVAR (XWINDOW (window), parent)), hchild)));
+    = (!NILP (WGET (XWINDOW (window), parent))
+       && !NILP (WGET (XWINDOW (WGET (XWINDOW (window), parent)), hchild)));
 
   /* For WINDOW and all windows on the same level.  */
   do
@@ -1689,12 +1689,12 @@ allocate_matrices_for_frame_redisplay (Lisp_Object window, int x, int y,
 
       /* Get the dimension of the window sub-matrix for W, depending
         on whether this is a combination or a leaf window.  */
-      if (!NILP (WVAR (w, hchild)))
-       dim = allocate_matrices_for_frame_redisplay (WVAR (w, hchild), x, y,
+      if (!NILP (WGET (w, hchild)))
+       dim = allocate_matrices_for_frame_redisplay (WGET (w, hchild), x, y,
                                                     dim_only_p,
                                                     window_change_flags);
-      else if (!NILP (WVAR (w, vchild)))
-       dim = allocate_matrices_for_frame_redisplay (WVAR (w, vchild), x, y,
+      else if (!NILP (WGET (w, vchild)))
+       dim = allocate_matrices_for_frame_redisplay (WGET (w, vchild), x, y,
                                                     dim_only_p,
                                                     window_change_flags);
       else
@@ -1718,10 +1718,10 @@ allocate_matrices_for_frame_redisplay (Lisp_Object window, int x, int y,
              || dim.width != w->desired_matrix->matrix_w
              || dim.height != w->desired_matrix->matrix_h
              || (margin_glyphs_to_reserve (w, dim.width,
-                                           WVAR (w, left_margin_cols))
+                                           WGET (w, left_margin_cols))
                  != w->desired_matrix->left_margin_glyphs)
              || (margin_glyphs_to_reserve (w, dim.width,
-                                           WVAR (w, right_margin_cols))
+                                           WGET (w, right_margin_cols))
                  != w->desired_matrix->right_margin_glyphs))
            *window_change_flags |= CHANGED_LEAF_MATRIX;
 
@@ -1750,7 +1750,7 @@ allocate_matrices_for_frame_redisplay (Lisp_Object window, int x, int y,
       hmax = max (hmax, dim.height);
 
       /* Next window on same level.  */
-      window = WVAR (w, next);
+      window = WGET (w, next);
     }
   while (!NILP (window));
 
@@ -1781,7 +1781,7 @@ static int
 required_matrix_height (struct window *w)
 {
 #ifdef HAVE_WINDOW_SYSTEM
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
 
   if (FRAME_WINDOW_P (f))
     {
@@ -1807,7 +1807,7 @@ static int
 required_matrix_width (struct window *w)
 {
 #ifdef HAVE_WINDOW_SYSTEM
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
   if (FRAME_WINDOW_P (f))
     {
       int ch_width = FRAME_SMALLEST_CHAR_WIDTH (f);
@@ -1824,7 +1824,7 @@ required_matrix_width (struct window *w)
     }
 #endif /* HAVE_WINDOW_SYSTEM */
 
-  return XINT (WVAR (w, total_cols));
+  return XINT (WGET (w, total_cols));
 }
 
 
@@ -1836,10 +1836,10 @@ allocate_matrices_for_window_redisplay (struct window *w)
 {
   while (w)
     {
-      if (!NILP (WVAR (w, vchild)))
-       allocate_matrices_for_window_redisplay (XWINDOW (WVAR (w, vchild)));
-      else if (!NILP (WVAR (w, hchild)))
-       allocate_matrices_for_window_redisplay (XWINDOW (WVAR (w, hchild)));
+      if (!NILP (WGET (w, vchild)))
+       allocate_matrices_for_window_redisplay (XWINDOW (WGET (w, vchild)));
+      else if (!NILP (WGET (w, hchild)))
+       allocate_matrices_for_window_redisplay (XWINDOW (WGET (w, hchild)));
       else
        {
          /* W is a leaf window.  */
@@ -1858,7 +1858,7 @@ allocate_matrices_for_window_redisplay (struct window *w)
          adjust_glyph_matrix (w, w->current_matrix, 0, 0, dim);
        }
 
-      w = NILP (WVAR (w, next)) ? NULL : XWINDOW (WVAR (w, next));
+      w = NILP (WGET (w, next)) ? NULL : XWINDOW (WGET (w, next));
     }
 }
 
@@ -1905,20 +1905,20 @@ adjust_frame_glyphs_initially (void)
 {
   struct frame *sf = SELECTED_FRAME ();
   struct window *root = XWINDOW (FGET (sf, root_window));
-  struct window *mini = XWINDOW (WVAR (root, next));
+  struct window *mini = XWINDOW (WGET (root, next));
   int frame_lines = FRAME_LINES (sf);
   int frame_cols = FRAME_COLS (sf);
   int top_margin = FRAME_TOP_MARGIN (sf);
 
   /* Do it for the root window.  */
-  XSETFASTINT (WVAR (root, top_line), top_margin);
-  XSETFASTINT (WVAR (root, total_lines), frame_lines - 1 - top_margin);
-  XSETFASTINT (WVAR (root, total_cols), frame_cols);
+  WSET (root, top_line, make_number (top_margin));
+  WSET (root, total_lines, make_number (frame_lines - 1 - top_margin));
+  WSET (root, total_cols, make_number (frame_cols));
 
   /* Do it for the mini-buffer window.  */
-  XSETFASTINT (WVAR (mini, top_line), frame_lines - 1);
-  XSETFASTINT (WVAR (mini, total_lines), 1);
-  XSETFASTINT (WVAR (mini, total_cols), frame_cols);
+  WSET (mini, top_line, make_number (frame_lines - 1));
+  WSET (mini, total_lines, make_number (1));
+  WSET (mini, total_cols, make_number (frame_cols));
 
   adjust_frame_glyphs (sf);
   glyphs_initialized_initially_p = 1;
@@ -1950,21 +1950,21 @@ showing_window_margins_p (struct window *w)
 {
   while (w)
     {
-      if (!NILP (WVAR (w, hchild)))
+      if (!NILP (WGET (w, hchild)))
        {
-         if (showing_window_margins_p (XWINDOW (WVAR (w, hchild))))
+         if (showing_window_margins_p (XWINDOW (WGET (w, hchild))))
            return 1;
        }
-      else if (!NILP (WVAR (w, vchild)))
+      else if (!NILP (WGET (w, vchild)))
        {
-         if (showing_window_margins_p (XWINDOW (WVAR (w, vchild))))
+         if (showing_window_margins_p (XWINDOW (WGET (w, vchild))))
            return 1;
        }
-      else if (!NILP (WVAR (w, left_margin_cols))
-              || !NILP (WVAR (w, right_margin_cols)))
+      else if (!NILP (WGET (w, left_margin_cols))
+              || !NILP (WGET (w, right_margin_cols)))
        return 1;
 
-      w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next));
+      w = NILP (WGET (w, next)) ? 0 : XWINDOW (WGET (w, next));
     }
   return 0;
 }
@@ -1978,18 +1978,18 @@ fake_current_matrices (Lisp_Object window)
 {
   struct window *w;
 
-  for (; !NILP (window); window = WVAR (w, next))
+  for (; !NILP (window); window = WGET (w, next))
     {
       w = XWINDOW (window);
 
-      if (!NILP (WVAR (w, hchild)))
-       fake_current_matrices (WVAR (w, hchild));
-      else if (!NILP (WVAR (w, vchild)))
-       fake_current_matrices (WVAR (w, vchild));
+      if (!NILP (WGET (w, hchild)))
+       fake_current_matrices (WGET (w, hchild));
+      else if (!NILP (WGET (w, vchild)))
+       fake_current_matrices (WGET (w, vchild));
       else
        {
          int i;
-         struct frame *f = XFRAME (WVAR (w, frame));
+         struct frame *f = XFRAME (WGET (w, frame));
          struct glyph_matrix *m = w->current_matrix;
          struct glyph_matrix *fm = f->current_matrix;
 
@@ -2189,9 +2189,11 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f)
     struct window *w;
     if (NILP (FGET (f, menu_bar_window)))
       {
+       Lisp_Object frame;
        FSET (f, menu_bar_window, make_window ());
        w = XWINDOW (FGET (f, menu_bar_window));
-       XSETFRAME (WVAR (w, frame), f);
+       XSETFRAME (frame, f);
+       WSET (w, frame, frame);
        w->pseudo_window_p = 1;
       }
     else
@@ -2199,10 +2201,10 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f)
 
     /* Set window dimensions to frame dimensions and allocate or
        adjust glyph matrices of W.  */
-    XSETFASTINT (WVAR (w, top_line), 0);
-    XSETFASTINT (WVAR (w, left_col), 0);
-    XSETFASTINT (WVAR (w, total_lines), FRAME_MENU_BAR_LINES (f));
-    XSETFASTINT (WVAR (w, total_cols), FRAME_TOTAL_COLS (f));
+    WSET (w, top_line, make_number (0));
+    WSET (w, left_col, make_number (0));
+    WSET (w, total_lines, make_number (FRAME_MENU_BAR_LINES (f)));
+    WSET (w, total_cols, make_number (FRAME_TOTAL_COLS (f)));
     allocate_matrices_for_window_redisplay (w);
   }
 #endif /* not USE_X_TOOLKIT && not USE_GTK */
@@ -2215,18 +2217,20 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f)
     struct window *w;
     if (NILP (FGET (f, tool_bar_window)))
       {
+       Lisp_Object frame;
        FSET (f, tool_bar_window, make_window ());
        w = XWINDOW (FGET (f, tool_bar_window));
-       XSETFRAME (WVAR (w, frame), f);
+       XSETFRAME (frame, f);
+       WSET (w, frame, frame);
        w->pseudo_window_p = 1;
       }
     else
       w = XWINDOW (FGET (f, tool_bar_window));
 
-    XSETFASTINT (WVAR (w, top_line), FRAME_MENU_BAR_LINES (f));
-    XSETFASTINT (WVAR (w, left_col), 0);
-    XSETFASTINT (WVAR (w, total_lines), FRAME_TOOL_BAR_LINES (f));
-    XSETFASTINT (WVAR (w, total_cols), FRAME_TOTAL_COLS (f));
+    WSET (w, top_line, make_number (FRAME_MENU_BAR_LINES (f)));
+    WSET (w, left_col, make_number (0));
+    WSET (w, total_lines, make_number (FRAME_TOOL_BAR_LINES (f)));
+    WSET (w, total_cols, make_number (FRAME_TOTAL_COLS (f)));
     allocate_matrices_for_window_redisplay (w);
   }
 #endif
@@ -2336,10 +2340,10 @@ free_window_matrices (struct window *w)
 {
   while (w)
     {
-      if (!NILP (WVAR (w, hchild)))
-       free_window_matrices (XWINDOW (WVAR (w, hchild)));
-      else if (!NILP (WVAR (w, vchild)))
-       free_window_matrices (XWINDOW (WVAR (w, vchild)));
+      if (!NILP (WGET (w, hchild)))
+       free_window_matrices (XWINDOW (WGET (w, hchild)));
+      else if (!NILP (WGET (w, vchild)))
+       free_window_matrices (XWINDOW (WGET (w, vchild)));
       else
        {
          /* This is a leaf window.  Free its memory and reset fields
@@ -2351,7 +2355,7 @@ free_window_matrices (struct window *w)
        }
 
       /* Next window on same level.  */
-      w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next));
+      w = NILP (WGET (w, next)) ? 0 : XWINDOW (WGET (w, next));
     }
 }
 
@@ -2472,14 +2476,14 @@ build_frame_matrix_from_window_tree (struct glyph_matrix *matrix, struct window
 {
   while (w)
     {
-      if (!NILP (WVAR (w, hchild)))
-       build_frame_matrix_from_window_tree (matrix, XWINDOW (WVAR (w, hchild)));
-      else if (!NILP (WVAR (w, vchild)))
-       build_frame_matrix_from_window_tree (matrix, XWINDOW (WVAR (w, vchild)));
+      if (!NILP (WGET (w, hchild)))
+       build_frame_matrix_from_window_tree (matrix, XWINDOW (WGET (w, hchild)));
+      else if (!NILP (WGET (w, vchild)))
+       build_frame_matrix_from_window_tree (matrix, XWINDOW (WGET (w, vchild)));
       else
        build_frame_matrix_from_leaf_window (matrix, w);
 
-      w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next));
+      w = NILP (WGET (w, next)) ? 0 : XWINDOW (WGET (w, next));
     }
 }
 
@@ -2618,7 +2622,7 @@ spec_glyph_lookup_face (struct window *w, GLYPH *glyph)
   /* Convert the glyph's specified face to a realized (cache) face.  */
   if (lface_id > 0)
     {
-      int face_id = merge_faces (XFRAME (WVAR (w, frame)),
+      int face_id = merge_faces (XFRAME (WGET (w, frame)),
                                 Qt, lface_id, DEFAULT_FACE_ID);
       SET_GLYPH_FACE (*glyph, face_id);
     }
@@ -2739,10 +2743,10 @@ mirror_make_current (struct window *w, int frame_row)
 {
   while (w)
     {
-      if (!NILP (WVAR (w, hchild)))
-       mirror_make_current (XWINDOW (WVAR (w, hchild)), frame_row);
-      else if (!NILP (WVAR (w, vchild)))
-       mirror_make_current (XWINDOW (WVAR (w, vchild)), frame_row);
+      if (!NILP (WGET (w, hchild)))
+       mirror_make_current (XWINDOW (WGET (w, hchild)), frame_row);
+      else if (!NILP (WGET (w, vchild)))
+       mirror_make_current (XWINDOW (WGET (w, vchild)), frame_row);
       else
        {
          /* Row relative to window W.  Don't use FRAME_TO_WINDOW_VPOS
@@ -2775,7 +2779,7 @@ mirror_make_current (struct window *w, int frame_row)
            }
        }
 
-      w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next));
+      w = NILP (WGET (w, next)) ? 0 : XWINDOW (WGET (w, next));
     }
 }
 
@@ -2834,16 +2838,16 @@ mirrored_line_dance (struct glyph_matrix *matrix, int unchanged_at_top, int nlin
 static void
 sync_window_with_frame_matrix_rows (struct window *w)
 {
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
   struct glyph_row *window_row, *window_row_end, *frame_row;
   int left, right, x, width;
 
   /* Preconditions: W must be a leaf window on a tty frame.  */
-  eassert (NILP (WVAR (w, hchild)) && NILP (WVAR (w, vchild)));
+  eassert (NILP (WGET (w, hchild)) && NILP (WGET (w, vchild)));
   eassert (!FRAME_WINDOW_P (f));
 
-  left = margin_glyphs_to_reserve (w, 1, WVAR (w, left_margin_cols));
-  right = margin_glyphs_to_reserve (w, 1, WVAR (w, right_margin_cols));
+  left = margin_glyphs_to_reserve (w, 1, WGET (w, left_margin_cols));
+  right = margin_glyphs_to_reserve (w, 1, WGET (w, right_margin_cols));
   x = w->current_matrix->matrix_x;
   width = w->current_matrix->matrix_w;
 
@@ -2875,15 +2879,15 @@ frame_row_to_window (struct window *w, int row)
 
   while (w && !found)
     {
-      if (!NILP (WVAR (w, hchild)))
-       found = frame_row_to_window (XWINDOW (WVAR (w, hchild)), row);
-      else if (!NILP (WVAR (w, vchild)))
-       found = frame_row_to_window (XWINDOW (WVAR (w, vchild)), row);
+      if (!NILP (WGET (w, hchild)))
+       found = frame_row_to_window (XWINDOW (WGET (w, hchild)), row);
+      else if (!NILP (WGET (w, vchild)))
+       found = frame_row_to_window (XWINDOW (WGET (w, vchild)), row);
       else if (row >= WINDOW_TOP_EDGE_LINE (w)
               && row < WINDOW_BOTTOM_EDGE_LINE (w))
        found = w;
 
-      w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next));
+      w = NILP (WGET (w, next)) ? 0 : XWINDOW (WGET (w, next));
     }
 
   return found;
@@ -2906,11 +2910,11 @@ mirror_line_dance (struct window *w, int unchanged_at_top, int nlines, int *copy
 {
   while (w)
     {
-      if (!NILP (WVAR (w, hchild)))
-       mirror_line_dance (XWINDOW (WVAR (w, hchild)), unchanged_at_top,
+      if (!NILP (WGET (w, hchild)))
+       mirror_line_dance (XWINDOW (WGET (w, hchild)), unchanged_at_top,
                           nlines, copy_from, retained_p);
-      else if (!NILP (WVAR (w, vchild)))
-       mirror_line_dance (XWINDOW (WVAR (w, vchild)), unchanged_at_top,
+      else if (!NILP (WGET (w, vchild)))
+       mirror_line_dance (XWINDOW (WGET (w, vchild)), unchanged_at_top,
                           nlines, copy_from, retained_p);
       else
        {
@@ -2966,7 +2970,7 @@ mirror_line_dance (struct window *w, int unchanged_at_top, int nlines, int *copy
                {
                  /* A copy between windows.  This is an infrequent
                     case not worth optimizing.  */
-                 struct frame *f = XFRAME (WVAR (w, frame));
+                 struct frame *f = XFRAME (WGET (w, frame));
                  struct window *root = XWINDOW (FRAME_ROOT_WINDOW (f));
                  struct window *w2;
                  struct glyph_matrix *m2;
@@ -3003,7 +3007,7 @@ mirror_line_dance (struct window *w, int unchanged_at_top, int nlines, int *copy
        }
 
       /* Next window on same level.  */
-      w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next));
+      w = NILP (WGET (w, next)) ? 0 : XWINDOW (WGET (w, next));
     }
 }
 
@@ -3021,18 +3025,18 @@ check_window_matrix_pointers (struct window *w)
 {
   while (w)
     {
-      if (!NILP (WVAR (w, hchild)))
-       check_window_matrix_pointers (XWINDOW (WVAR (w, hchild)));
-      else if (!NILP (WVAR (w, vchild)))
-       check_window_matrix_pointers (XWINDOW (WVAR (w, vchild)));
+      if (!NILP (WGET (w, hchild)))
+       check_window_matrix_pointers (XWINDOW (WGET (w, hchild)));
+      else if (!NILP (WGET (w, vchild)))
+       check_window_matrix_pointers (XWINDOW (WGET (w, vchild)));
       else
        {
-         struct frame *f = XFRAME (WVAR (w, frame));
+         struct frame *f = XFRAME (WGET (w, frame));
          check_matrix_pointers (w->desired_matrix, f->desired_matrix);
          check_matrix_pointers (w->current_matrix, f->current_matrix);
        }
 
-      w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next));
+      w = NILP (WGET (w, next)) ? 0 : XWINDOW (WGET (w, next));
     }
 }
 
@@ -3080,10 +3084,10 @@ check_matrix_pointers (struct glyph_matrix *window_matrix,
 static int
 window_to_frame_vpos (struct window *w, int vpos)
 {
-  eassert (!FRAME_WINDOW_P (XFRAME (WVAR (w, frame))));
+  eassert (!FRAME_WINDOW_P (XFRAME (WGET (w, frame))));
   eassert (vpos >= 0 && vpos <= w->desired_matrix->nrows);
   vpos += WINDOW_TOP_EDGE_LINE (w);
-  eassert (vpos >= 0 && vpos <= FRAME_LINES (XFRAME (WVAR (w, frame))));
+  eassert (vpos >= 0 && vpos <= FRAME_LINES (XFRAME (WGET (w, frame))));
   return vpos;
 }
 
@@ -3094,7 +3098,7 @@ window_to_frame_vpos (struct window *w, int vpos)
 static int
 window_to_frame_hpos (struct window *w, int hpos)
 {
-  eassert (!FRAME_WINDOW_P (XFRAME (WVAR (w, frame))));
+  eassert (!FRAME_WINDOW_P (XFRAME (WGET (w, frame))));
   hpos += WINDOW_LEFT_EDGE_COL (w);
   return hpos;
 }
@@ -3314,14 +3318,14 @@ update_window_tree (struct window *w, int force_p)
 
   while (w && !paused_p)
     {
-      if (!NILP (WVAR (w, hchild)))
-       paused_p |= update_window_tree (XWINDOW (WVAR (w, hchild)), force_p);
-      else if (!NILP (WVAR (w, vchild)))
-       paused_p |= update_window_tree (XWINDOW (WVAR (w, vchild)), force_p);
+      if (!NILP (WGET (w, hchild)))
+       paused_p |= update_window_tree (XWINDOW (WGET (w, hchild)), force_p);
+      else if (!NILP (WGET (w, vchild)))
+       paused_p |= update_window_tree (XWINDOW (WGET (w, vchild)), force_p);
       else if (w->must_be_updated_p)
        paused_p |= update_window (w, force_p);
 
-      w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next));
+      w = NILP (WGET (w, next)) ? 0 : XWINDOW (WGET (w, next));
     }
 
   return paused_p;
@@ -3809,7 +3813,7 @@ update_text_area (struct window *w, int vpos)
              struct glyph *glyph = &current_row->glyphs[TEXT_AREA][i - 1];
              int left, right;
 
-             rif->get_glyph_overhangs (glyph, XFRAME (WVAR (w, frame)),
+             rif->get_glyph_overhangs (glyph, XFRAME (WGET (w, frame)),
                                        &left, &right);
              can_skip_p = (right == 0 && !abort_skipping);
            }
@@ -3842,7 +3846,7 @@ update_text_area (struct window *w, int vpos)
                  int left, right;
 
                  rif->get_glyph_overhangs (current_glyph,
-                                           XFRAME (WVAR (w, frame)),
+                                           XFRAME (WGET (w, frame)),
                                            &left, &right);
                  while (left > 0 && i > 0)
                    {
@@ -3985,7 +3989,7 @@ update_window_line (struct window *w, int vpos, int *mouse_face_overwritten_p)
 
       /* Update display of the left margin area, if there is one.  */
       if (!desired_row->full_width_p
-         && !NILP (WVAR (w, left_margin_cols)))
+         && !NILP (WGET (w, left_margin_cols)))
        {
          changed_p = 1;
          update_marginal_area (w, LEFT_MARGIN_AREA, vpos);
@@ -4001,7 +4005,7 @@ update_window_line (struct window *w, int vpos, int *mouse_face_overwritten_p)
 
       /* Update display of the right margin area, if there is one.  */
       if (!desired_row->full_width_p
-         && !NILP (WVAR (w, right_margin_cols)))
+         && !NILP (WGET (w, right_margin_cols)))
        {
          changed_p = 1;
          update_marginal_area (w, RIGHT_MARGIN_AREA, vpos);
@@ -4034,7 +4038,7 @@ update_window_line (struct window *w, int vpos, int *mouse_face_overwritten_p)
 static void
 set_window_cursor_after_update (struct window *w)
 {
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
   struct redisplay_interface *rif = FRAME_RIF (f);
   int cx, cy, vpos, hpos;
 
@@ -4120,14 +4124,14 @@ set_window_update_flags (struct window *w, int on_p)
 {
   while (w)
     {
-      if (!NILP (WVAR (w, hchild)))
-       set_window_update_flags (XWINDOW (WVAR (w, hchild)), on_p);
-      else if (!NILP (WVAR (w, vchild)))
-       set_window_update_flags (XWINDOW (WVAR (w, vchild)), on_p);
+      if (!NILP (WGET (w, hchild)))
+       set_window_update_flags (XWINDOW (WGET (w, hchild)), on_p);
+      else if (!NILP (WGET (w, vchild)))
+       set_window_update_flags (XWINDOW (WGET (w, vchild)), on_p);
       else
        w->must_be_updated_p = on_p;
 
-      w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next));
+      w = NILP (WGET (w, next)) ? 0 : XWINDOW (WGET (w, next));
     }
 }
 
@@ -4810,8 +4814,8 @@ update_frame_1 (struct frame *f, int force_p, int inhibit_id_p)
              int x = WINDOW_TO_FRAME_HPOS (w, w->cursor.hpos);
              int y = WINDOW_TO_FRAME_VPOS (w, w->cursor.vpos);
 
-             if (INTEGERP (WVAR (w, left_margin_cols)))
-               x += XFASTINT (WVAR (w, left_margin_cols));
+             if (INTEGERP (WGET (w, left_margin_cols)))
+               x += XFASTINT (WGET (w, left_margin_cols));
 
              /* x = max (min (x, FRAME_TOTAL_COLS (f) - 1), 0); */
              cursor_to (f, y, x);
@@ -5301,9 +5305,9 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p
 
   /* We used to set current_buffer directly here, but that does the
      wrong thing with `face-remapping-alist' (bug#2044).  */
-  Fset_buffer (WVAR (w, buffer));
+  Fset_buffer (WGET (w, buffer));
   itdata = bidi_shelve_cache ();
-  SET_TEXT_POS_FROM_MARKER (startp, WVAR (w, start));
+  SET_TEXT_POS_FROM_MARKER (startp, WGET (w, start));
   CHARPOS (startp) = min (ZV, max (BEGV, CHARPOS (startp)));
   BYTEPOS (startp) = min (ZV_BYTE, max (BEGV_BYTE, BYTEPOS (startp)));
   start_display (&it, w, startp);
@@ -5347,7 +5351,7 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p
   *dx = x0 + it.first_visible_x - it.current_x;
   *dy = *y - it.current_y;
 
-  string =  WVAR (w, buffer);
+  string =  WGET (w, buffer);
   if (STRINGP (it.string))
     string = it.string;
   *pos = it.current;
@@ -5365,7 +5369,7 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p
       if (STRINGP (it.string))
        BYTEPOS (pos->pos) = string_char_to_byte (string, CHARPOS (pos->pos));
       else
-       BYTEPOS (pos->pos) = buf_charpos_to_bytepos (XBUFFER (WVAR (w, buffer)),
+       BYTEPOS (pos->pos) = buf_charpos_to_bytepos (XBUFFER (WGET (w, buffer)),
                                                     CHARPOS (pos->pos));
     }
 
@@ -5765,7 +5769,8 @@ change_frame_size_1 (register struct frame *f, int newheight, int newwidth, int
        FrameCols (FRAME_TTY (f)) = newwidth;
 
       if (WINDOWP (FGET (f, tool_bar_window)))
-       XSETFASTINT (WVAR (XWINDOW (FGET (f, tool_bar_window)), total_cols), newwidth);
+       WSET (XWINDOW (FGET (f, tool_bar_window)),
+             total_cols, make_number (newwidth));
     }
 
   FRAME_LINES (f) = newheight;
index f86b4c1..f86e669 100644 (file)
@@ -366,7 +366,7 @@ get_pos_property (Lisp_Object position, register Lisp_Object prop, Lisp_Object o
   if (NILP (object))
     XSETBUFFER (object, current_buffer);
   else if (WINDOWP (object))
-    object = WVAR (XWINDOW (object), buffer);
+    object = WGET (XWINDOW (object), buffer);
 
   if (!BUFFERP (object))
     /* pos-property only makes sense in buffers right now, since strings
@@ -821,7 +821,7 @@ This function does not move point.  */)
 Lisp_Object
 save_excursion_save (void)
 {
-  int visible = (XBUFFER (WVAR (XWINDOW (selected_window), buffer))
+  int visible = (XBUFFER (WGET (XWINDOW (selected_window), buffer))
                 == current_buffer);
 
   return Fcons (Fpoint_marker (),
@@ -874,7 +874,7 @@ save_excursion_restore (Lisp_Object info)
         and cleaner never to alter the window/buffer connections.  */
   tem1 = Fcar (tem);
   if (!NILP (tem1)
-      && current_buffer != XBUFFER (WVAR (XWINDOW (selected_window), buffer)))
+      && current_buffer != XBUFFER (WGET (XWINDOW (selected_window), buffer)))
     Fswitch_to_buffer (Fcurrent_buffer (), Qnil);
 #endif /* 0 */
 
@@ -907,7 +907,7 @@ save_excursion_restore (Lisp_Object info)
   tem = XCDR (info);
   if (visible_p
       && !EQ (tem, selected_window)
-      && (tem1 = WVAR (XWINDOW (tem), buffer),
+      && (tem1 = WGET (XWINDOW (tem), buffer),
          (/* Window is live...  */
           BUFFERP (tem1)
           /* ...and it shows the current buffer.  */
index 9578f1f..bd037cb 100644 (file)
@@ -3731,7 +3731,7 @@ variable `last-coding-system-used' to the coding system actually used.  */)
 
          /* If display currently starts at beginning of line,
             keep it that way.  */
-         if (XBUFFER (WVAR (XWINDOW (selected_window), buffer)) == current_buffer)
+         if (XBUFFER (WGET (XWINDOW (selected_window), buffer)) == current_buffer)
            XWINDOW (selected_window)->start_at_line_beg = !NILP (Fbolp ());
 
          replace_handled = 1;
@@ -3888,7 +3888,7 @@ variable `last-coding-system-used' to the coding system actually used.  */)
 
       /* If display currently starts at beginning of line,
         keep it that way.  */
-      if (XBUFFER (WVAR (XWINDOW (selected_window), buffer)) == current_buffer)
+      if (XBUFFER (WGET (XWINDOW (selected_window), buffer)) == current_buffer)
        XWINDOW (selected_window)->start_at_line_beg = !NILP (Fbolp ());
 
       /* Replace the chars that we need to replace,
index ca0ccc1..db1d12d 100644 (file)
@@ -3665,7 +3665,7 @@ font_at (int c, ptrdiff_t pos, struct face *face, struct window *w,
        }
     }
 
-  f = XFRAME (WVAR (w, frame));
+  f = XFRAME (WGET (w, frame));
   if (! FRAME_WINDOW_P (f))
     return Qnil;
   if (! face)
@@ -3723,7 +3723,7 @@ font_range (ptrdiff_t pos, ptrdiff_t *limit, struct window *w, struct face *face
 
          face_id = face_at_buffer_position (w, pos, 0, 0, &ignore,
                                             *limit, 0, -1);
-         face = FACE_FROM_ID (XFRAME (WVAR (w, frame)), face_id);
+         face = FACE_FROM_ID (XFRAME (WGET (w, frame)), face_id);
        }
     }
   else
index 7f6fded..7a2c091 100644 (file)
@@ -1841,7 +1841,7 @@ DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 2, 0,
       if (NILP (window))
        return Qnil;
       w = XWINDOW (window);
-      f = XFRAME (WVAR (w, frame));
+      f = XFRAME (WGET (w, frame));
       face_id = face_at_buffer_position (w, pos, -1, -1, &dummy,
                                         pos + 100, 0, -1);
     }
index f488a53..cb94143 100644 (file)
@@ -132,15 +132,15 @@ set_menu_bar_lines_1 (Lisp_Object window, int n)
   struct window *w = XWINDOW (window);
 
   w->last_modified = 0;
-  XSETFASTINT (WVAR (w, top_line), XFASTINT (WVAR (w, top_line)) + n);
-  XSETFASTINT (WVAR (w, total_lines), XFASTINT (WVAR (w, total_lines)) - n);
+  WSET (w, top_line, make_number (XFASTINT (WGET (w, top_line)) + n));
+  WSET (w, total_lines, make_number (XFASTINT (WGET (w, total_lines)) - n));
 
   /* Handle just the top child in a vertical split.  */
-  if (!NILP (WVAR (w, vchild)))
-    set_menu_bar_lines_1 (WVAR (w, vchild), n);
+  if (!NILP (WGET (w, vchild)))
+    set_menu_bar_lines_1 (WGET (w, vchild), n);
 
   /* Adjust all children in a horizontal split.  */
-  for (window = WVAR (w, hchild); !NILP (window); window = WVAR (w, next))
+  for (window = WGET (w, hchild); !NILP (window); window = WGET (w, next))
     {
       w = XWINDOW (window);
       set_menu_bar_lines_1 (window, n);
@@ -289,20 +289,20 @@ make_frame (int mini_p)
   if (mini_p)
     {
       mini_window = make_window ();
-      WVAR (XWINDOW (root_window), next) = mini_window;
-      WVAR (XWINDOW (mini_window), prev) = root_window;
+      WSET (XWINDOW (root_window), next, mini_window);
+      WSET (XWINDOW (mini_window), prev, root_window);
       XWINDOW (mini_window)->mini = 1;
-      WVAR (XWINDOW (mini_window), frame) = frame;
+      WSET (XWINDOW (mini_window), frame, frame);
       FSET (f, minibuffer_window, mini_window);
     }
   else
     {
       mini_window = Qnil;
-      WVAR (XWINDOW (root_window), next) = Qnil;
+      WSET (XWINDOW (root_window), next, Qnil);
       FSET (f, minibuffer_window, Qnil);
     }
 
-  WVAR (XWINDOW (root_window), frame) = frame;
+  WSET (XWINDOW (root_window), frame, frame);
 
   /* 10 is arbitrary,
      just so that there is "something there."
@@ -311,21 +311,21 @@ make_frame (int mini_p)
   SET_FRAME_COLS (f, 10);
   FRAME_LINES (f) = 10;
 
-  XSETFASTINT (WVAR (XWINDOW (root_window), total_cols), 10);
-  XSETFASTINT (WVAR (XWINDOW (root_window), total_lines), (mini_p ? 9 : 10));
+  WSET (XWINDOW (root_window), total_cols, make_number (10));
+  WSET (XWINDOW (root_window), total_lines, make_number (mini_p ? 9 : 10));
 
   if (mini_p)
     {
-      XSETFASTINT (WVAR (XWINDOW (mini_window), total_cols), 10);
-      XSETFASTINT (WVAR (XWINDOW (mini_window), top_line), 9);
-      XSETFASTINT (WVAR (XWINDOW (mini_window), total_lines), 1);
+      WSET (XWINDOW (mini_window), total_cols, make_number (10));
+      WSET (XWINDOW (mini_window), top_line, make_number (9));
+      WSET (XWINDOW (mini_window), total_lines, make_number (1));
     }
 
   /* Choose a buffer for the frame's root window.  */
   {
     Lisp_Object buf;
 
-    WVAR (XWINDOW (root_window), buffer) = Qt;
+    WSET (XWINDOW (root_window), buffer, Qt);
     buf = Fcurrent_buffer ();
     /* If buf is a 'hidden' buffer (i.e. one whose name starts with
        a space), try to find another one.  */
@@ -344,7 +344,7 @@ make_frame (int mini_p)
 
   if (mini_p)
     {
-      WVAR (XWINDOW (mini_window), buffer) = Qt;
+      WSET (XWINDOW (mini_window), buffer, Qt);
       set_window_buffer (mini_window,
                         (NILP (Vminibuffer_list)
                          ? get_minibuffer (0)
@@ -376,7 +376,7 @@ make_frame_without_minibuffer (register Lisp_Object mini_window, KBOARD *kb, Lis
     CHECK_LIVE_WINDOW (mini_window);
 
   if (!NILP (mini_window)
-      && FRAME_KBOARD (XFRAME (WVAR (XWINDOW (mini_window), frame))) != kb)
+      && FRAME_KBOARD (XFRAME (WGET (XWINDOW (mini_window), frame))) != kb)
     error ("Frame and minibuffer must be on the same terminal");
 
   /* Make a frame containing just a root window.  */
@@ -406,7 +406,7 @@ make_frame_without_minibuffer (register Lisp_Object mini_window, KBOARD *kb, Lis
 
   /* Make the chosen minibuffer window display the proper minibuffer,
      unless it is already showing a minibuffer.  */
-  if (NILP (Fmemq (WVAR (XWINDOW (mini_window), buffer), Vminibuffer_list)))
+  if (NILP (Fmemq (WGET (XWINDOW (mini_window), buffer), Vminibuffer_list)))
     Fset_window_buffer (mini_window,
                        (NILP (Vminibuffer_list)
                         ? get_minibuffer (0)
@@ -439,9 +439,9 @@ make_minibuffer_frame (void)
 
   mini_window = FSET (f, minibuffer_window, FGET (f, root_window));
   XWINDOW (mini_window)->mini = 1;
-  WVAR (XWINDOW (mini_window), next) = Qnil;
-  WVAR (XWINDOW (mini_window), prev) = Qnil;
-  WVAR (XWINDOW (mini_window), frame) = frame;
+  WSET (XWINDOW (mini_window), next, Qnil);
+  WSET (XWINDOW (mini_window), prev, Qnil);
+  WSET (XWINDOW (mini_window), frame, frame);
 
   /* Put the proper buffer in that window.  */
 
@@ -1241,7 +1241,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
   if (EQ (FGET (f, minibuffer_window), minibuf_window))
     {
       Fset_window_buffer (FGET (sf, minibuffer_window),
-                         WVAR (XWINDOW (minibuf_window), buffer), Qnil);
+                         WGET (XWINDOW (minibuf_window), buffer), Qnil);
       minibuf_window = FGET (sf, minibuffer_window);
 
       /* If the dying minibuffer window was selected,
@@ -1672,17 +1672,17 @@ make_frame_visible_1 (Lisp_Object window)
 {
   struct window *w;
 
-  for (;!NILP (window); window = WVAR (w, next))
+  for (;!NILP (window); window = WGET (w, next))
     {
       w = XWINDOW (window);
 
-      if (!NILP (WVAR (w, buffer)))
-       BVAR (XBUFFER (WVAR (w, buffer)), display_time) = Fcurrent_time ();
+      if (!NILP (WGET (w, buffer)))
+       BVAR (XBUFFER (WGET (w, buffer)), display_time) = Fcurrent_time ();
 
-      if (!NILP (WVAR (w, vchild)))
-       make_frame_visible_1 (WVAR (w, vchild));
-      if (!NILP (WVAR (w, hchild)))
-       make_frame_visible_1 (WVAR (w, hchild));
+      if (!NILP (WGET (w, vchild)))
+       make_frame_visible_1 (WGET (w, vchild));
+      if (!NILP (WGET (w, hchild)))
+       make_frame_visible_1 (WGET (w, hchild));
     }
 }
 
@@ -1714,7 +1714,7 @@ displayed in the terminal.  */)
     {
       struct frame *sf = XFRAME (selected_frame);
       Fset_window_buffer (FGET (sf, minibuffer_window),
-                         WVAR (XWINDOW (minibuf_window), buffer), Qnil);
+                         WGET (XWINDOW (minibuf_window), buffer), Qnil);
       minibuf_window = FGET (sf, minibuffer_window);
     }
 
@@ -1752,7 +1752,7 @@ If omitted, FRAME defaults to the currently selected frame.  */)
     {
       struct frame *sf = XFRAME (selected_frame);
       Fset_window_buffer (FGET (sf, minibuffer_window),
-                         WVAR (XWINDOW (minibuf_window), buffer), Qnil);
+                         WGET (XWINDOW (minibuf_window), buffer), Qnil);
       minibuf_window = FGET (sf, minibuffer_window);
     }
 
index cf9d48f..7c4ccc1 100644 (file)
@@ -517,7 +517,7 @@ typedef struct frame *FRAME_PTR;
 #define XSETFRAME(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FRAME))
 
 /* Given a window, return its frame as a Lisp_Object.  */
-#define WINDOW_FRAME(w) WVAR (w, frame)
+#define WINDOW_FRAME(w) WGET (w, frame)
 
 /* Test a frame for particular kinds of display methods.  */
 #define FRAME_INITIAL_P(f) ((f)->output_method == output_initial)
index 95aec9e..25ab1ad 100644 (file)
@@ -692,7 +692,7 @@ get_logical_cursor_bitmap (struct window *w, Lisp_Object cursor)
 {
   Lisp_Object cmap, bm = Qnil;
 
-  if ((cmap = BVAR (XBUFFER (WVAR (w, buffer)), fringe_cursor_alist)), !NILP (cmap))
+  if ((cmap = BVAR (XBUFFER (WGET (w, buffer)), fringe_cursor_alist)), !NILP (cmap))
     {
       bm = Fassq (cursor, cmap);
       if (CONSP (bm))
@@ -729,7 +729,7 @@ get_logical_fringe_bitmap (struct window *w, Lisp_Object bitmap, int right_p, in
      If partial, lookup partial bitmap in default value if not found here.
      If not partial, or no partial spec is present, use non-partial bitmap.  */
 
-  if ((cmap = BVAR (XBUFFER (WVAR (w, buffer)), fringe_indicator_alist)), !NILP (cmap))
+  if ((cmap = BVAR (XBUFFER (WGET (w, buffer)), fringe_indicator_alist)), !NILP (cmap))
     {
       bm1 = Fassq (bitmap, cmap);
       if (CONSP (bm1))
@@ -956,7 +956,7 @@ update_window_fringes (struct window *w, int keep_current_p)
     return 0;
 
   if (!MINI_WINDOW_P (w)
-      && (ind = BVAR (XBUFFER (WVAR (w, buffer)), indicate_buffer_boundaries), !NILP (ind)))
+      && (ind = BVAR (XBUFFER (WGET (w, buffer)), indicate_buffer_boundaries), !NILP (ind)))
     {
       if (EQ (ind, Qleft) || EQ (ind, Qright))
        boundary_top = boundary_bot = arrow_top = arrow_bot = ind;
@@ -997,7 +997,7 @@ update_window_fringes (struct window *w, int keep_current_p)
            {
              if (top_ind_rn < 0 && row->visible_height > 0)
                {
-                 if (MATRIX_ROW_START_CHARPOS (row) <= BUF_BEGV (XBUFFER (WVAR (w, buffer)))
+                 if (MATRIX_ROW_START_CHARPOS (row) <= BUF_BEGV (XBUFFER (WGET (w, buffer)))
                      && !MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P (w, row))
                    row->indicate_bob_p = !NILP (boundary_top);
                  else
@@ -1007,7 +1007,7 @@ update_window_fringes (struct window *w, int keep_current_p)
 
              if (bot_ind_rn < 0)
                {
-                 if (MATRIX_ROW_END_CHARPOS (row) >= BUF_ZV (XBUFFER (WVAR (w, buffer)))
+                 if (MATRIX_ROW_END_CHARPOS (row) >= BUF_ZV (XBUFFER (WGET (w, buffer)))
                      && !MATRIX_ROW_PARTIALLY_VISIBLE_AT_BOTTOM_P (w, row))
                    row->indicate_eob_p = !NILP (boundary_bot), bot_ind_rn = rn;
                  else if (y + row->height >= yb)
@@ -1017,7 +1017,7 @@ update_window_fringes (struct window *w, int keep_current_p)
        }
     }
 
-  empty_pos = BVAR (XBUFFER (WVAR (w, buffer)), indicate_empty_lines);
+  empty_pos = BVAR (XBUFFER (WGET (w, buffer)), indicate_empty_lines);
   if (!NILP (empty_pos) && !EQ (empty_pos, Qright))
     empty_pos = WINDOW_LEFT_FRINGE_WIDTH (w) == 0 ? Qright : Qleft;
 
@@ -1740,7 +1740,7 @@ Return nil if POS is not visible in WINDOW.  */)
   else if (w == XWINDOW (selected_window))
     textpos = PT;
   else
-    textpos = XMARKER (WVAR (w, pointm))->charpos;
+    textpos = XMARKER (WGET (w, pointm))->charpos;
 
   row = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
   row = row_containing_pos (w, textpos, row, NULL, 0);
index a6a9a9a..fca9f4c 100644 (file)
@@ -258,7 +258,7 @@ skip_invisible (ptrdiff_t pos, ptrdiff_t *next_boundary_p, ptrdiff_t to, Lisp_Ob
      the next property change */
   prop = Fget_char_property (position, Qinvisible,
                             (!NILP (window)
-                             && EQ (WVAR (XWINDOW (window), buffer), buffer))
+                             && EQ (WGET (XWINDOW (window), buffer), buffer))
                             ? window : buffer);
   inv_p = TEXT_PROP_MEANS_INVISIBLE (prop);
   /* 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_
       width = window_body_cols (win);
       /* We must make room for continuation marks if we don't have fringes.  */
 #ifdef HAVE_WINDOW_SYSTEM
-      if (!FRAME_WINDOW_P (XFRAME (WVAR (win, frame))))
+      if (!FRAME_WINDOW_P (XFRAME (WGET (win, frame))))
 #endif
        width -= 1;
     }
 
   continuation_glyph_width = 1;
 #ifdef HAVE_WINDOW_SYSTEM
-  if (FRAME_WINDOW_P (XFRAME (WVAR (win, frame))))
+  if (FRAME_WINDOW_P (XFRAME (WGET (win, frame))))
     continuation_glyph_width = 0;  /* In the fringe.  */
 #endif
 
@@ -1787,7 +1787,7 @@ visible section of the buffer, and pass LINE and COL as TOPOS.  */)
                         ? (window_body_cols (w)
                            - (
 #ifdef HAVE_WINDOW_SYSTEM
-                              FRAME_WINDOW_P (XFRAME (WVAR (w, frame))) ? 0 :
+                              FRAME_WINDOW_P (XFRAME (WGET (w, frame))) ? 0 :
 #endif
                               1))
                         : XINT (XCAR (topos))),
@@ -1837,7 +1837,7 @@ vmotion (register ptrdiff_t from, register EMACS_INT vtarget, struct window *w)
 
   /* If the window contains this buffer, use it for getting text properties.
      Otherwise use the current buffer as arg for doing that.  */
-  if (EQ (WVAR (w, buffer), Fcurrent_buffer ()))
+  if (EQ (WGET (w, buffer), Fcurrent_buffer ()))
     text_prop_object = window;
   else
     text_prop_object = Fcurrent_buffer ();
@@ -1998,14 +1998,14 @@ whether or not it is currently displayed in some window.  */)
 
   old_buffer = Qnil;
   GCPRO3 (old_buffer, old_charpos, old_bytepos);
-  if (XBUFFER (WVAR (w, buffer)) != current_buffer)
+  if (XBUFFER (WGET (w, buffer)) != current_buffer)
     {
       /* Set the window's buffer temporarily to the current buffer.  */
-      old_buffer = WVAR (w, buffer);
-      old_charpos = XMARKER (WVAR (w, pointm))->charpos;
-      old_bytepos = XMARKER (WVAR (w, pointm))->bytepos;
-      XSETBUFFER (WVAR (w, buffer), current_buffer);
-      set_marker_both (WVAR (w, pointm), WVAR (w, buffer),
+      old_buffer = WGET (w, buffer);
+      old_charpos = XMARKER (WGET (w, pointm))->charpos;
+      old_bytepos = XMARKER (WGET (w, pointm))->bytepos;
+      WSET (w, buffer, Fcurrent_buffer ());
+      set_marker_both (WGET (w, pointm), WGET (w, buffer),
                       BUF_PT (current_buffer), BUF_PT_BYTE (current_buffer));
     }
 
@@ -2137,7 +2137,7 @@ whether or not it is currently displayed in some window.  */)
            }
          move_it_in_display_line
            (&it, ZV,
-            (int)(cols * FRAME_COLUMN_WIDTH (XFRAME (WVAR (w, frame))) + 0.5),
+            (int)(cols * FRAME_COLUMN_WIDTH (XFRAME (WGET (w, frame))) + 0.5),
             MOVE_TO_X);
        }
 
@@ -2147,8 +2147,8 @@ whether or not it is currently displayed in some window.  */)
 
   if (BUFFERP (old_buffer))
     {
-      WVAR (w, buffer) = old_buffer;
-      set_marker_both (WVAR (w, pointm), WVAR (w, buffer),
+      WSET (w, buffer, old_buffer);
+      set_marker_both (WGET (w, pointm), WGET (w, buffer),
                       old_charpos, old_bytepos);
     }
 
index 705cd77..1753d8c 100644 (file)
@@ -1820,7 +1820,7 @@ prepare_to_modify_buffer (ptrdiff_t start, ptrdiff_t end,
 
   /* Let redisplay consider other windows than selected_window
      if modifying another buffer.  */
-  if (XBUFFER (WVAR (XWINDOW (selected_window), buffer)) != current_buffer)
+  if (XBUFFER (WGET (XWINDOW (selected_window), buffer)) != current_buffer)
     ++windows_or_buffers_changed;
 
   if (BUF_INTERVALS (current_buffer) != 0)
index de77f7c..758085d 100644 (file)
@@ -800,7 +800,7 @@ This function is called by the editor initialization to begin editing.  */)
   update_mode_lines = 1;
 
   if (command_loop_level
-      && current_buffer != XBUFFER (WVAR (XWINDOW (selected_window), buffer)))
+      && current_buffer != XBUFFER (WGET (XWINDOW (selected_window), buffer)))
     buffer = Fcurrent_buffer ();
   else
     buffer = Qnil;
@@ -1382,8 +1382,8 @@ command_loop_1 (void)
        Fkill_emacs (Qnil);
 
       /* Make sure the current window's buffer is selected.  */
-      if (XBUFFER (WVAR (XWINDOW (selected_window), buffer)) != current_buffer)
-       set_buffer_internal (XBUFFER (WVAR (XWINDOW (selected_window), buffer)));
+      if (XBUFFER (WGET (XWINDOW (selected_window), buffer)) != current_buffer)
+       set_buffer_internal (XBUFFER (WGET (XWINDOW (selected_window), buffer)));
 
       /* Display any malloc warning that just came out.  Use while because
         displaying one warning can cause another.  */
@@ -1452,8 +1452,8 @@ command_loop_1 (void)
       /* A filter may have run while we were reading the input.  */
       if (! FRAME_LIVE_P (XFRAME (selected_frame)))
        Fkill_emacs (Qnil);
-      if (XBUFFER (WVAR (XWINDOW (selected_window), buffer)) != current_buffer)
-       set_buffer_internal (XBUFFER (WVAR (XWINDOW (selected_window), buffer)));
+      if (XBUFFER (WGET (XWINDOW (selected_window), buffer)) != current_buffer)
+       set_buffer_internal (XBUFFER (WGET (XWINDOW (selected_window), buffer)));
 
       ++num_input_keys;
 
@@ -1484,7 +1484,7 @@ command_loop_1 (void)
        {
          struct buffer *b;
          XWINDOW (selected_window)->force_start = 0;
-         b = XBUFFER (WVAR (XWINDOW (selected_window), buffer));
+         b = XBUFFER (WGET (XWINDOW (selected_window), buffer));
          BUF_BEG_UNCHANGED (b) = BUF_END_UNCHANGED (b) = 0;
        }
 
@@ -5174,8 +5174,8 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
          if (STRINGP (string))
            string_info = Fcons (string, make_number (charpos));
          textpos = (w == XWINDOW (selected_window)
-                    && current_buffer == XBUFFER (WVAR (w, buffer)))
-           ? PT : XMARKER (WVAR (w, pointm))->charpos;
+                    && current_buffer == XBUFFER (WGET (w, buffer)))
+           ? PT : XMARKER (WGET (w, pointm))->charpos;
 
          xret = wx;
          yret = wy;
@@ -5563,7 +5563,7 @@ make_lispy_event (struct input_event *event)
          int fuzz;
 
          if (WINDOWP (event->frame_or_window))
-           f = XFRAME (WVAR (XWINDOW (event->frame_or_window), frame));
+           f = XFRAME (WGET (XWINDOW (event->frame_or_window), frame));
          else if (FRAMEP (event->frame_or_window))
            f = XFRAME (event->frame_or_window);
          else
@@ -5731,7 +5731,7 @@ make_lispy_event (struct input_event *event)
          int is_double;
 
          if (WINDOWP (event->frame_or_window))
-           fr = XFRAME (WVAR (XWINDOW (event->frame_or_window), frame));
+           fr = XFRAME (WGET (XWINDOW (event->frame_or_window), frame));
          else if (FRAMEP (event->frame_or_window))
            fr = XFRAME (event->frame_or_window);
          else
@@ -9401,8 +9401,8 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
                {
                  if (! FRAME_LIVE_P (XFRAME (selected_frame)))
                    Fkill_emacs (Qnil);
-                 if (XBUFFER (WVAR (XWINDOW (selected_window), buffer)) != current_buffer)
-                   Fset_buffer (WVAR (XWINDOW (selected_window), buffer));
+                 if (XBUFFER (WGET (XWINDOW (selected_window), buffer)) != current_buffer)
+                   Fset_buffer (WGET (XWINDOW (selected_window), buffer));
                }
 
              orig_local_map = get_local_map (PT, current_buffer, Qlocal_map);
@@ -9494,8 +9494,8 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
                     not the current buffer.  If we're at the
                     beginning of a key sequence, switch buffers.  */
                  if (WINDOWP (window)
-                     && BUFFERP (WVAR (XWINDOW (window), buffer))
-                     && XBUFFER (WVAR (XWINDOW (window), buffer)) != current_buffer)
+                     && BUFFERP (WGET (XWINDOW (window), buffer))
+                     && XBUFFER (WGET (XWINDOW (window), buffer)) != current_buffer)
                    {
                      ASET (raw_keybuf, raw_keybuf_count, key);
                      raw_keybuf_count++;
@@ -9516,7 +9516,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
 
                      if (! FRAME_LIVE_P (XFRAME (selected_frame)))
                        Fkill_emacs (Qnil);
-                     set_buffer_internal (XBUFFER (WVAR (XWINDOW (window), buffer)));
+                     set_buffer_internal (XBUFFER (WGET (XWINDOW (window), buffer)));
                      orig_local_map = get_local_map (PT, current_buffer,
                                                      Qlocal_map);
                      orig_keymap = get_local_map (PT, current_buffer,
@@ -11200,7 +11200,7 @@ The `posn-' functions access elements of such lists.  */)
                      ? window_box_left_offset (w, TEXT_AREA)
                      : 0)));
       XSETINT (y, WINDOW_TO_FRAME_PIXEL_Y (w, XINT (y)));
-      frame_or_window = WVAR (w, frame);
+      frame_or_window = WGET (w, frame);
     }
 
   CHECK_LIVE_FRAME (frame_or_window);
index bd2f3c9..a0a3528 100644 (file)
@@ -1560,8 +1560,8 @@ like in the respective argument of `key-binding'. */)
       window = POSN_WINDOW (position);
 
       if (WINDOWP (window)
-         && BUFFERP (WVAR (XWINDOW (window), buffer))
-         && XBUFFER (WVAR (XWINDOW (window), buffer)) != current_buffer)
+         && BUFFERP (WGET (XWINDOW (window), buffer))
+         && XBUFFER (WGET (XWINDOW (window), buffer)) != current_buffer)
        {
          /* Arrange to go back to the original buffer once we're done
             processing the key sequence.  We don't use
@@ -1573,7 +1573,7 @@ like in the respective argument of `key-binding'. */)
 
          record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
 
-         set_buffer_internal (XBUFFER (WVAR (XWINDOW (window), buffer)));
+         set_buffer_internal (XBUFFER (WGET (XWINDOW (window), buffer)));
        }
     }
 
index 8a6a2a9..aa06daa 100644 (file)
@@ -1787,7 +1787,7 @@ typedef struct {
    vchild, and hchild members are all nil.  */
 
 #define CHECK_LIVE_WINDOW(x) \
-  CHECK_TYPE (WINDOWP (x) && !NILP (WVAR (XWINDOW (x), buffer)), \
+  CHECK_TYPE (WINDOWP (x) && !NILP (WGET (XWINDOW (x), buffer)), \
              Qwindow_live_p, x)
 
 #define CHECK_PROCESS(x) \
index a5f963d..4ef433b 100644 (file)
@@ -115,7 +115,7 @@ choose_minibuf_frame (void)
       /* Under X, we come here with minibuf_window being the
         minibuffer window of the unused termcap window created in
         init_window_once.  That window doesn't have a buffer.  */
-      buffer = WVAR (XWINDOW (minibuf_window), buffer);
+      buffer = WGET (XWINDOW (minibuf_window), buffer);
       if (BUFFERP (buffer))
        Fset_window_buffer (FGET (sf, minibuffer_window), buffer, Qnil);
       minibuf_window = FGET (sf, minibuffer_window);
@@ -612,7 +612,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
   FOR_EACH_FRAME (dummy, frame)
     {
       Lisp_Object root_window = Fframe_root_window (frame);
-      Lisp_Object mini_window = WVAR (XWINDOW (root_window), next);
+      Lisp_Object mini_window = WGET (XWINDOW (root_window), next);
 
       if (! NILP (mini_window) && ! EQ (mini_window, minibuf_window)
          && !NILP (Fwindow_minibuffer_p (mini_window)))
@@ -687,7 +687,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
       XWINDOW (minibuf_window)->must_be_updated_p = 1;
       update_frame (XFRAME (selected_frame), 1, 1);
       {
-        struct frame *f = XFRAME (WVAR (XWINDOW (minibuf_window), frame));
+        struct frame *f = XFRAME (WGET (XWINDOW (minibuf_window), frame));
         struct redisplay_interface *rif = FRAME_RIF (f);
         if (rif && rif->flush_display)
           rif->flush_display (f);
@@ -844,7 +844,7 @@ read_minibuf_unwind (Lisp_Object data)
   window = minibuf_window;
   /* To keep things predictable, in case it matters, let's be in the
      minibuffer when we reset the relevant variables.  */
-  Fset_buffer (WVAR (XWINDOW (window), buffer));
+  Fset_buffer (WGET (XWINDOW (window), buffer));
 
   /* Restore prompt, etc, from outer minibuffer level.  */
   minibuf_prompt = Fcar (minibuf_save_list);
index 8ff0387..cc206b6 100644 (file)
@@ -594,7 +594,7 @@ dos_set_window_size (int *rows, int *cols)
       Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
       Lisp_Object window = hlinfo->mouse_face_window;
 
-      if (! NILP (window) && XFRAME (WVAR (XWINDOW (window), frame)) == f)
+      if (! NILP (window) && XFRAME (WGET (XWINDOW (window), frame)) == f)
        {
          hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
          hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
@@ -1255,7 +1255,7 @@ IT_update_begin (struct frame *f)
          /* If the mouse highlight is in the window that was deleted
             (e.g., if it was popped by completion), clear highlight
             unconditionally.  */
-         if (NILP (WVAR (w, buffer)))
+         if (NILP (WGET (w, buffer)))
            hlinfo->mouse_face_window = Qnil;
          else
            {
@@ -1265,7 +1265,7 @@ IT_update_begin (struct frame *f)
                  break;
            }
 
-         if (NILP (WVAR (w, buffer)) || i < w->desired_matrix->nrows)
+         if (NILP (WGET (w, buffer)) || i < w->desired_matrix->nrows)
            clear_mouse_face (hlinfo);
        }
     }
@@ -1327,7 +1327,7 @@ IT_frame_up_to_date (struct frame *f)
     new_cursor = frame_desired_cursor;
   else
     {
-      struct buffer *b = XBUFFER (WVAR (sw, buffer));
+      struct buffer *b = XBUFFER (WGET (sw, buffer));
 
       if (EQ (BVAR (b,cursor_type), Qt))
        new_cursor = frame_desired_cursor;
index 9a5ecd4..98477c9 100644 (file)
@@ -607,7 +607,7 @@ ns_set_name_as_filename (struct frame *f)
 {
   NSView *view;
   Lisp_Object name, filename;
-  Lisp_Object buf = WVAR (XWINDOW (FGET (f, selected_window)), buffer);
+  Lisp_Object buf = WGET (XWINDOW (FGET (f, selected_window)), buffer);
   const char *title;
   NSAutoreleasePool *pool;
   struct gcpro gcpro1;
index 619cd2c..f13c513 100644 (file)
@@ -193,7 +193,7 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu)
        = alloca (previous_menu_items_used * sizeof *previous_items);
 
       /* lisp preliminaries */
-      buffer = WVAR (XWINDOW (FRAME_SELECTED_WINDOW (f)), buffer);
+      buffer = WGET (XWINDOW (FRAME_SELECTED_WINDOW (f)), buffer);
       specbind (Qinhibit_quit, Qt);
       specbind (Qdebug_on_next_call, Qnil);
       record_unwind_save_match_data ();
index d420275..67f3205 100644 (file)
@@ -667,7 +667,7 @@ ns_update_window_end (struct window *w, int cursor_on_p,
    external (RIF) call; for one window called before update_end
    -------------------------------------------------------------------------- */
 {
-  Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (WVAR (w, frame)));
+  Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (WGET (w, frame)));
 
   /* note: this fn is nearly identical in all terms */
   if (!w->pseudo_window_p)
@@ -2035,7 +2035,7 @@ ns_scroll_run (struct window *w, struct run *run)
     External (RIF):  Insert or delete n lines at line vpos
    -------------------------------------------------------------------------- */
 {
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
   int x, y, width, height, from_y, to_y, bottom_y;
 
   NSTRACE (ns_scroll_run);
@@ -2114,7 +2114,7 @@ ns_after_update_window_line (struct glyph_row *desired_row)
      full-width rows stays visible in the internal border.
      Under NS this is drawn inside the fringes. */
   if (windows_or_buffers_changed
-      && (f = XFRAME (WVAR (w, frame)),
+      && (f = XFRAME (WGET (w, frame)),
          width = FRAME_INTERNAL_BORDER_WIDTH (f),
          width != 0)
       && (height = desired_row->visible_height,
@@ -3622,9 +3622,9 @@ ns_set_vertical_scroll_bar (struct window *window,
   EmacsScroller *bar;
 
   /* optimization; display engine sends WAY too many of these.. */
-  if (!NILP (WVAR (window, vertical_scroll_bar)))
+  if (!NILP (WGET (window, vertical_scroll_bar)))
     {
-      bar = XNS_SCROLL_BAR (WVAR (window, vertical_scroll_bar));
+      bar = XNS_SCROLL_BAR (WGET (window, vertical_scroll_bar));
       if ([bar checkSamePosition: position portion: portion whole: whole])
         {
           if (view->scrollbarsNeedingUpdate == 0)
@@ -3672,27 +3672,27 @@ ns_set_vertical_scroll_bar (struct window *window,
   /* we want at least 5 lines to display a scrollbar */
   if (WINDOW_TOTAL_LINES (window) < 5)
     {
-      if (!NILP (WVAR (window, vertical_scroll_bar)))
+      if (!NILP (WGET (window, vertical_scroll_bar)))
         {
-          bar = XNS_SCROLL_BAR (WVAR (window, vertical_scroll_bar));
+          bar = XNS_SCROLL_BAR (WGET (window, vertical_scroll_bar));
           [bar removeFromSuperview];
-          WVAR (window, vertical_scroll_bar) = Qnil;
+          WSET (window, vertical_scroll_bar, Qnil);
         }
       ns_clear_frame_area (f, sb_left, top, width, height);
       UNBLOCK_INPUT;
       return;
     }
 
-  if (NILP (WVAR (window, vertical_scroll_bar)))
+  if (NILP (WGET (window, vertical_scroll_bar)))
     {
       ns_clear_frame_area (f, sb_left, top, width, height);
       bar = [[EmacsScroller alloc] initFrame: r window: win];
-      WVAR (window, vertical_scroll_bar) = make_save_value (bar, 0);
+      WSET (window, vertical_scroll_bar, make_save_value (bar, 0));
     }
   else
     {
       NSRect oldRect;
-      bar = XNS_SCROLL_BAR (WVAR (window, vertical_scroll_bar));
+      bar = XNS_SCROLL_BAR (WGET (window, vertical_scroll_bar));
       oldRect = [bar frame];
       r.size.width = oldRect.size.width;
       if (FRAME_LIVE_P (f) && !NSEqualRects (oldRect, r))
@@ -3739,9 +3739,9 @@ ns_redeem_scroll_bar (struct window *window)
 {
   id bar;
   NSTRACE (ns_redeem_scroll_bar);
-  if (!NILP (WVAR (window, vertical_scroll_bar)))
+  if (!NILP (WGET (window, vertical_scroll_bar)))
     {
-      bar = XNS_SCROLL_BAR (WVAR (window, vertical_scroll_bar));
+      bar = XNS_SCROLL_BAR (WGET (window, vertical_scroll_bar));
       [bar reprieve];
     }
 }
@@ -6062,7 +6062,7 @@ ns_term_shutdown (int sig)
   Lisp_Object str = Qnil;
   struct frame *f = SELECTED_FRAME ();
   struct buffer *curbuf
-    = XBUFFER (WVAR (XWINDOW (FGET (f, selected_window)), buffer));
+    = XBUFFER (WGET (XWINDOW (FGET (f, selected_window)), buffer));
  
   if ([attribute isEqualToString:NSAccessibilityRoleAttribute])
     return NSAccessibilityTextFieldRole;
@@ -6237,7 +6237,7 @@ ns_term_shutdown (int sig)
   if (pixel_height == 0) pixel_height = 1;
   min_portion = 20 / pixel_height;
 
-  frame = XFRAME (WVAR (XWINDOW (win), frame));
+  frame = XFRAME (WGET (XWINDOW (win), frame));
   if (FRAME_LIVE_P (frame))
     {
       int i;
@@ -6276,7 +6276,7 @@ ns_term_shutdown (int sig)
 {
   NSTRACE (EmacsScroller_dealloc);
   if (!NILP (win))
-    WVAR (XWINDOW (win), vertical_scroll_bar) = Qnil;
+    WSET (XWINDOW (win), vertical_scroll_bar, Qnil);
   [super dealloc];
 }
 
index 8db2223..d45d319 100644 (file)
@@ -1773,10 +1773,10 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
          strout ("#<window ", -1, -1, printcharfun);
          len = sprintf (buf, "%d", XWINDOW (obj)->sequence_number);
          strout (buf, len, len, printcharfun);
-         if (!NILP (WVAR (XWINDOW (obj), buffer)))
+         if (!NILP (WGET (XWINDOW (obj), buffer)))
            {
              strout (" on ", -1, -1, printcharfun);
-             print_string (BVAR (XBUFFER (WVAR (XWINDOW (obj), buffer)), name),
+             print_string (BVAR (XBUFFER (WGET (XWINDOW (obj), buffer)), name),
                            printcharfun);
            }
          PRINTCHAR ('>');
index ee5d82f..02f134e 100644 (file)
@@ -587,7 +587,7 @@ get_char_property_and_overlay (Lisp_Object position, register Lisp_Object prop,
   if (WINDOWP (object))
     {
       w = XWINDOW (object);
-      object = WVAR (w, buffer);
+      object = WGET (w, buffer);
     }
   if (BUFFERP (object))
     {
index be64e27..b82d4bc 100644 (file)
@@ -5617,7 +5617,8 @@ Text larger than the specified size is clipped.  */)
 
   /* Set up the frame's root window.  */
   w = XWINDOW (FRAME_ROOT_WINDOW (f));
-  WVAR (w, left_col) = WVAR (w, top_line) = make_number (0);
+  WSET (w, left_col, make_number (0));
+  WSET (w, top_line, make_number (0));
 
   if (CONSP (Vx_max_tooltip_size)
       && INTEGERP (XCAR (Vx_max_tooltip_size))
@@ -5625,22 +5626,22 @@ Text larger than the specified size is clipped.  */)
       && INTEGERP (XCDR (Vx_max_tooltip_size))
       && XINT (XCDR (Vx_max_tooltip_size)) > 0)
     {
-      WVAR (w, total_cols) = XCAR (Vx_max_tooltip_size);
-      WVAR (w, total_lines) = XCDR (Vx_max_tooltip_size);
+      WSET (w, total_cols, XCAR (Vx_max_tooltip_size));
+      WSET (w, total_lines, XCDR (Vx_max_tooltip_size));
     }
   else
     {
-      WVAR (w, total_cols) = make_number (80);
-      WVAR (w, total_lines) = make_number (40);
+      WSET (w, total_cols, make_number (80));
+      WSET (w, total_lines, make_number (40));
     }
 
-  FRAME_TOTAL_COLS (f) = XINT (WVAR (w, total_cols));
+  FRAME_TOTAL_COLS (f) = XINT (WGET (w, total_cols));
   adjust_glyphs (f);
   w->pseudo_window_p = 1;
 
   /* Display the tooltip text in a temporary buffer.  */
   old_buffer = current_buffer;
-  set_buffer_internal_1 (XBUFFER (WVAR (XWINDOW (FRAME_ROOT_WINDOW (f)), buffer)));
+  set_buffer_internal_1 (XBUFFER (WGET (XWINDOW (FRAME_ROOT_WINDOW (f)), buffer)));
   BVAR (current_buffer, truncate_lines) = Qnil;
   clear_glyph_matrix (w->desired_matrix);
   clear_glyph_matrix (w->current_matrix);
@@ -5702,7 +5703,7 @@ Text larger than the specified size is clipped.  */)
       /* w->total_cols and FRAME_TOTAL_COLS want the width in columns,
         not in pixels.  */
       width /= WINDOW_FRAME_COLUMN_WIDTH (w);
-      WVAR (w, total_cols) = make_number (width);
+      WSET (w, total_cols, make_number (width));
       FRAME_TOTAL_COLS (f) = width;
       adjust_glyphs (f);
       w->pseudo_window_p = 1;
index a40bb66..80f48bd 100644 (file)
@@ -394,7 +394,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
       if (! menubar_widget)
        previous_menu_items_used = 0;
 
-      buffer = WVAR (XWINDOW (FRAME_SELECTED_WINDOW (f)), buffer);
+      buffer = WGET (XWINDOW (FRAME_SELECTED_WINDOW (f)), buffer);
       specbind (Qinhibit_quit, Qt);
       /* Don't let the debugger step into this code
         because it is not reentrant.  */
index 96072ac..fc4522d 100644 (file)
@@ -649,7 +649,7 @@ static void
 x_update_window_end (struct window *w, int cursor_on_p,
                     int mouse_face_overwritten_p)
 {
-  Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (WVAR (w, frame)));
+  Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (WGET (w, frame)));
 
   if (!w->pseudo_window_p)
     {
@@ -754,7 +754,7 @@ x_after_update_window_line (struct glyph_row *desired_row)
      overhead is very small.  */
   if (windows_or_buffers_changed
       && desired_row->full_width_p
-      && (f = XFRAME (WVAR (w, frame)),
+      && (f = XFRAME (WGET (w, frame)),
          width = FRAME_INTERNAL_BORDER_WIDTH (f),
          width != 0)
       && (height = desired_row->visible_height,
@@ -2718,7 +2718,7 @@ x_ins_del_lines (struct frame *f, int vpos, int n)
 static void
 x_scroll_run (struct window *w, struct run *run)
 {
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
   int x, y, width, height, from_y, to_y, bottom_y;
   HWND hwnd = FRAME_W32_WINDOW (f);
   HRGN expect_dirty;
@@ -3670,7 +3670,7 @@ x_scroll_bar_remove (struct scroll_bar *bar)
   my_destroy_window (f, SCROLL_BAR_W32_WINDOW (bar));
 
   /* Dissociate this scroll bar from its window.  */
-  WVAR (XWINDOW (bar->window), vertical_scroll_bar) = Qnil;
+  WSET (XWINDOW (bar->window), vertical_scroll_bar, Qnil);
 
   UNBLOCK_INPUT;
 }
@@ -3683,7 +3683,7 @@ static void
 w32_set_vertical_scroll_bar (struct window *w,
                             int portion, int whole, int position)
 {
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
   struct scroll_bar *bar;
   int top, height, left, sb_left, width, sb_width;
   int window_y, window_height;
@@ -3723,7 +3723,7 @@ w32_set_vertical_scroll_bar (struct window *w,
                             || WINDOW_RIGHT_MARGIN_COLS (w) == 0));
 
   /* Does the scroll bar exist yet?  */
-  if (NILP (WVAR (w, vertical_scroll_bar)))
+  if (NILP (WGET (w, vertical_scroll_bar)))
     {
       HDC hdc;
       BLOCK_INPUT;
@@ -3745,7 +3745,7 @@ w32_set_vertical_scroll_bar (struct window *w,
       /* It may just need to be moved and resized.  */
       HWND hwnd;
 
-      bar = XSCROLL_BAR (WVAR (w, vertical_scroll_bar));
+      bar = XSCROLL_BAR (WGET (w, vertical_scroll_bar));
       hwnd = SCROLL_BAR_W32_WINDOW (bar);
 
       /* If already correctly positioned, do nothing.  */
@@ -3807,7 +3807,7 @@ w32_set_vertical_scroll_bar (struct window *w,
 
   w32_set_scroll_bar_thumb (bar, portion, position, whole);
 
-  XSETVECTOR (WVAR (w, vertical_scroll_bar), bar);
+  XSETVECTOR (WGET (w, vertical_scroll_bar), bar);
 }
 
 
@@ -3852,10 +3852,10 @@ w32_redeem_scroll_bar (struct window *window)
   struct frame *f;
 
   /* We can't redeem this window's scroll bar if it doesn't have one.  */
-  if (NILP (WVAR (window, vertical_scroll_bar)))
+  if (NILP (WGET (window, vertical_scroll_bar)))
     abort ();
 
-  bar = XSCROLL_BAR (WVAR (window, vertical_scroll_bar));
+  bar = XSCROLL_BAR (WGET (window, vertical_scroll_bar));
 
   /* Unlink it from the condemned list.  */
   f = XFRAME (WINDOW_FRAME (window));
@@ -3863,11 +3863,11 @@ w32_redeem_scroll_bar (struct window *window)
     {
       /* If the prev pointer is nil, it must be the first in one of
          the lists.  */
-      if (EQ (FRAME_SCROLL_BARS (f), WVAR (window, vertical_scroll_bar)))
+      if (EQ (FRAME_SCROLL_BARS (f), WGET (window, vertical_scroll_bar)))
         /* It's not condemned.  Everything's fine.  */
         return;
       else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f),
-                   WVAR (window, vertical_scroll_bar)))
+                   WGET (window, vertical_scroll_bar)))
         FSET (f, condemned_scroll_bars, bar->next);
       else
         /* If its prev pointer is nil, it must be at the front of
@@ -4426,8 +4426,8 @@ w32_read_socket (struct terminal *terminal, int expected,
                         create event iff we don't leave the
                         selected frame.  */
                      && (focus_follows_mouse
-                         || (EQ (WVAR (XWINDOW (window), frame),
-                                 WVAR (XWINDOW (selected_window), frame)))))
+                         || (EQ (WGET (XWINDOW (window), frame),
+                                 WGET (XWINDOW (selected_window), frame)))))
                    {
                      inev.kind = SELECT_WINDOW_EVENT;
                      inev.frame_or_window = window;
@@ -5042,7 +5042,7 @@ static void
 x_draw_bar_cursor (struct window *w, struct glyph_row *row,
                   int width, enum text_cursor_kinds kind)
 {
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
   struct glyph *cursor_glyph;
 
   /* If cursor is out of bounds, don't draw garbage.  This can happen
index 1c62e6f..a71fa0b 100644 (file)
@@ -178,7 +178,7 @@ DEFUN ("window-frame", Fwindow_frame, Swindow_frame, 1, 1, 0,
 If WINDOW is omitted or nil, it defaults to the selected window.  */)
   (Lisp_Object window)
 {
-  return WVAR (decode_any_window (window), frame);
+  return WGET (decode_any_window (window), frame);
 }
 
 DEFUN ("frame-root-window", Fframe_root_window, Sframe_root_window, 0, 1, 0,
@@ -244,12 +244,12 @@ the first window of that frame.  */)
       window = FGET (XFRAME (frame_or_window), root_window);
     }
 
-  while (NILP (WVAR (XWINDOW (window), buffer)))
+  while (NILP (WGET (XWINDOW (window), buffer)))
     {
-      if (! NILP (WVAR (XWINDOW (window), hchild)))
-       window = WVAR (XWINDOW (window), hchild);
-      else if (! NILP (WVAR (XWINDOW (window), vchild)))
-       window = WVAR (XWINDOW (window), vchild);
+      if (! NILP (WGET (XWINDOW (window), hchild)))
+       window = WGET (XWINDOW (window), hchild);
+      else if (! NILP (WGET (XWINDOW (window), vchild)))
+       window = WGET (XWINDOW (window), vchild);
       else
        abort ();
     }
@@ -338,7 +338,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
   if (NILP (norecord))
     {
       w->use_time = ++window_select_count;
-      record_buffer (WVAR (w, buffer));
+      record_buffer (WGET (w, buffer));
     }
 
   if (EQ (window, selected_window) && !inhibit_point_swap)
@@ -366,17 +366,17 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
   if (!inhibit_point_swap)
     {
       ow = XWINDOW (selected_window);
-      if (! NILP (WVAR (ow, buffer)))
-       set_marker_both (WVAR (ow, pointm), WVAR (ow, buffer),
-                        BUF_PT (XBUFFER (WVAR (ow, buffer))),
-                        BUF_PT_BYTE (XBUFFER (WVAR (ow, buffer))));
+      if (! NILP (WGET (ow, buffer)))
+       set_marker_both (WGET (ow, pointm), WGET (ow, buffer),
+                        BUF_PT (XBUFFER (WGET (ow, buffer))),
+                        BUF_PT_BYTE (XBUFFER (WGET (ow, buffer))));
     }
 
   selected_window = window;
 
-  Fset_buffer (WVAR (w, buffer));
+  Fset_buffer (WGET (w, buffer));
 
-  BVAR (XBUFFER (WVAR (w, buffer)), last_selected_window) = window;
+  BVAR (XBUFFER (WGET (w, buffer)), last_selected_window) = window;
 
   /* Go to the point recorded in the window.
      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)
      redisplay_window has altered point after scrolling,
      because it makes the change only in the window.  */
   {
-    register ptrdiff_t new_point = marker_position (WVAR (w, pointm));
+    register ptrdiff_t new_point = marker_position (WGET (w, pointm));
     if (new_point < BEGV)
       SET_PT (BEGV);
     else if (new_point > ZV)
@@ -419,7 +419,7 @@ If WINDOW is omitted or nil, it defaults to the selected window.
 Return nil for an internal window or a deleted window.  */)
   (Lisp_Object window)
 {
-  return WVAR (decode_any_window (window), buffer);
+  return WGET (decode_any_window (window), buffer);
 }
 
 DEFUN ("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.
 Return nil for a window with no parent (e.g. a root window).  */)
   (Lisp_Object window)
 {
-  return WVAR (decode_any_window (window), parent);
+  return WGET (decode_any_window (window), parent);
 }
 
 DEFUN ("window-top-child", Fwindow_top_child, Swindow_top_child, 1, 1, 0,
@@ -439,7 +439,7 @@ horizontal combination.  */)
   (Lisp_Object window)
 {
   CHECK_WINDOW (window);
-  return WVAR (decode_any_window (window), vchild);
+  return WGET (decode_any_window (window), vchild);
 }
 
 DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 1, 1, 0,
@@ -450,7 +450,7 @@ vertical combination.  */)
   (Lisp_Object window)
 {
   CHECK_WINDOW (window);
-  return WVAR (decode_any_window (window), hchild);
+  return WGET (decode_any_window (window), hchild);
 }
 
 DEFUN ("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.
 Return nil if WINDOW has no next sibling.  */)
   (Lisp_Object window)
 {
-  return WVAR (decode_any_window (window), next);
+  return WGET (decode_any_window (window), next);
 }
 
 DEFUN ("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.
 Return nil if WINDOW has no previous sibling.  */)
   (Lisp_Object window)
 {
-  return WVAR (decode_any_window (window), prev);
+  return WGET (decode_any_window (window), prev);
 }
 
 DEFUN ("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
 WINDOW are never \(re-)combined with WINDOW's siblings.  */)
   (Lisp_Object window)
 {
-  return WVAR (decode_any_window (window), combination_limit);
+  return WGET (decode_any_window (window), combination_limit);
 }
 
 DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_window_combination_limit, 2, 2, 0,
@@ -489,9 +489,7 @@ never \(re-)combined with WINDOW's siblings.  Other values are reserved
 for future use.  */)
   (Lisp_Object window, Lisp_Object limit)
 {
-  register struct window *w = decode_any_window (window);
-  WVAR (w, combination_limit) = limit;
-  return WVAR (w, combination_limit);
+  return WSET (decode_any_window (window), combination_limit, limit);
 }
 
 DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0,
@@ -517,7 +515,7 @@ On a graphical display, this total height is reported as an
 integer multiple of the default character height.  */)
   (Lisp_Object window)
 {
-  return WVAR (decode_any_window (window), total_lines);
+  return WGET (decode_any_window (window), total_lines);
 }
 
 DEFUN ("window-total-width", Fwindow_total_width, Swindow_total_width, 0, 1, 0,
@@ -532,7 +530,7 @@ On a graphical display, this total width is reported as an
 integer multiple of the default character width.  */)
   (Lisp_Object window)
 {
-  return WVAR (decode_any_window (window), total_cols);
+  return WGET (decode_any_window (window), total_cols);
 }
 
 DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0,
@@ -540,7 +538,7 @@ DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0,
 If WINDOW is omitted or nil, it defaults to the selected window.   */)
   (Lisp_Object window)
 {
-  return WVAR (decode_any_window (window), new_total);
+  return WGET (decode_any_window (window), new_total);
 }
 
 DEFUN ("window-normal-size", Fwindow_normal_size, Swindow_normal_size, 0, 2, 0,
@@ -550,9 +548,9 @@ If HORIZONTAL is non-nil, return the normal width of WINDOW.  */)
   (Lisp_Object window, Lisp_Object horizontal)
 {
   if (NILP (horizontal))
-    return WVAR (decode_any_window (window), normal_lines);
+    return WGET (decode_any_window (window), normal_lines);
   else
-    return WVAR (decode_any_window (window), normal_cols);
+    return WGET (decode_any_window (window), normal_cols);
 }
 
 DEFUN ("window-new-normal", Fwindow_new_normal, Swindow_new_normal, 0, 1, 0,
@@ -560,7 +558,7 @@ DEFUN ("window-new-normal", Fwindow_new_normal, Swindow_new_normal, 0, 1, 0,
 If WINDOW is omitted or nil, it defaults to the selected window.  */)
   (Lisp_Object window)
 {
-  return WVAR (decode_any_window (window), new_normal);
+  return WGET (decode_any_window (window), new_normal);
 }
 
 DEFUN ("window-left-column", Fwindow_left_column, Swindow_left_column, 0, 1, 0,
@@ -572,7 +570,7 @@ value is 0 if there is no window to the left of WINDOW.
 If WINDOW is omitted or nil, it defaults to the selected window.  */)
   (Lisp_Object window)
 {
-  return WVAR (decode_any_window (window), left_col);
+  return WGET (decode_any_window (window), left_col);
 }
 
 DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0,
@@ -584,7 +582,7 @@ there is no window above WINDOW.
 If WINDOW is omitted or nil, it defaults to the selected window.  */)
   (Lisp_Object window)
 {
-  return WVAR (decode_any_window (window), top_line);
+  return WGET (decode_any_window (window), top_line);
 }
 
 /* Return the number of lines of W's body.  Don't count any mode or
@@ -593,7 +591,7 @@ If WINDOW is omitted or nil, it defaults to the selected window.  */)
 static int
 window_body_lines (struct window *w)
 {
-  int height = XFASTINT (WVAR (w, total_lines));
+  int height = XFASTINT (WGET (w, total_lines));
 
   if (!MINI_WINDOW_P (w))
     {
@@ -615,7 +613,7 @@ int
 window_body_cols (struct window *w)
 {
   struct frame *f = XFRAME (WINDOW_FRAME (w));
-  int width = XINT (WVAR (w, total_cols));
+  int width = XINT (WGET (w, total_cols));
 
   if (WINDOW_HAS_VERTICAL_SCROLL_BAR (w))
     /* Scroll bars occupy a few columns.  */
@@ -690,7 +688,7 @@ set_window_hscroll (struct window *w, EMACS_INT hscroll)
 
   /* Prevent redisplay shortcuts when changing the hscroll.  */
   if (w->hscroll != new_hscroll)
-    XBUFFER (WVAR (w, buffer))->prevent_redisplay_optimizations_p = 1;
+    XBUFFER (WGET (w, buffer))->prevent_redisplay_optimizations_p = 1;
 
   w->hscroll = new_hscroll;
   return make_number (new_hscroll);
@@ -719,7 +717,7 @@ WINDOW defaults to the selected window.
 See `set-window-redisplay-end-trigger' for more information.  */)
   (Lisp_Object window)
 {
-  return WVAR (decode_window (window), redisplay_end_trigger);
+  return WGET (decode_window (window), redisplay_end_trigger);
 }
 
 DEFUN ("set-window-redisplay-end-trigger", Fset_window_redisplay_end_trigger,
@@ -732,11 +730,7 @@ with two arguments: WINDOW, and the end trigger value.
 Afterwards the end-trigger value is reset to nil.  */)
   (register Lisp_Object window, Lisp_Object value)
 {
-  register struct window *w;
-
-  w = decode_window (window);
-  WVAR (w, redisplay_end_trigger) = value;
-  return value;
+  return WSET (decode_window (window), redisplay_end_trigger, value);
 }
 
 DEFUN ("window-edges", Fwindow_edges, Swindow_edges, 0, 1, 0,
@@ -785,7 +779,7 @@ of just the text area, use `window-inside-pixel-edges'.  */)
 static void
 calc_absolute_offset (struct window *w, int *add_x, int *add_y)
 {
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
   *add_y = f->top_pos;
 #ifdef FRAME_MENUBAR_HEIGHT
   *add_y += FRAME_MENUBAR_HEIGHT (f);
@@ -1095,7 +1089,7 @@ If they are in the windows's left or right marginal areas, `left-margin'\n\
 
   CHECK_LIVE_WINDOW (window);
   w = XWINDOW (window);
-  f = XFRAME (WVAR (w, frame));
+  f = XFRAME (WGET (w, frame));
   CHECK_CONS (coordinates);
   lx = Fcar (coordinates);
   ly = Fcdr (coordinates);
@@ -1275,9 +1269,9 @@ But that is hard to define.  */)
   register struct window *w = decode_window (window);
 
   if (w == XWINDOW (selected_window)
-      && current_buffer == XBUFFER (WVAR (w, buffer)))
+      && current_buffer == XBUFFER (WGET (w, buffer)))
     return Fpoint ();
-  return Fmarker_position (WVAR (w, pointm));
+  return Fmarker_position (WGET (w, pointm));
 }
 
 DEFUN ("window-start", Fwindow_start, Swindow_start, 0, 1, 0,
@@ -1286,7 +1280,7 @@ WINDOW must be a live window and defaults to the selected one.
 This is updated by redisplay or by calling `set-window-start'.  */)
   (Lisp_Object window)
 {
-  return Fmarker_position (WVAR (decode_window (window), start));
+  return Fmarker_position (WGET (decode_window (window), start));
 }
 
 /* This is text temporarily removed from the doc string below.
@@ -1317,7 +1311,7 @@ if it isn't already recorded.  */)
   Lisp_Object buf;
   struct buffer *b;
 
-  buf = WVAR (w, buffer);
+  buf = WGET (w, buffer);
   CHECK_BUFFER (buf);
   b = XBUFFER (buf);
 
@@ -1326,12 +1320,12 @@ if it isn't already recorded.  */)
      The user can compute it with vertical-motion if he wants to.
      It would be nicer to do it automatically,
      but that's so slow that it would probably bother people.  */
-  if (NILP (WVAR (w, window_end_valid)))
+  if (NILP (WGET (w, window_end_valid)))
     return Qnil;
 #endif
 
   if (! NILP (update)
-      && ! (! NILP (WVAR (w, window_end_valid))
+      && ! (! NILP (WGET (w, window_end_valid))
            && w->last_modified >= BUF_MODIFF (b)
            && w->last_overlay_modified >= BUF_OVERLAY_MODIFF (b))
       && !noninteractive)
@@ -1354,12 +1348,12 @@ if it isn't already recorded.  */)
          `-l' containing a call to `rmail' with subsequent other
          commands.  At the end, W->start happened to be BEG, while
          rmail had already narrowed the buffer.  */
-      if (XMARKER (WVAR (w, start))->charpos < BEGV)
+      if (XMARKER (WGET (w, start))->charpos < BEGV)
        SET_TEXT_POS (startp, BEGV, BEGV_BYTE);
-      else if (XMARKER (WVAR (w, start))->charpos > ZV)
+      else if (XMARKER (WGET (w, start))->charpos > ZV)
        SET_TEXT_POS (startp, ZV, ZV_BYTE);
       else
-       SET_TEXT_POS_FROM_MARKER (startp, WVAR (w, start));
+       SET_TEXT_POS_FROM_MARKER (startp, WGET (w, start));
 
       itdata = bidi_shelve_cache ();
       start_display (&it, w, startp);
@@ -1373,7 +1367,7 @@ if it isn't already recorded.  */)
        set_buffer_internal (old_buffer);
     }
   else
-    XSETINT (value, BUF_Z (b) - XFASTINT (WVAR (w, window_end_pos)));
+    XSETINT (value, BUF_Z (b) - XFASTINT (WGET (w, window_end_pos)));
 
   return value;
 }
@@ -1387,10 +1381,10 @@ Return POS.  */)
 
   CHECK_NUMBER_COERCE_MARKER (pos);
   if (w == XWINDOW (selected_window)
-      && XBUFFER (WVAR (w, buffer)) == current_buffer)
+      && XBUFFER (WGET (w, buffer)) == current_buffer)
     Fgoto_char (pos);
   else
-    set_marker_restricted (WVAR (w, pointm), pos, WVAR (w, buffer));
+    set_marker_restricted (WGET (w, pointm), pos, WGET (w, buffer));
 
   /* We have to make sure that redisplay updates the window to show
      the new value of point.  */
@@ -1410,7 +1404,7 @@ overriding motion of point in order to display at this exact start.  */)
   register struct window *w = decode_window (window);
 
   CHECK_NUMBER_COERCE_MARKER (pos);
-  set_marker_restricted (WVAR (w, start), pos, WVAR (w, buffer));
+  set_marker_restricted (WGET (w, start), pos, WGET (w, buffer));
   /* this is not right, but much easier than doing what is right. */
   w->start_at_line_beg = 0;
   if (NILP (noforce))
@@ -1452,8 +1446,8 @@ display row, and VPOS is the row number (0-based) containing POS.  */)
   int x, y;
 
   w = decode_window (window);
-  buf = XBUFFER (WVAR (w, buffer));
-  SET_TEXT_POS_FROM_MARKER (top, WVAR (w, start));
+  buf = XBUFFER (WGET (w, buffer));
+  SET_TEXT_POS_FROM_MARKER (top, WGET (w, start));
 
   if (EQ (pos, Qt))
     posint = -1;
@@ -1465,7 +1459,7 @@ display row, and VPOS is the row number (0-based) containing POS.  */)
   else if (w == XWINDOW (selected_window))
     posint = PT;
   else
-    posint = XMARKER (WVAR (w, pointm))->charpos;
+    posint = XMARKER (WGET (w, pointm))->charpos;
 
   /* If position is above window start or outside buffer boundaries,
      or if window start is out of range, position is not visible.  */
@@ -1522,11 +1516,11 @@ Return nil if window display is not up-to-date.  In that case, use
   if (noninteractive || w->pseudo_window_p)
     return Qnil;
 
-  CHECK_BUFFER (WVAR (w, buffer));
-  b = XBUFFER (WVAR (w, buffer));
+  CHECK_BUFFER (WGET (w, buffer));
+  b = XBUFFER (WGET (w, buffer));
 
   /* Fail if current matrix is not up-to-date.  */
-  if (NILP (WVAR (w, window_end_valid))
+  if (NILP (WGET (w, window_end_valid))
       || current_buffer->clip_changed
       || current_buffer->prevent_redisplay_optimizations_p
       || w->last_modified < BUF_MODIFF (b)
@@ -1619,7 +1613,7 @@ window, unless that window is "strongly" dedicated to its buffer, that
 is the value returned by `window-dedicated-p' is t.  */)
   (Lisp_Object window)
 {
-  return WVAR (decode_window (window), dedicated);
+  return WGET (decode_window (window), dedicated);
 }
 
 DEFUN ("set-window-dedicated-p", Fset_window_dedicated_p,
@@ -1643,10 +1637,7 @@ buffer.  If and when `set-window-buffer' displays another buffer in a
 window, it also makes sure that the window is no more dedicated.  */)
   (Lisp_Object window, Lisp_Object flag)
 {
-  register struct window *w = decode_window (window);
-
-  WVAR (w, dedicated) = flag;
-  return WVAR (w, dedicated);
+  return WSET (decode_window (window), dedicated, flag);
 }
 
 DEFUN ("window-prev-buffers", Fwindow_prev_buffers, Swindow_prev_buffers,
@@ -1659,7 +1650,7 @@ where BUFFER is a buffer, WINDOW-START is the start position of the
 window for that buffer, and POS is a window-specific point value.  */)
   (Lisp_Object window)
 {
-  return WVAR (decode_window (window), prev_buffers);
+  return WGET (decode_window (window), prev_buffers);
 }
 
 DEFUN ("set-window-prev-buffers", Fset_window_prev_buffers,
@@ -1672,7 +1663,7 @@ where BUFFER is a buffer, WINDOW-START is the start position of the
 window for that buffer, and POS is a window-specific point value.  */)
      (Lisp_Object window, Lisp_Object prev_buffers)
 {
-  return WVAR (decode_window (window), prev_buffers) = prev_buffers;
+  return WSET (decode_window (window), prev_buffers, prev_buffers);
 }
 
 DEFUN ("window-next-buffers", Fwindow_next_buffers, Swindow_next_buffers,
@@ -1681,7 +1672,7 @@ DEFUN ("window-next-buffers", Fwindow_next_buffers, Swindow_next_buffers,
 WINDOW must be a live window and defaults to the selected one.  */)
      (Lisp_Object window)
 {
-  return WVAR (decode_window (window), next_buffers);
+  return WGET (decode_window (window), next_buffers);
 }
 
 DEFUN ("set-window-next-buffers", Fset_window_next_buffers,
@@ -1691,7 +1682,7 @@ WINDOW must be a live window and defaults to the selected one.
 NEXT-BUFFERS should be a list of buffers.  */)
      (Lisp_Object window, Lisp_Object next_buffers)
 {
-  return WVAR (decode_window (window), next_buffers) = next_buffers;
+  return WSET (decode_window (window), next_buffers, next_buffers);
 }
 
 DEFUN ("window-parameters", Fwindow_parameters, Swindow_parameters,
@@ -1701,7 +1692,7 @@ WINDOW defaults to the selected window.  The return value is a list of
 elements of the form (PARAMETER . VALUE).  */)
   (Lisp_Object window)
 {
-  return Fcopy_alist (WVAR (decode_any_window (window), window_parameters));
+  return Fcopy_alist (WGET (decode_any_window (window), window_parameters));
 }
 
 DEFUN ("window-parameter", Fwindow_parameter, Swindow_parameter,
@@ -1712,7 +1703,7 @@ WINDOW defaults to the selected window.  */)
 {
   Lisp_Object result;
 
-  result = Fassq (parameter, WVAR (decode_any_window (window),
+  result = Fassq (parameter, WGET (decode_any_window (window),
                                   window_parameters));
   return CDR_SAFE (result);
 }
@@ -1726,10 +1717,10 @@ WINDOW defaults to the selected window.  Return VALUE.  */)
   register struct window *w = decode_any_window (window);
   Lisp_Object old_alist_elt;
 
-  old_alist_elt = Fassq (parameter, WVAR (w, window_parameters));
+  old_alist_elt = Fassq (parameter, WGET (w, window_parameters));
   if (NILP (old_alist_elt))
-    WVAR (w, window_parameters) 
-      = Fcons (Fcons (parameter, value), WVAR (w, window_parameters));
+    WSET (w, window_parameters,
+         Fcons (Fcons (parameter, value), WGET (w, window_parameters)));
   else
     Fsetcdr (old_alist_elt, value);
   return value;
@@ -1741,7 +1732,7 @@ DEFUN ("window-display-table", Fwindow_display_table, Swindow_display_table,
 WINDOW defaults to the selected window.  */)
   (Lisp_Object window)
 {
-  return WVAR (decode_window (window), display_table);
+  return WGET (decode_window (window), display_table);
 }
 
 /* Get the display table for use on window W.  This is either W's
@@ -1754,11 +1745,11 @@ window_display_table (struct window *w)
 {
   struct Lisp_Char_Table *dp = NULL;
 
-  if (DISP_TABLE_P (WVAR (w, display_table)))
-    dp = XCHAR_TABLE (WVAR (w, display_table));
-  else if (BUFFERP (WVAR (w, buffer)))
+  if (DISP_TABLE_P (WGET (w, display_table)))
+    dp = XCHAR_TABLE (WGET (w, display_table));
+  else if (BUFFERP (WGET (w, buffer)))
     {
-      struct buffer *b = XBUFFER (WVAR (w, buffer));
+      struct buffer *b = XBUFFER (WGET (w, buffer));
 
       if (DISP_TABLE_P (BVAR (b, display_table)))
        dp = XCHAR_TABLE (BVAR (b, display_table));
@@ -1773,11 +1764,7 @@ DEFUN ("set-window-display-table", Fset_window_display_table, Sset_window_displa
        doc: /* Set WINDOW's display-table to TABLE.  */)
   (register Lisp_Object window, Lisp_Object table)
 {
-  register struct window *w;
-
-  w = decode_window (window);
-  WVAR (w, display_table) = table;
-  return table;
+  return WSET (decode_window (window), display_table, table);
 }
 \f
 /* Record info on buffer window W is displaying
@@ -1788,14 +1775,14 @@ unshow_buffer (register struct window *w)
   Lisp_Object buf;
   struct buffer *b;
 
-  buf = WVAR (w, buffer);
+  buf = WGET (w, buffer);
   b = XBUFFER (buf);
-  if (b != XMARKER (WVAR (w, pointm))->buffer)
+  if (b != XMARKER (WGET (w, pointm))->buffer)
     abort ();
 
 #if 0
   if (w == XWINDOW (selected_window)
-      || ! EQ (buf, WVAR (XWINDOW (selected_window), buffer)))
+      || ! EQ (buf, WGET (XWINDOW (selected_window), buffer)))
     /* Do this except when the selected window's buffer
        is being removed from some other window.  */
 #endif
@@ -1806,22 +1793,22 @@ unshow_buffer (register struct window *w)
        selected window, while last_window_start reflects another
        window which was recently showing the same buffer.
        Some people might say that might be a good thing.  Let's see.  */
-    b->last_window_start = marker_position (WVAR (w, start));
+    b->last_window_start = marker_position (WGET (w, start));
 
   /* Point in the selected window's buffer
      is actually stored in that buffer, and the window's pointm isn't used.
      So don't clobber point in that buffer.  */
-  if (! EQ (buf, WVAR (XWINDOW (selected_window), buffer))
+  if (! EQ (buf, WGET (XWINDOW (selected_window), buffer))
       /* This line helps to fix Horsley's testbug.el bug.  */
       && !(WINDOWP (BVAR (b, last_selected_window))
           && w != XWINDOW (BVAR (b, last_selected_window))
-          && EQ (buf, WVAR (XWINDOW (BVAR (b, last_selected_window)), buffer))))
+          && EQ (buf, WGET (XWINDOW (BVAR (b, last_selected_window)), buffer))))
     temp_set_point_both (b,
                         clip_to_bounds (BUF_BEGV (b),
-                                        XMARKER (WVAR (w, pointm))->charpos,
+                                        XMARKER (WGET (w, pointm))->charpos,
                                         BUF_ZV (b)),
                         clip_to_bounds (BUF_BEGV_BYTE (b),
-                                        marker_byte_position (WVAR (w, pointm)),
+                                        marker_byte_position (WGET (w, pointm)),
                                         BUF_ZV_BYTE (b)));
 
   if (WINDOWP (BVAR (b, last_selected_window))
@@ -1840,19 +1827,19 @@ replace_window (Lisp_Object old, Lisp_Object new, int setflag)
 
   /* If OLD is its frame's root window, then NEW is the new
      root window for that frame.  */
-  if (EQ (old, FRAME_ROOT_WINDOW (XFRAME (WVAR (o, frame)))))
-    FSET (XFRAME (WVAR (o, frame)), root_window, new);
-
-  if (setflag)
-    {
-      WVAR (n, left_col) = WVAR (o, left_col);
-      WVAR (n, top_line) = WVAR (o, top_line);
-      WVAR (n, total_cols) = WVAR (o, total_cols);
-      WVAR (n, total_lines) = WVAR (o, total_lines);
-      WVAR (n, normal_cols) = WVAR (o, normal_cols);
-      WVAR (o, normal_cols) = make_float (1.0);
-      WVAR (n, normal_lines) = WVAR (o, normal_lines);
-      WVAR (o, normal_lines) = make_float (1.0);
+  if (EQ (old, FRAME_ROOT_WINDOW (XFRAME (WGET (o, frame)))))
+    FSET (XFRAME (WGET (o, frame)), root_window, new);
+
+   if (setflag)
+     {
+      WSET (n, left_col, WGET (o, left_col));
+      WSET (n, top_line, WGET (o, top_line));
+      WSET (n, total_cols, WGET (o, total_cols));
+      WSET (n, total_lines, WGET (o, total_lines));
+      WSET (n, normal_cols, WGET (o, normal_cols));
+      WSET (o, normal_cols, make_float (1.0));
+      WSET (n, normal_lines, WGET (o, normal_lines));
+      WSET (o, normal_lines, make_float (1.0));
       n->desired_matrix = n->current_matrix = 0;
       n->vscroll = 0;
       memset (&n->cursor, 0, sizeof (n->cursor));
@@ -1862,27 +1849,30 @@ replace_window (Lisp_Object old, Lisp_Object new, int setflag)
       n->phys_cursor_width = -1;
       n->must_be_updated_p = 0;
       n->pseudo_window_p = 0;
-      XSETFASTINT (WVAR (n, window_end_vpos), 0);
-      XSETFASTINT (WVAR (n, window_end_pos), 0);
-      WVAR (n, window_end_valid) = Qnil;
+      WSET (n, window_end_vpos, make_number (0));
+      WSET (n, window_end_pos, make_number (0));
+      WSET (n, window_end_valid, Qnil);
       n->frozen_window_start_p = 0;
     }
 
-  WVAR (n, next) = tem = WVAR (o, next);
+  tem = WGET (o, next);
+  WSET (n, next, tem);
   if (!NILP (tem))
-    WVAR (XWINDOW (tem), prev) = new;
+    WSET (XWINDOW (tem), prev, new);
 
-  WVAR (n, prev) = tem = WVAR (o, prev);
+  tem = WGET (o, prev);
+  WSET (n, prev, tem);
   if (!NILP (tem))
-    WVAR (XWINDOW (tem), next) = new;
+    WSET (XWINDOW (tem), next, new);
 
-  WVAR (n, parent) = tem = WVAR (o, parent);
+  tem = WGET (o, parent);
+  WSET (n, parent, tem);
   if (!NILP (tem))
     {
-      if (EQ (WVAR (XWINDOW (tem), vchild), old))
-       WVAR (XWINDOW (tem), vchild) = new;
-      if (EQ (WVAR (XWINDOW (tem), hchild), old))
-       WVAR (XWINDOW (tem), hchild) = new;
+      if (EQ (WGET (XWINDOW (tem), vchild), old))
+       WSET (XWINDOW (tem), vchild, new);
+      if (EQ (WGET (XWINDOW (tem), hchild), old))
+       WSET (XWINDOW (tem), hchild, new);
     }
 }
 
@@ -1898,64 +1888,65 @@ recombine_windows (Lisp_Object window)
   int horflag;
 
   w = XWINDOW (window);
-  parent = WVAR (w, parent);
-  if (!NILP (parent) && NILP (WVAR (w, combination_limit)))
+  parent = WGET (w, parent);
+  if (!NILP (parent) && NILP (WGET (w, combination_limit)))
     {
       p = XWINDOW (parent);
-      if (((!NILP (WVAR (p, vchild)) && !NILP (WVAR (w, vchild)))
-          || (!NILP (WVAR (p, hchild)) && !NILP (WVAR (w, hchild)))))
+      if (((!NILP (WGET (p, vchild)) && !NILP (WGET (w, vchild)))
+          || (!NILP (WGET (p, hchild)) && !NILP (WGET (w, hchild)))))
        /* WINDOW and PARENT are both either a vertical or a horizontal
           combination.  */
        {
-         horflag = NILP (WVAR (w, vchild));
-         child = horflag ? WVAR (w, hchild) : WVAR (w, vchild);
+         horflag = NILP (WGET (w, vchild));
+         child = horflag ? WGET (w, hchild) : WGET (w, vchild);
          c = XWINDOW (child);
 
          /* Splice WINDOW's children into its parent's children and
             assign new normal sizes.  */
-         if (NILP (WVAR (w, prev)))
+         if (NILP (WGET (w, prev)))
            if (horflag)
-             WVAR (p, hchild) = child;
+             WSET (p, hchild, child);
            else
-             WVAR (p, vchild) = child;
+             WSET (p, vchild, child);
          else
            {
-             WVAR (c, prev) = WVAR (w, prev);
-             WVAR (XWINDOW (WVAR (w, prev)), next) = child;
+             WSET (c, prev, WGET (w, prev));
+             WSET (XWINDOW (WGET (w, prev)), next, child);
            }
 
          while (c)
            {
-             WVAR (c, parent) = parent;
+             WSET (c, parent, parent);
 
              if (horflag)
-               WVAR (c, normal_cols)
-                 = make_float (XFLOATINT (WVAR (c, total_cols))
-                               / XFLOATINT (WVAR (p, total_cols)));
+               WSET (c, normal_cols,
+                     make_float (XFLOATINT (WGET (c, total_cols))
+                                 / XFLOATINT (WGET (p, total_cols))));
              else
-               WVAR (c, normal_lines)
-                 = make_float (XFLOATINT (WVAR (c, total_lines))
-                               / XFLOATINT (WVAR (p, total_lines)));
+               WSET (c, normal_lines,
+                     make_float (XFLOATINT (WGET (c, total_lines))
+                                 / XFLOATINT (WGET (p, total_lines))));
 
-             if (NILP (WVAR (c, next)))
+             if (NILP (WGET (c, next)))
                {
-                 if (!NILP (WVAR (w, next)))
+                 if (!NILP (WGET (w, next)))
                    {
-                     WVAR (c, next) = WVAR (w, next);
-                     WVAR (XWINDOW (WVAR (c, next)), prev) = child;
+                     WSET (c, next, WGET (w, next));
+                     WSET (XWINDOW (WGET (c, next)), prev, child);
                    }
 
                  c = 0;
                }
              else
                {
-                 child = WVAR (c, next);
+                 child = WGET (c, next);
                  c = XWINDOW (child);
                }
            }
 
          /* WINDOW can be deleted now.  */
-         WVAR (w, vchild) = WVAR (w, hchild) = Qnil;
+         WSET (w, vchild, Qnil);
+         WSET (w, hchild, Qnil);
        }
     }
 }
@@ -2038,10 +2029,10 @@ static int
 candidate_window_p (Lisp_Object window, Lisp_Object owindow, Lisp_Object minibuf, Lisp_Object all_frames)
 {
   struct window *w = XWINDOW (window);
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
   int candidate_p = 1;
 
-  if (!BUFFERP (WVAR (w, buffer)))
+  if (!BUFFERP (WGET (w, buffer)))
     candidate_p = 0;
   else if (MINI_WINDOW_P (w)
            && (EQ (minibuf, Qlambda)
@@ -2056,13 +2047,13 @@ candidate_window_p (Lisp_Object window, Lisp_Object owindow, Lisp_Object minibuf
   else if (NILP (all_frames))
     {
       eassert (WINDOWP (owindow));
-      candidate_p = EQ (WVAR (w, frame), WVAR (XWINDOW (owindow), frame));
+      candidate_p = EQ (WGET (w, frame), WGET (XWINDOW (owindow), frame));
     }
   else if (EQ (all_frames, Qvisible))
     {
       FRAME_SAMPLE_VISIBILITY (f);
       candidate_p = FRAME_VISIBLE_P (f)
-       && (FRAME_TERMINAL (XFRAME (WVAR (w, frame)))
+       && (FRAME_TERMINAL (XFRAME (WGET (w, frame)))
            == FRAME_TERMINAL (XFRAME (selected_frame)));
 
     }
@@ -2081,15 +2072,15 @@ candidate_window_p (Lisp_Object window, Lisp_Object owindow, Lisp_Object minibuf
                         && !f->output_data.x->has_been_visible)
 #endif
                     )
-       && (FRAME_TERMINAL (XFRAME (WVAR (w, frame)))
+       && (FRAME_TERMINAL (XFRAME (WGET (w, frame)))
            == FRAME_TERMINAL (XFRAME (selected_frame)));
     }
   else if (WINDOWP (all_frames))
     candidate_p = (EQ (FRAME_MINIBUF_WINDOW (f), all_frames)
-                  || EQ (WVAR (XWINDOW (all_frames), frame), WVAR (w, frame))
-                  || EQ (WVAR (XWINDOW (all_frames), frame), FRAME_FOCUS_FRAME (f)));
+                  || EQ (WGET (XWINDOW (all_frames), frame), WGET (w, frame))
+                  || EQ (WGET (XWINDOW (all_frames), frame), FRAME_FOCUS_FRAME (f)));
   else if (FRAMEP (all_frames))
-    candidate_p = EQ (all_frames, WVAR (w, frame));
+    candidate_p = EQ (all_frames, WGET (w, frame));
 
   return candidate_p;
 }
@@ -2122,7 +2113,7 @@ decode_next_window_args (Lisp_Object *window, Lisp_Object *minibuf, Lisp_Object
   if (NILP (*all_frames))
     *all_frames 
       = (!EQ (*minibuf, Qlambda)
-        ? FRAME_MINIBUF_WINDOW (XFRAME (WVAR (XWINDOW (*window), frame)))
+        ? FRAME_MINIBUF_WINDOW (XFRAME (WGET (XWINDOW (*window), frame)))
         : Qnil);
   else if (EQ (*all_frames, Qvisible))
     ;
@@ -2148,7 +2139,7 @@ next_window (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames, in
   /* If ALL_FRAMES is a frame, and WINDOW isn't on that frame, just
      return the first window on the frame.  */
   if (FRAMEP (all_frames)
-      && !EQ (all_frames, WVAR (XWINDOW (window), frame)))
+      && !EQ (all_frames, WGET (XWINDOW (window), frame)))
     return Fframe_first_window (all_frames);
 
   if (next_p)
@@ -2328,7 +2319,7 @@ MINIBUF neither nil nor t means never include the minibuffer window.  */)
   if (NILP (frame))
     frame = selected_frame;
 
-  if (!EQ (frame, WVAR (XWINDOW (window), frame)))
+  if (!EQ (frame, WGET (XWINDOW (window), frame)))
     error ("Window is on a different frame");
 
   return window_list_1 (window, minibuf, frame);
@@ -2449,7 +2440,7 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame
        switch (type)
          {
          case GET_BUFFER_WINDOW:
-           if (EQ (WVAR (w, buffer), obj)
+           if (EQ (WGET (w, buffer), obj)
                /* Don't find any minibuffer window except the one that
                   is currently in use.  */
                && (MINI_WINDOW_P (w) ? EQ (window, minibuf_window) : 1))
@@ -2457,7 +2448,7 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame
                if (EQ (window, selected_window))
                  /* Preferably return the selected window.  */
                  RETURN_UNGCPRO (window);
-               else if (EQ (WVAR (XWINDOW (window), frame), selected_frame)
+               else if (EQ (WGET (XWINDOW (window), frame), selected_frame)
                         && !frame_best_window_flag)
                  /* Prefer windows on the current frame (but don't
                     choose another one if we have one already).  */
@@ -2473,25 +2464,25 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame
          case REPLACE_BUFFER_IN_WINDOWS_SAFELY:
            /* We could simply check whether the buffer shown by window
               is live, and show another buffer in case it isn't.  */
-           if (EQ (WVAR (w, buffer), obj))
+           if (EQ (WGET (w, buffer), obj))
              {
                /* Undedicate WINDOW.  */
-               WVAR (w, dedicated) = Qnil;
+               WSET (w, dedicated, Qnil);
                /* Make WINDOW show the buffer returned by
                   other_buffer_safely, don't run any hooks.  */
                set_window_buffer
-                 (window, other_buffer_safely (WVAR (w, buffer)), 0, 0);
+                 (window, other_buffer_safely (WGET (w, buffer)), 0, 0);
                /* If WINDOW is the selected window, make its buffer
                   current.  But do so only if the window shows the
                   current buffer (Bug#6454).  */
                if (EQ (window, selected_window)
-                   && XBUFFER (WVAR (w, buffer)) == current_buffer)
-                 Fset_buffer (WVAR (w, buffer));
+                   && XBUFFER (WGET (w, buffer)) == current_buffer)
+                 Fset_buffer (WGET (w, buffer));
              }
            break;
 
          case REDISPLAY_BUFFER_WINDOWS:
-           if (EQ (WVAR (w, buffer), obj))
+           if (EQ (WGET (w, buffer), obj))
              {
                mark_window_display_accurate (window, 0);
                w->update_mode_line = 1;
@@ -2503,8 +2494,8 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame
 
            /* Check for a window that has a killed buffer.  */
          case CHECK_ALL_WINDOWS:
-           if (! NILP (WVAR (w, buffer))
-               && NILP (BVAR (XBUFFER (WVAR (w, buffer)), name)))
+           if (! NILP (WGET (w, buffer))
+               && NILP (BVAR (XBUFFER (WGET (w, buffer)), name)))
              abort ();
            break;
 
@@ -2591,7 +2582,7 @@ window-start value is reasonable when this function is called.  */)
 
   w = decode_any_window (window);
   XSETWINDOW (window, w);
-  f = XFRAME (WVAR (w, frame));
+  f = XFRAME (WGET (w, frame));
 
   if (NILP (root))
     /* ROOT is the frame's root window.  */
@@ -2603,12 +2594,12 @@ window-start value is reasonable when this function is called.  */)
     /* ROOT must be an ancestor of WINDOW.  */
     {
       r = decode_any_window (root);
-      pwindow = WVAR (XWINDOW (window), parent);
+      pwindow = WGET (XWINDOW (window), parent);
       while (!NILP (pwindow))
        if (EQ (pwindow, root))
          break;
        else
-         pwindow = WVAR (XWINDOW (pwindow), parent);
+         pwindow = WGET (XWINDOW (pwindow), parent);
       if (!EQ (pwindow, root))
        error ("Specified root is not an ancestor of specified window");
     }
@@ -2622,15 +2613,15 @@ window-start value is reasonable when this function is called.  */)
   else if (MINI_WINDOW_P (w)) /* && top > 0) */
     error ("Can't expand minibuffer to full frame");
 
-  if (!NILP (WVAR (w, buffer)))
+  if (!NILP (WGET (w, buffer)))
     {
-      startpos = marker_position (WVAR (w, start));
+      startpos = marker_position (WGET (w, start));
       top = WINDOW_TOP_EDGE_LINE (w)
        - FRAME_TOP_MARGIN (XFRAME (WINDOW_FRAME (w)));
       /* Make sure WINDOW is the frame's selected window.  */
       if (!EQ (window, FRAME_SELECTED_WINDOW (f)))
        {
-         if (EQ (selected_frame, WVAR (w, frame)))
+         if (EQ (selected_frame, WGET (w, frame)))
            Fselect_window (window, Qnil);
          else
            FSET (f, selected_window, window);
@@ -2647,7 +2638,7 @@ window-start value is reasonable when this function is called.  */)
        {
          pwindow = swindow;
          while (!NILP (pwindow) && !EQ (window, pwindow))
-           pwindow = WVAR (XWINDOW (pwindow), parent);
+           pwindow = WGET (XWINDOW (pwindow), parent);
 
          if (EQ (window, pwindow))
            /* If WINDOW is an ancestor of SWINDOW, then SWINDOW is ok
@@ -2660,7 +2651,7 @@ window-start value is reasonable when this function is called.  */)
 
       if (!EQ (swindow, FRAME_SELECTED_WINDOW (f)))
        {
-         if (EQ (selected_frame, WVAR (w, frame)))
+         if (EQ (selected_frame, WGET (w, frame)))
            Fselect_window (swindow, Qnil);
          else
            FSET (f, selected_window, swindow);
@@ -2693,12 +2684,12 @@ window-start value is reasonable when this function is called.  */)
   FRAME_WINDOW_SIZES_CHANGED (f) = 1;
   resize_failed = 0;
 
-  if (NILP (WVAR (w, buffer)))
+  if (NILP (WGET (w, buffer)))
     {
       /* Resize child windows vertically.  */
-      XSETINT (delta, XINT (WVAR (r, total_lines))
-              - XINT (WVAR (w, total_lines)));
-      WVAR (w, top_line) = WVAR (r, top_line);
+      XSETINT (delta, XINT (WGET (r, total_lines))
+              - XINT (WGET (w, total_lines)));
+      WSET (w, top_line, WGET (r, top_line));
       resize_root_window (window, delta, Qnil, Qnil);
       if (window_resize_check (w, 0))
        window_resize_apply (w, 0);
@@ -2714,10 +2705,10 @@ window-start value is reasonable when this function is called.  */)
       /* Resize child windows horizontally.  */
       if (!resize_failed)
        {
-         WVAR (w, left_col) = WVAR (r, left_col);
-         XSETINT (delta, XINT (WVAR (r, total_cols)) 
-                  - XINT (WVAR (w, total_cols)));
-         WVAR (w, left_col) = WVAR (r, left_col);
+         WSET (w, left_col, WGET (r, left_col));
+         XSETINT (delta, XINT (WGET (r, total_cols)) 
+                  - XINT (WGET (w, total_cols)));
+         WSET (w, left_col, WGET (r, left_col));
          resize_root_window (window, delta, Qt, Qnil);
          if (window_resize_check (w, 1))
            window_resize_apply (w, 1);
@@ -2740,43 +2731,43 @@ window-start value is reasonable when this function is called.  */)
     }
 
   /* Cleanly unlink WINDOW from window-tree.  */
-  if (!NILP (WVAR (w, prev)))
+  if (!NILP (WGET (w, prev)))
     /* Get SIBLING above (on the left of) WINDOW.  */
     {
-      sibling = WVAR (w, prev);
+      sibling = WGET (w, prev);
       s = XWINDOW (sibling);
-      WVAR (s, next) = WVAR (w, next);
-      if (!NILP (WVAR (s, next)))
-       WVAR (XWINDOW (WVAR (s, next)), prev) = sibling;
+      WSET (s, next, WGET (w, next));
+      if (!NILP (WGET (s, next)))
+       WSET (XWINDOW (WGET (s, next)), prev, sibling);
     }
   else
     /* Get SIBLING below (on the right of) WINDOW.  */
     {
-      sibling = WVAR (w, next);
+      sibling = WGET (w, next);
       s = XWINDOW (sibling);
-      WVAR (s, prev) = Qnil;
-      if (!NILP (WVAR (XWINDOW (WVAR (w, parent)), vchild)))
-       WVAR (XWINDOW (WVAR (w, parent)), vchild) = sibling;
+      WSET (s, prev, Qnil);
+      if (!NILP (WGET (XWINDOW (WGET (w, parent)), vchild)))
+       WSET (XWINDOW (WGET (w, parent)), vchild, sibling);
       else
-       WVAR (XWINDOW (WVAR (w, parent)), hchild) = sibling;
+       WSET (XWINDOW (WGET (w, parent)), hchild, sibling);
     }
 
   /* Delete ROOT and all child windows of ROOT.  */
-  if (!NILP (WVAR (r, vchild)))
+  if (!NILP (WGET (r, vchild)))
     {
-      delete_all_child_windows (WVAR (r, vchild));
-      WVAR (r, vchild) = Qnil;
+      delete_all_child_windows (WGET (r, vchild));
+      WSET (r, vchild, Qnil);
     }
-  else if (!NILP (WVAR (r, hchild)))
+  else if (!NILP (WGET (r, hchild)))
     {
-      delete_all_child_windows (WVAR (r, hchild));
-      WVAR (r, hchild) = Qnil;
+      delete_all_child_windows (WGET (r, hchild));
+      WSET (r, hchild, Qnil);
     }
 
   replace_window (root, window, 1);
 
   /* This must become SWINDOW anyway ....... */
-  if (!NILP (WVAR (w, buffer)) && !resize_failed)
+  if (!NILP (WGET (w, buffer)) && !resize_failed)
     {
       /* Try to minimize scrolling, by setting the window start to the
         point will cause the text at the old window start to be at the
@@ -2785,19 +2776,19 @@ window-start value is reasonable when this function is called.  */)
         when the display is not current, due to typeahead).  */
       new_top = WINDOW_TOP_EDGE_LINE (w) - FRAME_TOP_MARGIN (XFRAME (WINDOW_FRAME (w)));
       if (new_top != top
-         && startpos >= BUF_BEGV (XBUFFER (WVAR (w, buffer)))
-         && startpos <= BUF_ZV (XBUFFER (WVAR (w, buffer))))
+         && startpos >= BUF_BEGV (XBUFFER (WGET (w, buffer)))
+         && startpos <= BUF_ZV (XBUFFER (WGET (w, buffer))))
        {
          struct position pos;
          struct buffer *obuf = current_buffer;
 
-         Fset_buffer (WVAR (w, buffer));
+         Fset_buffer (WGET (w, buffer));
          /* This computation used to temporarily move point, but that
             can have unwanted side effects due to text properties.  */
          pos = *vmotion (startpos, -top, w);
 
-         set_marker_both (WVAR (w, start), WVAR (w, buffer), pos.bufpos, pos.bytepos);
-         WVAR (w, window_end_valid) = Qnil;
+         set_marker_both (WGET (w, start), WGET (w, buffer), pos.bufpos, pos.bytepos);
+         WSET (w, window_end_valid, Qnil);
          w->start_at_line_beg = (pos.bytepos == BEGV_BYTE
                                    || FETCH_BYTE (pos.bytepos - 1) == '\n');
          /* We need to do this, so that the window-scroll-functions
@@ -2887,13 +2878,15 @@ adjust_window_margins (struct window *w)
   if (WINDOW_RIGHT_MARGIN_COLS (w) > 0)
     {
       if (WINDOW_LEFT_MARGIN_COLS (w) > 0)
-       WVAR (w, left_margin_cols) = WVAR (w, right_margin_cols)
-         = make_number (margin_cols/2);
+       {
+         WSET (w, left_margin_cols, make_number (margin_cols / 2));
+         WSET (w, right_margin_cols, make_number (margin_cols / 2));   
+       }
       else
-       WVAR (w, right_margin_cols) = make_number (margin_cols);
+       WSET (w, right_margin_cols, make_number (margin_cols));
     }
   else
-    WVAR (w, left_margin_cols) = make_number (margin_cols);
+    WSET (w, left_margin_cols, make_number (margin_cols));
   return 1;
 }
 \f
@@ -2991,9 +2984,9 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
   struct window *w = XWINDOW (window);
   struct buffer *b = XBUFFER (buffer);
   ptrdiff_t count = SPECPDL_INDEX ();
-  int samebuf = EQ (buffer, WVAR (w, buffer));
+  int samebuf = EQ (buffer, WGET (w, buffer));
 
-  WVAR (w, buffer) = buffer;
+  WSET (w, buffer, buffer);
 
   if (EQ (window, selected_window))
     BVAR (b, last_selected_window) = window;
@@ -3006,10 +2999,10 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
     XSETINT (BVAR (b, display_count), XINT (BVAR (b, display_count)) + 1);
   BVAR (b, display_time) = Fcurrent_time ();
 
-  XSETFASTINT (WVAR (w, window_end_pos), 0);
-  XSETFASTINT (WVAR (w, window_end_vpos), 0);
+  WSET (w, window_end_pos, make_number (0));
+  WSET (w, window_end_vpos, make_number (0));
   memset (&w->last_cursor, 0, sizeof w->last_cursor);
-  WVAR (w, window_end_valid) = Qnil;
+  WSET (w, window_end_valid, Qnil);
   if (!(keep_margins_p && samebuf))
     { /* If we're not actually changing the buffer, don't reset hscroll and
         vscroll.  This case happens for example when called from
@@ -3021,8 +3014,8 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
         whenever we resize the frame.  */
       w->hscroll = w->min_hscroll = 0;
       w->vscroll = 0;
-      set_marker_both (WVAR (w, pointm), buffer, BUF_PT (b), BUF_PT_BYTE (b));
-      set_marker_restricted (WVAR (w, start),
+      set_marker_both (WGET (w, pointm), buffer, BUF_PT (b), BUF_PT_BYTE (b));
+      set_marker_restricted (WGET (w, start),
                             make_number (b->last_window_start),
                             buffer);
       w->start_at_line_beg = 0;
@@ -3043,7 +3036,7 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
       Fset_buffer (buffer);
     }
 
-  XMARKER (WVAR (w, pointm))->insertion_type = !NILP (Vwindow_point_insertion_type);
+  XMARKER (WGET (w, pointm))->insertion_type = !NILP (Vwindow_point_insertion_type);
 
   if (!keep_margins_p)
     {
@@ -3051,10 +3044,11 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
 
       /* This may call adjust_window_margins three times, so
         temporarily disable window margins.  */
-      Lisp_Object save_left = WVAR (w, left_margin_cols);
-      Lisp_Object save_right = WVAR (w, right_margin_cols);
+      Lisp_Object save_left = WGET (w, left_margin_cols);
+      Lisp_Object save_right = WGET (w, right_margin_cols);
 
-      WVAR (w, left_margin_cols) = WVAR (w, right_margin_cols) = Qnil;
+      WSET (w, left_margin_cols, Qnil);
+      WSET (w, right_margin_cols, Qnil);
 
       Fset_window_fringes (window,
                           BVAR (b, left_fringe_width), BVAR (b, right_fringe_width),
@@ -3064,8 +3058,8 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
                               BVAR (b, scroll_bar_width),
                               BVAR (b, vertical_scroll_bar_type), Qnil);
 
-      WVAR (w, left_margin_cols) = save_left;
-      WVAR (w, right_margin_cols) = save_right;
+      WSET (w, left_margin_cols, save_left);
+      WSET (w, right_margin_cols, save_right);
 
       Fset_window_margins (window,
                           BVAR (b, left_margin_cols), BVAR (b, right_margin_cols));
@@ -3075,7 +3069,7 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
     {
       if (! NILP (Vwindow_scroll_functions))
        run_hook_with_args_2 (Qwindow_scroll_functions, window,
-                             Fmarker_position (WVAR (w, start)));
+                             Fmarker_position (WGET (w, start)));
       run_window_configuration_change_hook (XFRAME (WINDOW_FRAME (w)));
     }
 
@@ -3109,7 +3103,7 @@ This function runs `window-scroll-functions' before running
   if (NILP (BVAR (XBUFFER (buffer), name)))
     error ("Attempt to display deleted buffer");
 
-  tem = WVAR (w, buffer);
+  tem = WGET (w, buffer);
   if (NILP (tem))
     error ("Window is deleted");
   else if (!EQ (tem, Qt))
@@ -3117,14 +3111,14 @@ This function runs `window-scroll-functions' before running
     {
       if (!EQ (tem, buffer))
        {
-         if (EQ (WVAR (w, dedicated), Qt))
+         if (EQ (WGET (w, dedicated), Qt))
            /* WINDOW is strongly dedicated to its buffer, signal an
               error.  */
            error ("Window is dedicated to `%s'", SDATA (BVAR (XBUFFER (tem), name)));
          else
            /* WINDOW is weakly dedicated to its buffer, reset
               dedication.  */
-           WVAR (w, dedicated) = Qnil;
+           WSET (w, dedicated, Qnil);
 
          call1 (Qrecord_window_buffer, window);
        }
@@ -3163,8 +3157,8 @@ displaying that buffer.  */)
       struct window *w = XWINDOW (object);
       mark_window_display_accurate (object, 0);
       w->update_mode_line = 1;
-      if (BUFFERP (WVAR (w, buffer)))
-       XBUFFER (WVAR (w, buffer))->prevent_redisplay_optimizations_p = 1;
+      if (BUFFERP (WGET (w, buffer)))
+       XBUFFER (WGET (w, buffer))->prevent_redisplay_optimizations_p = 1;
       ++update_mode_lines;
       return Qt;
     }
@@ -3209,14 +3203,14 @@ temp_output_buffer_show (register Lisp_Object buf)
     {
       window = display_buffer (buf, Qnil, Qnil);
 
-      if (!EQ (WVAR (XWINDOW (window), frame), selected_frame))
+      if (!EQ (WGET (XWINDOW (window), frame), selected_frame))
        Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window)));
       Vminibuf_scroll_window = window;
       w = XWINDOW (window);
       w->hscroll = 0;
       w->min_hscroll = 0;
-      set_marker_restricted_both (WVAR (w, start), buf, BEG, BEG);
-      set_marker_restricted_both (WVAR (w, pointm), buf, BEG, BEG);
+      set_marker_restricted_both (WGET (w, start), buf, BEG, BEG);
+      set_marker_restricted_both (WGET (w, pointm), buf, BEG, BEG);
 
       /* Run temp-buffer-show-hook, with the chosen window selected
         and its buffer current.  */
@@ -3233,7 +3227,7 @@ temp_output_buffer_show (register Lisp_Object buf)
         record_unwind_protect (Fset_buffer, prev_buffer);
         record_unwind_protect (select_window_norecord, prev_window);
         Fselect_window (window, Qt);
-        Fset_buffer (WVAR (w, buffer));
+        Fset_buffer (WGET (w, buffer));
         Frun_hooks (1, &Qtemp_buffer_show_hook);
         unbind_to (count, Qnil);
       }
@@ -3270,17 +3264,17 @@ make_parent_window (Lisp_Object window, int horflag)
 
   replace_window (window, parent, 1);
 
-  WVAR (o, next) = Qnil;
-  WVAR (o, prev) = Qnil;
-  WVAR (o, parent) = parent;
+  WSET (o, next, Qnil);
+  WSET (o, prev, Qnil);
+  WSET (o, parent, parent);
 
-  WVAR (p, hchild) = horflag ? window : Qnil;
-  WVAR (p, vchild) = horflag ? Qnil : window;
-  WVAR (p, start) = Qnil;
-  WVAR (p, pointm) = Qnil;
-  WVAR (p, buffer) = Qnil;
-  WVAR (p, combination_limit) = Qnil;
-  WVAR (p, window_parameters) = Qnil;
+  WSET (p, hchild, horflag ? window : Qnil);
+  WSET (p, vchild, horflag ? Qnil : window);
+  WSET (p, start, Qnil);
+  WSET (p, pointm, Qnil);
+  WSET (p, buffer, Qnil);
+  WSET (p, combination_limit, Qnil);
+  WSET (p, window_parameters, Qnil);
 }
 
 /* Make new window from scratch.  */
@@ -3293,19 +3287,19 @@ make_window (void)
   w = allocate_window ();
   /* Initialize Lisp data.  Note that allocate_window initializes all
      Lisp data to nil, so do it only for slots which should not be nil.  */
-  XSETFASTINT (WVAR (w, left_col), 0);
-  XSETFASTINT (WVAR (w, top_line), 0);
-  XSETFASTINT (WVAR (w, total_lines), 0);
-  XSETFASTINT (WVAR (w, total_cols), 0);
-  WVAR (w, normal_lines) = make_float (1.0);
-  WVAR (w, normal_cols) = make_float (1.0);
-  XSETFASTINT (WVAR (w, new_total), 0);
-  XSETFASTINT (WVAR (w, new_normal), 0);
-  WVAR (w, start) = Fmake_marker ();
-  WVAR (w, pointm) = Fmake_marker ();
-  WVAR (w, vertical_scroll_bar_type) = Qt;
-  XSETFASTINT (WVAR (w, window_end_pos), 0);
-  XSETFASTINT (WVAR (w, window_end_vpos), 0);
+  WSET (w, left_col, make_number (0));
+  WSET (w, top_line, make_number (0));
+  WSET (w, total_lines, make_number (0));
+  WSET (w, total_cols, make_number (0));
+  WSET (w, normal_lines, make_float (1.0));
+  WSET (w, normal_cols, make_float (1.0));
+  WSET (w, new_total, make_number (0));
+  WSET (w, new_normal, make_number (0));
+  WSET (w, start, Fmake_marker ());
+  WSET (w, pointm, Fmake_marker ());
+  WSET (w, vertical_scroll_bar_type, Qt);
+  WSET (w, window_end_pos, make_number (0));
+  WSET (w, window_end_vpos, make_number (0));
 
   /* Initialize non-Lisp data.  Note that allocate_window zeroes out all
      non-Lisp data, so do it only for slots which should not be zero.  */
@@ -3335,11 +3329,11 @@ Note: This function does not operate on any child windows of WINDOW.  */)
 
   CHECK_NUMBER (size);
   if (NILP (add))
-    XSETINT (WVAR (w, new_total), XINT (size));
+    WSET (w, new_total, size);
   else
-    XSETINT (WVAR (w, new_total), XINT (WVAR (w, new_total)) + XINT (size));
+    WSET (w, new_total, make_number (XINT (WGET (w, new_total)) + XINT (size)));
 
-  return WVAR (w, new_total);
+  return WGET (w, new_total);
 }
 
 DEFUN ("set-window-new-normal", Fset_window_new_normal, Sset_window_new_normal, 1, 2, 0,
@@ -3349,10 +3343,7 @@ Return SIZE.
 Note: This function does not operate on any child windows of WINDOW.  */)
      (Lisp_Object window, Lisp_Object size)
 {
-  struct window *w = decode_any_window (window);
-
-  WVAR (w, new_normal) = size;
-  return WVAR (w, new_normal);
+  return WSET (decode_any_window (window), new_normal, size);
 }
 
 /* Return 1 if setting w->total_lines (w->total_cols if HORFLAG is
@@ -3367,19 +3358,19 @@ window_resize_check (struct window *w, int horflag)
 {
   struct window *c;
 
-  if (!NILP (WVAR (w, vchild)))
+  if (!NILP (WGET (w, vchild)))
     /* W is a vertical combination.  */
     {
-      c = XWINDOW (WVAR (w, vchild));
+      c = XWINDOW (WGET (w, vchild));
       if (horflag)
        /* All child windows of W must have the same width as W.  */
        {
          while (c)
            {
-             if ((XINT (WVAR (c, new_total)) != XINT (WVAR (w, new_total)))
+             if ((XINT (WGET (c, new_total)) != XINT (WGET (w, new_total)))
                  || !window_resize_check (c, horflag))
                return 0;
-             c = NILP (WVAR (c, next)) ? 0 : XWINDOW (WVAR (c, next));
+             c = NILP (WGET (c, next)) ? 0 : XWINDOW (WGET (c, next));
            }
          return 1;
        }
@@ -3392,16 +3383,16 @@ window_resize_check (struct window *w, int horflag)
            {
              if (!window_resize_check (c, horflag))
                return 0;
-             sum_of_sizes = sum_of_sizes + XINT (WVAR (c, new_total));
-             c = NILP (WVAR (c, next)) ? 0 : XWINDOW (WVAR (c, next));
+             sum_of_sizes = sum_of_sizes + XINT (WGET (c, new_total));
+             c = NILP (WGET (c, next)) ? 0 : XWINDOW (WGET (c, next));
            }
-         return (sum_of_sizes == XINT (WVAR (w, new_total)));
+         return (sum_of_sizes == XINT (WGET (w, new_total)));
        }
     }
-  else if (!NILP (WVAR (w, hchild)))
+  else if (!NILP (WGET (w, hchild)))
     /* W is a horizontal combination.  */
     {
-      c = XWINDOW (WVAR (w, hchild));
+      c = XWINDOW (WGET (w, hchild));
       if (horflag)
        /* The sum of the widths of the child windows of W must equal W's
           width.  */
@@ -3411,20 +3402,20 @@ window_resize_check (struct window *w, int horflag)
            {
              if (!window_resize_check (c, horflag))
                return 0;
-             sum_of_sizes = sum_of_sizes + XINT (WVAR (c, new_total));
-             c = NILP (WVAR (c, next)) ? 0 : XWINDOW (WVAR (c, next));
+             sum_of_sizes = sum_of_sizes + XINT (WGET (c, new_total));
+             c = NILP (WGET (c, next)) ? 0 : XWINDOW (WGET (c, next));
            }
-         return (sum_of_sizes == XINT (WVAR (w, new_total)));
+         return (sum_of_sizes == XINT (WGET (w, new_total)));
        }
       else
        /* All child windows of W must have the same height as W.  */
        {
          while (c)
            {
-             if ((XINT (WVAR (c, new_total)) != XINT (WVAR (w, new_total)))
+             if ((XINT (WGET (c, new_total)) != XINT (WGET (w, new_total)))
                  || !window_resize_check (c, horflag))
                return 0;
-             c = NILP (WVAR (c, next)) ? 0 : XWINDOW (WVAR (c, next));
+             c = NILP (WGET (c, next)) ? 0 : XWINDOW (WGET (c, next));
            }
          return 1;
        }
@@ -3433,7 +3424,7 @@ window_resize_check (struct window *w, int horflag)
     /* A leaf window.  Make sure it's not too small.  The following
        hardcodes the values of `window-safe-min-width' (2) and
        `window-safe-min-height' (1) which are defined in window.el.  */
-    return XINT (WVAR (w, new_total)) >= (horflag ? 2 : 1);
+    return XINT (WGET (w, new_total)) >= (horflag ? 2 : 1);
 }
 
 /* Set w->total_lines (w->total_cols if HORIZONTAL is non-zero) to
@@ -3453,51 +3444,51 @@ window_resize_apply (struct window *w, int horflag)
      parent window has been set *before*.  */
   if (horflag)
     {
-      WVAR (w, total_cols) = WVAR (w, new_total);
-      if (NUMBERP (WVAR (w, new_normal)))
-       WVAR (w, normal_cols) = WVAR (w, new_normal);
+      WSET (w, total_cols, WGET (w, new_total));
+      if (NUMBERP (WGET (w, new_normal)))
+       WSET (w, normal_cols, WGET (w, new_normal));
 
-      pos = XINT (WVAR (w, left_col));
+      pos = XINT (WGET (w, left_col));
     }
   else
     {
-      WVAR (w, total_lines) = WVAR (w, new_total);
-      if (NUMBERP (WVAR (w, new_normal)))
-       WVAR (w, normal_lines) = WVAR (w, new_normal);
+      WSET (w, total_lines, WGET (w, new_total));
+      if (NUMBERP (WGET (w, new_normal)))
+       WSET (w, normal_lines, WGET (w, new_normal));
 
-      pos = XINT (WVAR (w, top_line));
+      pos = XINT (WGET (w, top_line));
     }
 
-  if (!NILP (WVAR (w, vchild)))
+  if (!NILP (WGET (w, vchild)))
     /* W is a vertical combination.  */
     {
-      c = XWINDOW (WVAR (w, vchild));
+      c = XWINDOW (WGET (w, vchild));
       while (c)
        {
          if (horflag)
-           XSETFASTINT (WVAR (c, left_col), pos);
+           WSET (c, left_col, make_number (pos));
          else
-           XSETFASTINT (WVAR (c, top_line), pos);
+           WSET (c, top_line, make_number (pos));
          window_resize_apply (c, horflag);
          if (!horflag)
-           pos = pos + XINT (WVAR (c, total_lines));
-         c = NILP (WVAR (c, next)) ? 0 : XWINDOW (WVAR (c, next));
+           pos = pos + XINT (WGET (c, total_lines));
+         c = NILP (WGET (c, next)) ? 0 : XWINDOW (WGET (c, next));
        }
     }
-  else if (!NILP (WVAR (w, hchild)))
+  else if (!NILP (WGET (w, hchild)))
     /* W is a horizontal combination.  */
     {
-      c = XWINDOW (WVAR (w, hchild));
+      c = XWINDOW (WGET (w, hchild));
       while (c)
        {
          if (horflag)
-           XSETFASTINT (WVAR (c, left_col), pos);
+           WSET (c, left_col, make_number (pos));
          else
-           XSETFASTINT (WVAR (c, top_line), pos);
+           WSET (c, top_line, make_number (pos));
          window_resize_apply (c, horflag);
          if (horflag)
-           pos = pos + XINT (WVAR (c, total_cols));
-         c = NILP (WVAR (c, next)) ? 0 : XWINDOW (WVAR (c, next));
+           pos = pos + XINT (WGET (c, total_cols));
+         c = NILP (WGET (c, next)) ? 0 : XWINDOW (WGET (c, next));
        }
     }
 
@@ -3533,8 +3524,8 @@ be applied on the Elisp level.  */)
   r = XWINDOW (FRAME_ROOT_WINDOW (f));
 
   if (!window_resize_check (r, horflag)
-      || ! EQ (WVAR (r, new_total),
-              (horflag ? WVAR (r, total_cols) : WVAR (r, total_lines))))
+      || ! EQ (WGET (r, new_total),
+              (horflag ? WGET (r, total_cols) : WGET (r, total_lines))))
     return Qnil;
 
   BLOCK_INPUT;
@@ -3574,39 +3565,39 @@ resize_frame_windows (struct frame *f, int size, int horflag)
                     - ((FRAME_HAS_MINIBUF_P (f) && !FRAME_MINIBUF_ONLY_P (f))
                        ? 1 : 0)));
 
-  XSETFASTINT (WVAR (r, top_line), FRAME_TOP_MARGIN (f));
-  if (NILP (WVAR (r, vchild)) && NILP (WVAR (r, hchild)))
+  WSET (r, top_line, make_number (FRAME_TOP_MARGIN (f)));
+  if (NILP (WGET (r, vchild)) && NILP (WGET (r, hchild)))
     /* For a leaf root window just set the size.  */
     if (horflag)
-      XSETFASTINT (WVAR (r, total_cols), new_size);
+      WSET (r, total_cols, make_number (new_size));
     else
-      XSETFASTINT (WVAR (r, total_lines), new_size);
+      WSET (r, total_lines, make_number (new_size));
   else
     {
       /* old_size is the old size of the frame's root window.  */
-      int old_size = XFASTINT (horflag ? WVAR (r, total_cols) 
-                              : WVAR (r, total_lines));
+      int old_size = XFASTINT (horflag ? WGET (r, total_cols) 
+                              : WGET (r, total_lines));
       Lisp_Object delta;
 
       XSETINT (delta, new_size - old_size);
       /* Try a "normal" resize first.  */
       resize_root_window (root, delta, horflag ? Qt : Qnil, Qnil);
       if (window_resize_check (r, horflag)
-         && new_size == XINT (WVAR (r, new_total)))
+         && new_size == XINT (WGET (r, new_total)))
        window_resize_apply (r, horflag);
       else
        {
          /* Try with "reasonable" minimum sizes next.  */
          resize_root_window (root, delta, horflag ? Qt : Qnil, Qt);
          if (window_resize_check (r, horflag)
-             && new_size == XINT (WVAR (r, new_total)))
+             && new_size == XINT (WGET (r, new_total)))
            window_resize_apply (r, horflag);
          else
            {
              /* Finally, try with "safe" minimum sizes.  */
              resize_root_window (root, delta, horflag ? Qt : Qnil, Qsafe);
              if (window_resize_check (r, horflag)
-                 && new_size == XINT (WVAR (r, new_total)))
+                 && new_size == XINT (WGET (r, new_total)))
                window_resize_apply (r, horflag);
              else
                {
@@ -3615,9 +3606,9 @@ resize_frame_windows (struct frame *f, int size, int horflag)
                  root = FGET (f, selected_window);
                  Fdelete_other_windows_internal (root, Qnil);
                  if (horflag)
-                   XSETFASTINT (WVAR (XWINDOW (root), total_cols), new_size);
+                   WSET (XWINDOW (root), total_cols, make_number (new_size));
                  else
-                   XSETFASTINT (WVAR (XWINDOW (root), total_lines), new_size);
+                   WSET (XWINDOW (root), total_lines, make_number (new_size));
                }
            }
        }
@@ -3627,13 +3618,13 @@ resize_frame_windows (struct frame *f, int size, int horflag)
     {
       m = XWINDOW (mini);
       if (horflag)
-       XSETFASTINT (WVAR (m, total_cols), size);
+       WSET (m, total_cols, make_number (size));
       else
        {
          /* Are we sure we always want 1 line here?  */
-         XSETFASTINT (WVAR (m, total_lines), 1);
-         XSETFASTINT (WVAR (m, top_line), XINT (WVAR (r, top_line))
-                      + XINT (WVAR (r, total_lines)));
+         WSET (m, total_lines, make_number (1));
+         WSET (m, top_line,
+               make_number (XINT (WGET (r, top_line)) + XINT (WGET (r, total_lines))));
        }
     }
 }
@@ -3689,10 +3680,10 @@ set correctly.  See the code of `split-window' for how this is done.  */)
      parent, or OLD is ortho-combined.  */
   combination_limit =
     !NILP (Vwindow_combination_limit)
-    || NILP (WVAR (o, parent))
+    || NILP (WGET (o, parent))
     || NILP (horflag
-            ? (WVAR (XWINDOW (WVAR (o, parent)), hchild))
-            : (WVAR (XWINDOW (WVAR (o, parent)), vchild)));
+            ? (WGET (XWINDOW (WGET (o, parent)), hchild))
+            : (WGET (XWINDOW (WGET (o, parent)), vchild)));
 
   /* We need a live reference window to initialize some parameters.  */
   if (WINDOW_LIVE_P (old))
@@ -3712,24 +3703,24 @@ set correctly.  See the code of `split-window' for how this is done.  */)
     /* `window-combination-resize' non-nil means try to resize OLD's siblings
        proportionally.  */
     {
-      p = XWINDOW (WVAR (o, parent));
+      p = XWINDOW (WGET (o, parent));
       /* Temporarily pretend we split the parent window.  */
-      XSETINT (WVAR (p, new_total),
-              XINT (horflag ? WVAR (p, total_cols) : WVAR (p, total_lines))
-              - XINT (total_size));
+      WSET (p, new_total,
+           make_number (XINT (horflag ? WGET (p, total_cols) : WGET (p, total_lines))
+                        - XINT (total_size)));
       if (!window_resize_check (p, horflag))
        error ("Window sizes don't fit");
       else
        /* Undo the temporary pretension.  */
-       WVAR (p, new_total)
-         = horflag ? WVAR (p, total_cols) : WVAR (p, total_lines);
+       WSET (p, new_total,
+             horflag ? WGET (p, total_cols) : WGET (p, total_lines));
     }
   else
     {
       if (!window_resize_check (o, horflag))
        error ("Resizing old window failed");
-      else if (XINT (total_size) + XINT (WVAR (o, new_total))
-              != XINT (horflag ? WVAR (o, total_cols) : WVAR (o, total_lines)))
+      else if (XINT (total_size) + XINT (WGET (o, new_total))
+              != XINT (horflag ? WGET (o, total_cols) : WGET (o, total_lines)))
        error ("Sum of sizes of old and new window don't fit");
     }
 
@@ -3740,94 +3731,95 @@ set correctly.  See the code of `split-window' for how this is done.  */)
         by make_parent_window and we need it below for assigning it to
         p->new_normal.  */
       Lisp_Object new_normal
-       = horflag ? WVAR (o, normal_cols) : WVAR (o, normal_lines);
+       = horflag ? WGET (o, normal_cols) : WGET (o, normal_lines);
 
       make_parent_window (old, horflag);
-      p = XWINDOW (WVAR (o, parent));
+      p = XWINDOW (WGET (o, parent));
       /* Store value of `window-combination-limit' in new parent's
         combination_limit slot.  */
-      WVAR (p, combination_limit) = Vwindow_combination_limit;
+      WSET (p, combination_limit, Vwindow_combination_limit);
       /* These get applied below.  */
-      WVAR (p, new_total)
-       = horflag ? WVAR (o, total_cols) : WVAR (o, total_lines);
-      WVAR (p, new_normal) = new_normal;
+      WSET (p, new_total,
+           horflag ? WGET (o, total_cols) : WGET (o, total_lines));
+      WSET (p, new_normal, new_normal);
     }
   else
-    p = XWINDOW (WVAR (o, parent));
+    p = XWINDOW (WGET (o, parent));
 
   windows_or_buffers_changed++;
   FRAME_WINDOW_SIZES_CHANGED (f) = 1;
   new = make_window ();
   n = XWINDOW (new);
-  WVAR (n, frame) = frame;
-  WVAR (n, parent) = WVAR (o, parent);
-  WVAR (n, vchild) = WVAR (n, hchild) = Qnil;
+  WSET (n, frame, frame);
+  WSET (n, parent, WGET (o, parent));
+  WSET (n, vchild, Qnil);
+  WSET (n, hchild, Qnil);
 
   if (EQ (side, Qabove) || EQ (side, Qleft))
     {
-      WVAR (n, prev) = WVAR (o, prev);
-      if (NILP (WVAR (n, prev)))
+      WSET (n, prev, WGET (o, prev));
+      if (NILP (WGET (n, prev)))
        if (horflag)
-         WVAR (p, hchild) = new;
+         WSET (p, hchild, new);
        else
-         WVAR (p, vchild) = new;
+         WSET (p, vchild, new);
       else
-       WVAR (XWINDOW (WVAR (n, prev)), next) = new;
-      WVAR (n, next) = old;
-      WVAR (o, prev) = new;
+       WSET (XWINDOW (WGET (n, prev)), next, new);
+      WSET (n, next, old);
+      WSET (o, prev, new);
     }
   else
     {
-      WVAR (n, next) = WVAR (o, next);
-      if (!NILP (WVAR (n, next)))
-       WVAR (XWINDOW (WVAR (n, next)), prev) = new;
-      WVAR (n, prev) = old;
-      WVAR (o, next) = new;
+      WSET (n, next, WGET (o, next));
+      if (!NILP (WGET (n, next)))
+       WSET (XWINDOW (WGET (n, next)), prev, new);
+      WSET (n, prev, old);
+      WSET (o, next, new);
     }
 
-  WVAR (n, buffer) = Qt;
-  WVAR (n, window_end_valid) = Qnil;
+  WSET (n, buffer, Qt);
+  WSET (n, window_end_valid, Qnil);
   memset (&n->last_cursor, 0, sizeof n->last_cursor);
 
   /* Get special geometry settings from reference window.  */
-  WVAR (n, left_margin_cols) = WVAR (r, left_margin_cols);
-  WVAR (n, right_margin_cols) = WVAR (r, right_margin_cols);
-  WVAR (n, left_fringe_width) = WVAR (r, left_fringe_width);
-  WVAR (n, right_fringe_width) = WVAR (r, right_fringe_width);
+  WSET (n, left_margin_cols, WGET (r, left_margin_cols));
+  WSET (n, right_margin_cols, WGET (r, right_margin_cols));
+  WSET (n, left_fringe_width, WGET (r, left_fringe_width));
+  WSET (n, right_fringe_width, WGET (r, right_fringe_width));
   n->fringes_outside_margins = r->fringes_outside_margins;
-  WVAR (n, scroll_bar_width) = WVAR (r, scroll_bar_width);
-  WVAR (n, vertical_scroll_bar_type) = WVAR (r, vertical_scroll_bar_type);
+  WSET (n, scroll_bar_width, WGET (r, scroll_bar_width));
+  WSET (n, vertical_scroll_bar_type, WGET (r, vertical_scroll_bar_type));
 
   /* Directly assign orthogonal coordinates and sizes.  */
   if (horflag)
     {
-      WVAR (n, top_line) = WVAR (o, top_line);
-      WVAR (n, total_lines) = WVAR (o, total_lines);
+      WSET (n, top_line, WGET (o, top_line));
+      WSET (n, total_lines, WGET (o, total_lines));
     }
   else
     {
-      WVAR (n, left_col) = WVAR (o, left_col);
-      WVAR (n, total_cols) = WVAR (o, total_cols);
+      WSET (n, left_col, WGET (o, left_col));
+      WSET (n, total_cols, WGET (o, total_cols));
     }
 
   /* Iso-coordinates and sizes are assigned by window_resize_apply,
      get them ready here.  */
-  WVAR (n, new_total) = total_size;
-  WVAR (n, new_normal) = normal_size;
+  WSET (n, new_total, total_size);
+  WSET (n, new_normal, normal_size);
 
   BLOCK_INPUT;
   window_resize_apply (p, horflag);
   adjust_glyphs (f);
   /* Set buffer of NEW to buffer of reference window.  Don't run
      any hooks.  */
-  set_window_buffer (new, WVAR (r, buffer), 0, 1);
+  set_window_buffer (new, WGET (r, buffer), 0, 1);
   UNBLOCK_INPUT;
 
   /* Maybe we should run the scroll functions in Elisp (which already
      runs the configuration change hook).  */
   if (! NILP (Vwindow_scroll_functions))
     run_hook_with_args_2 (Qwindow_scroll_functions, new,
-                         Fmarker_position (WVAR (n, start)));
+                         Fmarker_position (WGET (n, start)));
   /* Return NEW.  */
   return new;
 }
@@ -3847,22 +3839,22 @@ Signal an error when WINDOW is the only window on its frame.  */)
 
   w = decode_any_window (window);
   XSETWINDOW (window, w);
-  if (NILP (WVAR (w, buffer))
-      && NILP (WVAR (w, hchild)) && NILP (WVAR (w, vchild)))
+  if (NILP (WGET (w, buffer))
+      && NILP (WGET (w, hchild)) && NILP (WGET (w, vchild)))
     /* It's a no-op to delete an already deleted window.  */
     return Qnil;
 
-  parent = WVAR (w, parent);
+  parent = WGET (w, parent);
   if (NILP (parent))
     /* Never delete a minibuffer or frame root window.  */
     error ("Attempt to delete minibuffer or sole ordinary window");
-  else if (NILP (WVAR (w, prev)) && NILP (WVAR (w, next)))
+  else if (NILP (WGET (w, prev)) && NILP (WGET (w, next)))
     /* Rather bow out here, this case should be handled on the Elisp
        level.  */
     error ("Attempt to delete sole window of parent");
 
   p = XWINDOW (parent);
-  horflag = NILP (WVAR (p, vchild));
+  horflag = NILP (WGET (p, vchild));
 
   frame = WINDOW_FRAME (w);
   f = XFRAME (frame);
@@ -3871,33 +3863,33 @@ Signal an error when WINDOW is the only window on its frame.  */)
   r = XWINDOW (root);
 
   /* Unlink WINDOW from window tree.  */
-  if (NILP (WVAR (w, prev)))
+  if (NILP (WGET (w, prev)))
     /* Get SIBLING below (on the right of) WINDOW.  */
     {
       /* before_sibling 1 means WINDOW is the first child of its
         parent and thus before the sibling.  */
       before_sibling = 1;
-      sibling = WVAR (w, next);
+      sibling = WGET (w, next);
       s = XWINDOW (sibling);
-      WVAR (s, prev) = Qnil;
+      WSET (s, prev, Qnil);
       if (horflag)
-       WVAR (p, hchild) = sibling;
+       WSET (p, hchild, sibling);
       else
-       WVAR (p, vchild) = sibling;
+       WSET (p, vchild, sibling);
     }
   else
     /* Get SIBLING above (on the left of) WINDOW.  */
     {
-      sibling = WVAR (w, prev);
+      sibling = WGET (w, prev);
       s = XWINDOW (sibling);
-      WVAR (s, next) = WVAR (w, next);
-      if (!NILP (WVAR (s, next)))
-       WVAR (XWINDOW (WVAR (s, next)), prev) = sibling;
+      WSET (s, next, WGET (w, next));
+      if (!NILP (WGET (s, next)))
+       WSET (XWINDOW (WGET (s, next)), prev, sibling);
     }
 
   if (window_resize_check (r, horflag)
-      && EQ (WVAR (r, new_total),
-            (horflag ? WVAR (r, total_cols) : WVAR (r, total_lines))))
+      && EQ (WGET (r, new_total),
+            (horflag ? WGET (r, total_cols) : WGET (r, total_lines))))
     /* We can delete WINDOW now.  */
     {
 
@@ -3919,28 +3911,28 @@ Signal an error when WINDOW is the only window on its frame.  */)
       Vwindow_list = Qnil;
       FRAME_WINDOW_SIZES_CHANGED (f) = 1;
 
-      WVAR (w, next) = Qnil;  /* Don't delete w->next too.  */
+      WSET (w, next, Qnil);  /* Don't delete w->next too.  */
       free_window_matrices (w);
 
-      if (!NILP (WVAR (w, vchild)))
+      if (!NILP (WGET (w, vchild)))
        {
-         delete_all_child_windows (WVAR (w, vchild));
-         WVAR (w, vchild) = Qnil;
+         delete_all_child_windows (WGET (w, vchild));
+         WSET (w, vchild, Qnil);
        }
-      else if (!NILP (WVAR (w, hchild)))
+      else if (!NILP (WGET (w, hchild)))
        {
-         delete_all_child_windows (WVAR (w, hchild));
-         WVAR (w, hchild) = Qnil;
+         delete_all_child_windows (WGET (w, hchild));
+         WSET (w, hchild, Qnil);
        }
-      else if (!NILP (WVAR (w, buffer)))
+      else if (!NILP (WGET (w, buffer)))
        {
          unshow_buffer (w);
-         unchain_marker (XMARKER (WVAR (w, pointm)));
-         unchain_marker (XMARKER (WVAR (w, start)));
-         WVAR (w, buffer) = Qnil;
+         unchain_marker (XMARKER (WGET (w, pointm)));
+         unchain_marker (XMARKER (WGET (w, start)));
+         WSET (w, buffer, Qnil);
        }
 
-      if (NILP (WVAR (s, prev)) && NILP (WVAR (s, next)))
+      if (NILP (WGET (s, prev)) && NILP (WGET (s, next)))
          /* A matrjoshka where SIBLING has become the only child of
             PARENT.  */
        {
@@ -3948,10 +3940,11 @@ Signal an error when WINDOW is the only window on its frame.  */)
          replace_window (parent, sibling, 0);
          /* Have SIBLING inherit the following three slot values from
             PARENT (the combination_limit slot is not inherited).  */
-         WVAR (s, normal_cols) = WVAR (p, normal_cols);
-         WVAR (s, normal_lines) = WVAR (p, normal_lines);
+         WSET (s, normal_cols, WGET (p, normal_cols));
+         WSET (s, normal_lines, WGET (p, normal_lines));
          /* Mark PARENT as deleted.  */
-         WVAR (p, vchild) = WVAR (p, hchild) = Qnil;
+         WSET (p, vchild, Qnil);
+         WSET (p, hchild, Qnil);
          /* Try to merge SIBLING into its new parent.  */
          recombine_windows (sibling);
        }
@@ -3978,7 +3971,7 @@ Signal an error when WINDOW is the only window on its frame.  */)
          /* Now look whether `get-mru-window' gets us something.  */
          mru_window = call1 (Qget_mru_window, frame);
          if (WINDOW_LIVE_P (mru_window)
-             && EQ (WVAR (XWINDOW (mru_window), frame), frame))
+             && EQ (WGET (XWINDOW (mru_window), frame), frame))
            new_selected_window = mru_window;
 
          /* If all ended up well, we now promote the mru window.  */
@@ -3998,17 +3991,17 @@ Signal an error when WINDOW is the only window on its frame.  */)
     {
       if (before_sibling)
        {
-         WVAR (s, prev) = window;
+         WSET (s, prev, window);
          if (horflag)
-           WVAR (p, hchild) = window;
+           WSET (p, hchild, window);
          else
-           WVAR (p, vchild) = window;
+           WSET (p, vchild, window);
        }
       else
        {
-         WVAR (s, next) = window;
-         if (!NILP (WVAR (w, next)))
-           WVAR (XWINDOW (WVAR (w, next)), prev) = window;
+         WSET (s, next, window);
+         if (!NILP (WGET (w, next)))
+           WSET (XWINDOW (WGET (w, next)), prev, window);
        }
       error ("Deletion failed");
     }
@@ -4025,7 +4018,7 @@ Signal an error when WINDOW is the only window on its frame.  */)
 void
 grow_mini_window (struct window *w, int delta)
 {
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
   struct window *r;
   Lisp_Object root, value;
 
@@ -4042,9 +4035,10 @@ grow_mini_window (struct window *w, int delta)
       window_resize_apply (r, 0);
 
       /* Grow the mini-window.  */
-      XSETFASTINT (WVAR (w, top_line),
-                  XFASTINT (WVAR (r, top_line)) + XFASTINT (WVAR (r, total_lines)));
-      XSETFASTINT (WVAR (w, total_lines), XFASTINT (WVAR (w, total_lines)) - XINT (value));
+      WSET (w, top_line,
+           make_number (XFASTINT (WGET (r, top_line)) + XFASTINT (WGET (r, total_lines))));
+      WSET (w, total_lines,
+           make_number (XFASTINT (WGET (w, total_lines)) - XINT (value)));
       w->last_modified = 0;
       w->last_overlay_modified = 0;
 
@@ -4058,14 +4052,14 @@ grow_mini_window (struct window *w, int delta)
 void
 shrink_mini_window (struct window *w)
 {
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
   struct window *r;
   Lisp_Object root, value;
   EMACS_INT size;
 
   eassert (MINI_WINDOW_P (w));
 
-  size = XINT (WVAR (w, total_lines));
+  size = XINT (WGET (w, total_lines));
   if (size > 1)
     {
       root = FRAME_ROOT_WINDOW (f);
@@ -4078,9 +4072,9 @@ shrink_mini_window (struct window *w)
          window_resize_apply (r, 0);
 
          /* Shrink the mini-window.  */
-         XSETFASTINT (WVAR (w, top_line), XFASTINT (WVAR (r, top_line))
-                      + XFASTINT (WVAR (r, total_lines)));
-         XSETFASTINT (WVAR (w, total_lines), 1);
+         WSET (w, top_line,
+               make_number (XFASTINT (WGET (r, top_line)) + XFASTINT (WGET (r, total_lines))));
+         WSET (w, total_lines, make_number (1));
 
          w->last_modified = 0;
          w->last_overlay_modified = 0;
@@ -4105,25 +4099,25 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini
   int height;
 
   CHECK_WINDOW (window);
-  f = XFRAME (WVAR (w, frame));
+  f = XFRAME (WGET (w, frame));
 
-  if (!EQ (FRAME_MINIBUF_WINDOW (XFRAME (WVAR (w, frame))), window))
+  if (!EQ (FRAME_MINIBUF_WINDOW (XFRAME (WGET (w, frame))), window))
     error ("Not a valid minibuffer window");
   else if (FRAME_MINIBUF_ONLY_P (f))
     error ("Cannot resize a minibuffer-only frame");
 
   r = XWINDOW (FRAME_ROOT_WINDOW (f));
-  height = XINT (WVAR (r, total_lines)) + XINT (WVAR (w, total_lines));
+  height = XINT (WGET (r, total_lines)) + XINT (WGET (w, total_lines));
   if (window_resize_check (r, 0)
-      && XINT (WVAR (w, new_total)) > 0
-      && height == XINT (WVAR (r, new_total)) + XINT (WVAR (w, new_total)))
+      && XINT (WGET (w, new_total)) > 0
+      && height == XINT (WGET (r, new_total)) + XINT (WGET (w, new_total)))
     {
       BLOCK_INPUT;
       window_resize_apply (r, 0);
 
-      WVAR (w, total_lines) = WVAR (w, new_total);
-      XSETFASTINT (WVAR (w, top_line),
-                  XINT (WVAR (r, top_line)) + XINT (WVAR (r, total_lines)));
+      WSET (w, total_lines, WGET (w, new_total));
+      WSET (w, top_line,
+           make_number (XINT (WGET (r, top_line)) + XINT (WGET (r, total_lines))));
 
       windows_or_buffers_changed++;
       FRAME_WINDOW_SIZES_CHANGED (f) = 1;
@@ -4146,14 +4140,14 @@ mark_window_cursors_off (struct window *w)
 {
   while (w)
     {
-      if (!NILP (WVAR (w, hchild)))
-       mark_window_cursors_off (XWINDOW (WVAR (w, hchild)));
-      else if (!NILP (WVAR (w, vchild)))
-       mark_window_cursors_off (XWINDOW (WVAR (w, vchild)));
+      if (!NILP (WGET (w, hchild)))
+       mark_window_cursors_off (XWINDOW (WGET (w, hchild)));
+      else if (!NILP (WGET (w, vchild)))
+       mark_window_cursors_off (XWINDOW (WGET (w, vchild)));
       else
        w->phys_cursor_on_p = 0;
 
-      w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next));
+      w = NILP (WGET (w, next)) ? 0 : XWINDOW (WGET (w, next));
     }
 }
 
@@ -4163,15 +4157,15 @@ mark_window_cursors_off (struct window *w)
 int
 window_internal_height (struct window *w)
 {
-  int ht = XFASTINT (WVAR (w, total_lines));
+  int ht = XFASTINT (WGET (w, total_lines));
 
   if (!MINI_WINDOW_P (w))
     {
-      if (!NILP (WVAR (w, parent))
-         || !NILP (WVAR (w, vchild))
-         || !NILP (WVAR (w, hchild))
-         || !NILP (WVAR (w, next))
-         || !NILP (WVAR (w, prev))
+      if (!NILP (WGET (w, parent))
+         || !NILP (WGET (w, vchild))
+         || !NILP (WGET (w, hchild))
+         || !NILP (WGET (w, next))
+         || !NILP (WGET (w, prev))
          || WINDOW_WANTS_MODELINE_P (w))
        --ht;
 
@@ -4201,7 +4195,7 @@ window_scroll (Lisp_Object window, EMACS_INT n, int whole, int noerror)
 
   /* If we must, use the pixel-based version which is much slower than
      the line-based one but can handle varying line heights.  */
-  if (FRAME_WINDOW_P (XFRAME (WVAR (XWINDOW (window), frame))))
+  if (FRAME_WINDOW_P (XFRAME (WGET (XWINDOW (window), frame))))
     window_scroll_pixel_based (window, n, whole, noerror);
   else
     window_scroll_line_based (window, n, whole, noerror);
@@ -4226,7 +4220,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
   int x, y, rtop, rbot, rowh, vpos;
   void *itdata = NULL;
 
-  SET_TEXT_POS_FROM_MARKER (start, WVAR (w, start));
+  SET_TEXT_POS_FROM_MARKER (start, WGET (w, start));
   /* Scrolling a minibuffer window via scroll bar when the echo area
      shows long text sometimes resets the minibuffer contents behind
      our backs.  */
@@ -4307,8 +4301,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
                    spos = XINT (Fline_beginning_position (Qnil));
                  else
                    spos = min (XINT (Fline_end_position (Qnil)) + 1, ZV);
-                 set_marker_restricted (WVAR (w, start), make_number (spos),
-                                        WVAR (w, buffer));
+                 set_marker_restricted (WGET (w, start), make_number (spos),
+                                        WGET (w, buffer));
                  w->start_at_line_beg = 1;
                  w->update_mode_line = 1;
                  w->last_modified = 0;
@@ -4432,7 +4426,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
 
       /* If control gets here, then we vscrolled.  */
 
-      XBUFFER (WVAR (w, buffer))->prevent_redisplay_optimizations_p = 1;
+      XBUFFER (WGET (w, buffer))->prevent_redisplay_optimizations_p = 1;
 
       /* Don't try to change the window start below.  */
       vscrolled = 1;
@@ -4452,9 +4446,9 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
        }
 
       /* Set the window start, and set up the window for redisplay.  */
-      set_marker_restricted (WVAR (w, start), make_number (pos),
-                            WVAR (w, buffer));
-      bytepos = XMARKER (WVAR (w, start))->bytepos;
+      set_marker_restricted (WGET (w, start), make_number (pos),
+                            WGET (w, buffer));
+      bytepos = XMARKER (WGET (w, start))->bytepos;
       w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n');
       w->update_mode_line = 1;
       w->last_modified = 0;
@@ -4473,7 +4467,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
      even if there is a header line.  */
   this_scroll_margin = max (0, scroll_margin);
   this_scroll_margin
-    = min (this_scroll_margin, XFASTINT (WVAR (w, total_lines)) / 4);
+    = min (this_scroll_margin, XFASTINT (WGET (w, total_lines)) / 4);
   this_scroll_margin *= FRAME_LINE_HEIGHT (it.f);
 
   if (n > 0)
@@ -4547,7 +4541,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
        ;
       else if (window_scroll_pixel_based_preserve_y >= 0)
        {
-         SET_TEXT_POS_FROM_MARKER (start, WVAR (w, start));
+         SET_TEXT_POS_FROM_MARKER (start, WGET (w, start));
          start_display (&it, w, start);
          /* It would be wrong to subtract CURRENT_HEADER_LINE_HEIGHT
             here because we called start_display again and did not
@@ -4601,7 +4595,7 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
   if (whole)
     n *= max (1, ht - next_screen_context_lines);
 
-  startpos = marker_position (WVAR (w, start));
+  startpos = marker_position (WGET (w, start));
 
   if (!NILP (Vscroll_preserve_screen_position))
     {
@@ -4652,9 +4646,9 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
     {
       /* Don't use a scroll margin that is negative or too large.  */
       int this_scroll_margin =
-       max (0, min (scroll_margin, XINT (WVAR (w, total_lines)) / 4));
+       max (0, min (scroll_margin, XINT (WGET (w, total_lines)) / 4));
 
-      set_marker_restricted_both (WVAR (w, start), WVAR (w, buffer), pos, pos_byte);
+      set_marker_restricted_both (WGET (w, start), WGET (w, buffer), pos, pos_byte);
       w->start_at_line_beg = !NILP (bolp);
       w->update_mode_line = 1;
       w->last_modified = 0;
@@ -4748,10 +4742,10 @@ scroll_command (Lisp_Object n, int direction)
 
   /* If selected window's buffer isn't current, make it current for
      the moment.  But don't screw up if window_scroll gets an error.  */
-  if (XBUFFER (WVAR (XWINDOW (selected_window), buffer)) != current_buffer)
+  if (XBUFFER (WGET (XWINDOW (selected_window), buffer)) != current_buffer)
     {
       record_unwind_protect (save_excursion_restore, save_excursion_save ());
-      Fset_buffer (WVAR (XWINDOW (selected_window), buffer));
+      Fset_buffer (WGET (XWINDOW (selected_window), buffer));
 
       /* Make redisplay consider other windows than just selected_window.  */
       ++windows_or_buffers_changed;
@@ -4866,8 +4860,8 @@ specifies the window to scroll.  This takes precedence over
   record_unwind_protect (save_excursion_restore, save_excursion_save ());
   ++windows_or_buffers_changed;
 
-  Fset_buffer (WVAR (w, buffer));
-  SET_PT (marker_position (WVAR (w, pointm)));
+  Fset_buffer (WGET (w, buffer));
+  SET_PT (marker_position (WGET (w, pointm)));
 
   if (NILP (arg))
     window_scroll (window, 1, 1, 1);
@@ -4881,7 +4875,7 @@ specifies the window to scroll.  This takes precedence over
       window_scroll (window, XINT (arg), 0, 1);
     }
 
-  set_marker_both (WVAR (w, pointm), Qnil, PT, PT_BYTE);
+  set_marker_both (WGET (w, pointm), Qnil, PT, PT_BYTE);
   unbind_to (count, Qnil);
 
   return Qnil;
@@ -4959,10 +4953,10 @@ displayed_window_lines (struct window *w)
   int bottom_y;
   void *itdata = NULL;
 
-  if (XBUFFER (WVAR (w, buffer)) != current_buffer)
+  if (XBUFFER (WGET (w, buffer)) != current_buffer)
     {
       old_buffer = current_buffer;
-      set_buffer_internal (XBUFFER (WVAR (w, buffer)));
+      set_buffer_internal (XBUFFER (WGET (w, buffer)));
     }
   else
     old_buffer = NULL;
@@ -4970,12 +4964,12 @@ displayed_window_lines (struct window *w)
   /* In case W->start is out of the accessible range, do something
      reasonable.  This happens in Info mode when Info-scroll-down
      calls (recenter -1) while W->start is 1.  */
-  if (XMARKER (WVAR (w, start))->charpos < BEGV)
+  if (XMARKER (WGET (w, start))->charpos < BEGV)
     SET_TEXT_POS (start, BEGV, BEGV_BYTE);
-  else if (XMARKER (WVAR (w, start))->charpos > ZV)
+  else if (XMARKER (WGET (w, start))->charpos > ZV)
     SET_TEXT_POS (start, ZV, ZV_BYTE);
   else
-    SET_TEXT_POS_FROM_MARKER (start, WVAR (w, start));
+    SET_TEXT_POS_FROM_MARKER (start, WGET (w, start));
 
   itdata = bidi_shelve_cache ();
   start_display (&it, w, start);
@@ -4989,7 +4983,7 @@ displayed_window_lines (struct window *w)
      This kludge fixes a bug whereby (move-to-window-line -1)
      when ZV is on the last screen line
      moves to the previous screen line instead of the last one.  */
-  if (! FRAME_WINDOW_P (XFRAME (WVAR (w, frame))))
+  if (! FRAME_WINDOW_P (XFRAME (WGET (w, frame))))
     height++;
 
   /* Add in empty lines at the bottom of the window.  */
@@ -5024,7 +5018,7 @@ and redisplay normally--don't erase and redraw the frame.  */)
   (register Lisp_Object arg)
 {
   struct window *w = XWINDOW (selected_window);
-  struct buffer *buf = XBUFFER (WVAR (w, buffer));
+  struct buffer *buf = XBUFFER (WGET (w, buffer));
   struct buffer *obuf = current_buffer;
   int center_p = 0;
   ptrdiff_t charpos, bytepos;
@@ -5068,12 +5062,12 @@ and redisplay normally--don't erase and redraw the frame.  */)
   /* Do this after making BUF current
      in case scroll_margin is buffer-local.  */
   this_scroll_margin =
-    max (0, min (scroll_margin, XFASTINT (WVAR (w, total_lines)) / 4));
+    max (0, min (scroll_margin, XFASTINT (WGET (w, total_lines)) / 4));
 
   /* Handle centering on a graphical frame specially.  Such frames can
      have variable-height lines and centering point on the basis of
      line counts would lead to strange effects.  */
-  if (FRAME_WINDOW_P (XFRAME (WVAR (w, frame))))
+  if (FRAME_WINDOW_P (XFRAME (WGET (w, frame))))
     {
       if (center_p)
        {
@@ -5190,8 +5184,8 @@ and redisplay normally--don't erase and redraw the frame.  */)
     }
 
   /* Set the new window start.  */
-  set_marker_both (WVAR (w, start), WVAR (w, buffer), charpos, bytepos);
-  WVAR (w, window_end_valid) = Qnil;
+  set_marker_both (WGET (w, start), WGET (w, buffer), charpos, bytepos);
+  WSET (w, window_end_valid, Qnil);
 
   w->optional_new_start = 1;
 
@@ -5213,7 +5207,7 @@ nor any partial-height lines at the bottom of the text area.  */)
 {
   struct window *w = decode_window (window);
   int pixel_height = window_box_height (w);
-  int line_height = pixel_height / FRAME_LINE_HEIGHT (XFRAME (WVAR (w, frame)));
+  int line_height = pixel_height / FRAME_LINE_HEIGHT (XFRAME (WGET (w, frame)));
   return make_number (line_height);
 }
 
@@ -5234,24 +5228,24 @@ zero means top of window, negative means relative to bottom of window.  */)
   int this_scroll_margin;
 #endif
 
-  if (!(BUFFERP (WVAR (w, buffer))
-       && XBUFFER (WVAR (w, buffer)) == current_buffer))
+  if (!(BUFFERP (WGET (w, buffer))
+       && XBUFFER (WGET (w, buffer)) == current_buffer))
     /* This test is needed to make sure PT/PT_BYTE make sense in w->buffer
        when passed below to set_marker_both.  */
     error ("move-to-window-line called from unrelated buffer");
 
   window = selected_window;
-  start = marker_position (WVAR (w, start));
+  start = marker_position (WGET (w, start));
   if (start < BEGV || start > ZV)
     {
       int height = window_internal_height (w);
       Fvertical_motion (make_number (- (height / 2)), window);
-      set_marker_both (WVAR (w, start), WVAR (w, buffer), PT, PT_BYTE);
+      set_marker_both (WGET (w, start), WGET (w, buffer), PT, PT_BYTE);
       w->start_at_line_beg = !NILP (Fbolp ());
       w->force_start = 1;
     }
   else
-    Fgoto_char (WVAR (w, start));
+    Fgoto_char (WGET (w, start));
 
   lines = displayed_window_lines (w);
 
@@ -5355,7 +5349,7 @@ DEFUN ("window-configuration-frame", Fwindow_configuration_frame, Swindow_config
 
   data = (struct save_window_data *) XVECTOR (config);
   saved_windows = XVECTOR (data->saved_windows);
-  return WVAR (XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window), frame);
+  return WGET (XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window), frame);
 }
 
 DEFUN ("set-window-configuration", Fset_window_configuration,
@@ -5397,11 +5391,11 @@ the return value is nil.  Otherwise the value is t.  */)
           window-point of the final-selected-window to the window-point of
           the current-selected-window.  So we have to be careful which
           point of the current-buffer we copy into old_point.  */
-       if (EQ (WVAR (XWINDOW (data->current_window), buffer), new_current_buffer)
+       if (EQ (WGET (XWINDOW (data->current_window), buffer), new_current_buffer)
            && WINDOWP (selected_window)
-           && EQ (WVAR (XWINDOW (selected_window), buffer), new_current_buffer)
+           && EQ (WGET (XWINDOW (selected_window), buffer), new_current_buffer)
            && !EQ (selected_window, data->current_window))
-         old_point = XMARKER (WVAR (XWINDOW (data->current_window), pointm))->charpos;
+         old_point = XMARKER (WGET (XWINDOW (data->current_window), pointm))->charpos;
        else
          old_point = PT;
       else
@@ -5413,15 +5407,15 @@ the return value is nil.  Otherwise the value is t.  */)
           So if possible we want this arbitrary choice of "which point" to
           be the one from the to-be-selected-window so as to prevent this
           window's cursor from being copied from another window.  */
-       if (EQ (WVAR (XWINDOW (data->current_window), buffer), new_current_buffer)
+       if (EQ (WGET (XWINDOW (data->current_window), buffer), new_current_buffer)
            /* If current_window = selected_window, its point is in BUF_PT.  */
            && !EQ (selected_window, data->current_window))
-         old_point = XMARKER (WVAR (XWINDOW (data->current_window), pointm))->charpos;
+         old_point = XMARKER (WGET (XWINDOW (data->current_window), pointm))->charpos;
        else
          old_point = BUF_PT (XBUFFER (new_current_buffer));
     }
 
-  frame = WVAR (XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window), frame);
+  frame = WGET (XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window), frame);
   f = XFRAME (frame);
 
   /* If f is a dead frame, don't bother rebuilding its window tree.
@@ -5474,13 +5468,13 @@ the return value is nil.  Otherwise the value is t.  */)
         window holds garbage.)  We do this now, before
         restoring the window contents, and prevent it from
         being done later on when we select a new window.  */
-      if (! NILP (WVAR (XWINDOW (selected_window), buffer)))
+      if (! NILP (WGET (XWINDOW (selected_window), buffer)))
        {
          w = XWINDOW (selected_window);
-         set_marker_both (WVAR (w, pointm),
-                          WVAR (w, buffer),
-                          BUF_PT (XBUFFER (WVAR (w, buffer))),
-                          BUF_PT_BYTE (XBUFFER (WVAR (w, buffer))));
+         set_marker_both (WGET (w, pointm),
+                          WGET (w, buffer),
+                          BUF_PT (XBUFFER (WGET (w, buffer))),
+                          BUF_PT_BYTE (XBUFFER (WGET (w, buffer))));
        }
 
       windows_or_buffers_changed++;
@@ -5509,60 +5503,60 @@ the return value is nil.  Otherwise the value is t.  */)
          p = SAVED_WINDOW_N (saved_windows, k);
          window = p->window;
          w = XWINDOW (window);
-         WVAR (w, next) = Qnil;
+         WSET (w, next, Qnil);
 
          if (!NILP (p->parent))
-           WVAR (w, parent) = SAVED_WINDOW_N (saved_windows,
-                                              XFASTINT (p->parent))->window;
+           WSET (w, parent, SAVED_WINDOW_N (saved_windows,
+                                            XFASTINT (p->parent))->window);
          else
-           WVAR (w, parent) = Qnil;
+           WSET (w, parent, Qnil);
 
          if (!NILP (p->prev))
            {
-             WVAR (w, prev) = SAVED_WINDOW_N (saved_windows,
-                                              XFASTINT (p->prev))->window;
-             WVAR (XWINDOW (WVAR (w, prev)), next) = p->window;
+             WSET (w, prev, SAVED_WINDOW_N (saved_windows,
+                                            XFASTINT (p->prev))->window);
+             WSET (XWINDOW (WGET (w, prev)), next, p->window);
            }
          else
            {
-             WVAR (w, prev) = Qnil;
-             if (!NILP (WVAR (w, parent)))
+             WSET (w, prev, Qnil);
+             if (!NILP (WGET (w, parent)))
                {
-                 if (EQ (p->total_cols, WVAR (XWINDOW (WVAR (w, parent)), total_cols)))
+                 if (EQ (p->total_cols, WGET (XWINDOW (WGET (w, parent)), total_cols)))
                    {
-                     WVAR (XWINDOW (WVAR (w, parent)), vchild) = p->window;
-                     WVAR (XWINDOW (WVAR (w, parent)), hchild) = Qnil;
+                     WSET (XWINDOW (WGET (w, parent)), vchild, p->window);
+                     WSET (XWINDOW (WGET (w, parent)), hchild, Qnil);
                    }
                  else
                    {
-                     WVAR (XWINDOW (WVAR (w, parent)), hchild) = p->window;
-                     WVAR (XWINDOW (WVAR (w, parent)), vchild) = Qnil;
+                     WSET (XWINDOW (WGET (w, parent)), hchild, p->window);
+                     WSET (XWINDOW (WGET (w, parent)), vchild, Qnil);
                    }
                }
            }
 
          /* If we squirreled away the buffer in the window's height,
             restore it now.  */
-         if (BUFFERP (WVAR (w, total_lines)))
-           WVAR (w, buffer) = WVAR (w, total_lines);
-         WVAR (w, left_col) = p->left_col;
-         WVAR (w, top_line) = p->top_line;
-         WVAR (w, total_cols) = p->total_cols;
-         WVAR (w, total_lines) = p->total_lines;
-         WVAR (w, normal_cols) = p->normal_cols;
-         WVAR (w, normal_lines) = p->normal_lines;
+         if (BUFFERP (WGET (w, total_lines)))
+           WSET (w, buffer, WGET (w, total_lines));
+         WSET (w, left_col, p->left_col);
+         WSET (w, top_line, p->top_line);
+         WSET (w, total_cols, p->total_cols);
+         WSET (w, total_lines, p->total_lines);
+         WSET (w, normal_cols, p->normal_cols);
+         WSET (w, normal_lines, p->normal_lines);
          w->hscroll = XFASTINT (p->hscroll);
          w->min_hscroll = XFASTINT (p->min_hscroll);
-         WVAR (w, display_table) = p->display_table;
-         WVAR (w, left_margin_cols) = p->left_margin_cols;
-         WVAR (w, right_margin_cols) = p->right_margin_cols;
-         WVAR (w, left_fringe_width) = p->left_fringe_width;
-         WVAR (w, right_fringe_width) = p->right_fringe_width;
+         WSET (w, display_table, p->display_table);
+         WSET (w, left_margin_cols, p->left_margin_cols);
+         WSET (w, right_margin_cols, p->right_margin_cols);
+         WSET (w, left_fringe_width, p->left_fringe_width);
+         WSET (w, right_fringe_width, p->right_fringe_width);
          w->fringes_outside_margins = !NILP (p->fringes_outside_margins);
-         WVAR (w, scroll_bar_width) = p->scroll_bar_width;
-         WVAR (w, vertical_scroll_bar_type) = p->vertical_scroll_bar_type;
-         WVAR (w, dedicated) = p->dedicated;
-         WVAR (w, combination_limit) = p->combination_limit;
+         WSET (w, scroll_bar_width, p->scroll_bar_width);
+         WSET (w, vertical_scroll_bar_type, p->vertical_scroll_bar_type);
+         WSET (w, dedicated, p->dedicated);
+         WSET (w, combination_limit, p->combination_limit);
          /* Restore any window parameters that have been saved.
             Parameters that have not been saved are left alone.  */
          for (tem = p->window_parameters; CONSP (tem); tem = XCDR (tem))
@@ -5572,7 +5566,7 @@ the return value is nil.  Otherwise the value is t.  */)
                {
                  if (NILP (XCDR (pers)))
                    {
-                     par = Fassq (XCAR (pers), WVAR (w, window_parameters));
+                     par = Fassq (XCAR (pers), WGET (w, window_parameters));
                      if (CONSP (par) && !NILP (XCDR (par)))
                        /* Reset a parameter to nil if and only if it
                           has a non-nil association.  Don't make new
@@ -5591,50 +5585,50 @@ the return value is nil.  Otherwise the value is t.  */)
          /* Reinstall the saved buffer and pointers into it.  */
          if (NILP (p->buffer))
            /* An internal window.  */
-           WVAR (w, buffer) = p->buffer;
+           WSET (w, buffer, p->buffer);
          else if (!NILP (BVAR (XBUFFER (p->buffer), name)))
            /* If saved buffer is alive, install it.  */
            {
-             WVAR (w, buffer) = p->buffer;
-             w->start_at_line_beg = !NILP (p->start_at_line_beg);
-             set_marker_restricted (WVAR (w, start), p->start, WVAR (w, buffer));
-             set_marker_restricted (WVAR (w, pointm), p->pointm,
-                                    WVAR (w, buffer));
-             Fset_marker (BVAR (XBUFFER (WVAR (w, buffer)), mark),
-                          p->mark, WVAR (w, buffer));
-
-             /* As documented in Fcurrent_window_configuration, don't
-                restore the location of point in the buffer which was
-                current when the window configuration was recorded.  */
-             if (!EQ (p->buffer, new_current_buffer)
-                 && XBUFFER (p->buffer) == current_buffer)
-               Fgoto_char (WVAR (w, pointm));
-           }
-         else if (!NILP (WVAR (w, buffer))
-                  && !NILP (BVAR (XBUFFER (WVAR (w, buffer)), name)))
-           /* Keep window's old buffer; make sure the markers are
-              real.  */
-           {
-             /* Set window markers at start of visible range.  */
-             if (XMARKER (WVAR (w, start))->buffer == 0)
-               set_marker_restricted (WVAR (w, start), make_number (0),
-                                      WVAR (w, buffer));
-             if (XMARKER (WVAR (w, pointm))->buffer == 0)
-               set_marker_restricted_both 
-                 (WVAR (w, pointm), WVAR (w, buffer),
-                  BUF_PT (XBUFFER (WVAR (w, buffer))),
-                  BUF_PT_BYTE (XBUFFER (WVAR (w, buffer))));
-             w->start_at_line_beg = 1;
-           }
-         else if (STRINGP (auto_buffer_name =
-                           Fwindow_parameter (window, Qauto_buffer_name))
-                  && SCHARS (auto_buffer_name) != 0
-                  && !NILP (WVAR (w, buffer) = Fget_buffer_create (auto_buffer_name)))
+             WSET (w, buffer, p->buffer);
+              w->start_at_line_beg = !NILP (p->start_at_line_beg);
+              set_marker_restricted (WGET (w, start), p->start, WGET (w, buffer));
+              set_marker_restricted (WGET (w, pointm), p->pointm,
+                                     WGET (w, buffer));
+              Fset_marker (BVAR (XBUFFER (WGET (w, buffer)), mark),
+                           p->mark, WGET (w, buffer));
+
+              /* As documented in Fcurrent_window_configuration, don't
+                 restore the location of point in the buffer which was
+                 current when the window configuration was recorded.  */
+              if (!EQ (p->buffer, new_current_buffer)
+                  && XBUFFER (p->buffer) == current_buffer)
+                Fgoto_char (WGET (w, pointm));
+            }
+          else if (!NILP (WGET (w, buffer))
+                   && !NILP (BVAR (XBUFFER (WGET (w, buffer)), name)))
+            /* Keep window's old buffer; make sure the markers are
+               real.  */
+            {
+              /* Set window markers at start of visible range.  */
+              if (XMARKER (WGET (w, start))->buffer == 0)
+                set_marker_restricted (WGET (w, start), make_number (0),
+                                       WGET (w, buffer));
+              if (XMARKER (WGET (w, pointm))->buffer == 0)
+                set_marker_restricted_both 
+                  (WGET (w, pointm), WGET (w, buffer),
+                   BUF_PT (XBUFFER (WGET (w, buffer))),
+                   BUF_PT_BYTE (XBUFFER (WGET (w, buffer))));
+              w->start_at_line_beg = 1;
+            }
+          else if (STRINGP (auto_buffer_name =
+                            Fwindow_parameter (window, Qauto_buffer_name))
+                   && SCHARS (auto_buffer_name) != 0
+                   && !NILP (WSET (w, buffer, Fget_buffer_create (auto_buffer_name))))
            {
-             set_marker_restricted (WVAR (w, start),
-                                    make_number (0), WVAR (w, buffer));
-             set_marker_restricted (WVAR (w, pointm),
-                                    make_number (0), WVAR (w, buffer));
+             set_marker_restricted (WGET (w, start),
+                                    make_number (0), WGET (w, buffer));
+             set_marker_restricted (WGET (w, pointm),
+                                    make_number (0), WGET (w, buffer));
              w->start_at_line_beg = 1;
            }
          else
@@ -5644,36 +5638,36 @@ the return value is nil.  Otherwise the value is t.  */)
              avoid showing an unimportant buffer and, if necessary, to
              recreate *scratch* in the course (part of Juanma's bs-show
              scenario from March 2011).  */
-             WVAR (w, buffer) = other_buffer_safely (Fcurrent_buffer ());
+             WSET (w, buffer, other_buffer_safely (Fcurrent_buffer ()));
              /* This will set the markers to beginning of visible
                 range.  */
-             set_marker_restricted (WVAR (w, start),
-                                    make_number (0), WVAR (w, buffer));
-             set_marker_restricted (WVAR (w, pointm),
-                                    make_number (0), WVAR (w, buffer));
+             set_marker_restricted (WGET (w, start),
+                                    make_number (0), WGET (w, buffer));
+             set_marker_restricted (WGET (w, pointm),
+                                    make_number (0), WGET (w, buffer));
              w->start_at_line_beg = 1;
-             if (!NILP (WVAR (w, dedicated)))
+             if (!NILP (WGET (w, dedicated)))
                /* Record this window as dead.  */
                dead_windows = Fcons (window, dead_windows);
              /* Make sure window is no more dedicated.  */
-             WVAR (w, dedicated) = Qnil;
+             WSET (w, dedicated, Qnil);
            }
        }
 
       FSET (f, root_window, data->root_window);
       /* Arrange *not* to restore point in the buffer that was
         current when the window configuration was saved.  */
-      if (EQ (WVAR (XWINDOW (data->current_window), buffer), new_current_buffer))
-       set_marker_restricted (WVAR (XWINDOW (data->current_window), pointm),
+      if (EQ (WGET (XWINDOW (data->current_window), buffer), new_current_buffer))
+       set_marker_restricted (WGET (XWINDOW (data->current_window), pointm),
                               make_number (old_point),
-                              WVAR (XWINDOW (data->current_window), buffer));
+                              WGET (XWINDOW (data->current_window), buffer));
 
       /* In the following call to `select-window', prevent "swapping out
         point" in the old selected window using the buffer that has
         been restored into it.  We already swapped out that point from
         that window's old buffer.  */
       select_window (data->current_window, Qnil, 1);
-      BVAR (XBUFFER (WVAR (XWINDOW (selected_window), buffer)), last_selected_window)
+      BVAR (XBUFFER (WGET (XWINDOW (selected_window), buffer)), last_selected_window)
        = selected_window;
 
       if (NILP (data->focus_frame)
@@ -5700,14 +5694,14 @@ the return value is nil.  Otherwise the value is t.  */)
       /* Now, free glyph matrices in windows that were not reused.  */
       for (i = n = 0; i < n_leaf_windows; ++i)
        {
-         if (NILP (WVAR (leaf_windows[i], buffer)))
+         if (NILP (WGET (leaf_windows[i], buffer)))
            {
              /* Assert it's not reused as a combination.  */
-             eassert (NILP (WVAR (leaf_windows[i], hchild))
-                      && NILP (WVAR (leaf_windows[i], vchild)));
+             eassert (NILP (WGET (leaf_windows[i], hchild))
+                      && NILP (WGET (leaf_windows[i], vchild)));
              free_window_matrices (leaf_windows[i]);
            }
-         else if (EQ (WVAR (leaf_windows[i], buffer), new_current_buffer))
+         else if (EQ (WGET (leaf_windows[i], buffer), new_current_buffer))
            ++n;
        }
 
@@ -5752,28 +5746,28 @@ delete_all_child_windows (Lisp_Object window)
 
   w = XWINDOW (window);
 
-  if (!NILP (WVAR (w, next)))
+  if (!NILP (WGET (w, next)))
     /* Delete WINDOW's siblings (we traverse postorderly).  */
-    delete_all_child_windows (WVAR (w, next));
+    delete_all_child_windows (WGET (w, next));
 
-  WVAR (w, total_lines) = WVAR (w, buffer);       /* See Fset_window_configuration for excuse.  */
+  WSET (w, total_lines, WGET (w, buffer));       /* See Fset_window_configuration for excuse.  */
 
-  if (!NILP (WVAR (w, vchild)))
+  if (!NILP (WGET (w, vchild)))
     {
-      delete_all_child_windows (WVAR (w, vchild));
-      WVAR (w, vchild) = Qnil;
+      delete_all_child_windows (WGET (w, vchild));
+      WSET (w, vchild, Qnil);
     }
-  else if (!NILP (WVAR (w, hchild)))
+  else if (!NILP (WGET (w, hchild)))
     {
-      delete_all_child_windows (WVAR (w, hchild));
-      WVAR (w, hchild) = Qnil;
+      delete_all_child_windows (WGET (w, hchild));
+      WSET (w, hchild, Qnil);
     }
-  else if (!NILP (WVAR (w, buffer)))
+  else if (!NILP (WGET (w, buffer)))
     {
       unshow_buffer (w);
-      unchain_marker (XMARKER (WVAR (w, pointm)));
-      unchain_marker (XMARKER (WVAR (w, start)));
-      WVAR (w, buffer) = Qnil;
+      unchain_marker (XMARKER (WGET (w, pointm)));
+      unchain_marker (XMARKER (WGET (w, start)));
+      WSET (w, buffer, Qnil);
     }
 
   Vwindow_list = Qnil;
@@ -5783,12 +5777,12 @@ static int
 count_windows (register struct window *window)
 {
   register int count = 1;
-  if (!NILP (WVAR (window, next)))
-    count += count_windows (XWINDOW (WVAR (window, next)));
-  if (!NILP (WVAR (window, vchild)))
-    count += count_windows (XWINDOW (WVAR (window, vchild)));
-  if (!NILP (WVAR (window, hchild)))
-    count += count_windows (XWINDOW (WVAR (window, hchild)));
+  if (!NILP (WGET (window, next)))
+    count += count_windows (XWINDOW (WGET (window, next)));
+  if (!NILP (WGET (window, vchild)))
+    count += count_windows (XWINDOW (WGET (window, vchild)));
+  if (!NILP (WGET (window, hchild)))
+    count += count_windows (XWINDOW (WGET (window, hchild)));
   return count;
 }
 
@@ -5800,14 +5794,14 @@ get_leaf_windows (struct window *w, struct window **flat, int i)
 {
   while (w)
     {
-      if (!NILP (WVAR (w, hchild)))
-       i = get_leaf_windows (XWINDOW (WVAR (w, hchild)), flat, i);
-      else if (!NILP (WVAR (w, vchild)))
-       i = get_leaf_windows (XWINDOW (WVAR (w, vchild)), flat, i);
+      if (!NILP (WGET (w, hchild)))
+       i = get_leaf_windows (XWINDOW (WGET (w, hchild)), flat, i);
+      else if (!NILP (WGET (w, vchild)))
+       i = get_leaf_windows (XWINDOW (WGET (w, vchild)), flat, i);
       else
        flat[i++] = w;
 
-      w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next));
+      w = NILP (WGET (w, next)) ? 0 : XWINDOW (WGET (w, next));
     }
 
   return i;
@@ -5860,32 +5854,32 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
   register struct window *w;
   register Lisp_Object tem, pers, par;
 
-  for (;!NILP (window); window = WVAR (w, next))
+  for (;!NILP (window); window = WGET (w, next))
     {
       p = SAVED_WINDOW_N (vector, i);
       w = XWINDOW (window);
 
-      XSETFASTINT (WVAR (w, temslot), i); i++;
+      WSET (w, temslot, make_number (i)); i++;
       p->window = window;
-      p->buffer = WVAR (w, buffer);
-      p->left_col = WVAR (w, left_col);
-      p->top_line = WVAR (w, top_line);
-      p->total_cols = WVAR (w, total_cols);
-      p->total_lines = WVAR (w, total_lines);
-      p->normal_cols = WVAR (w, normal_cols);
-      p->normal_lines = WVAR (w, normal_lines);
+      p->buffer = WGET (w, buffer);
+      p->left_col = WGET (w, left_col);
+      p->top_line = WGET (w, top_line);
+      p->total_cols = WGET (w, total_cols);
+      p->total_lines = WGET (w, total_lines);
+      p->normal_cols = WGET (w, normal_cols);
+      p->normal_lines = WGET (w, normal_lines);
       XSETFASTINT (p->hscroll, w->hscroll);
       XSETFASTINT (p->min_hscroll, w->min_hscroll);
-      p->display_table = WVAR (w, display_table);
-      p->left_margin_cols = WVAR (w, left_margin_cols);
-      p->right_margin_cols = WVAR (w, right_margin_cols);
-      p->left_fringe_width = WVAR (w, left_fringe_width);
-      p->right_fringe_width = WVAR (w, right_fringe_width);
+      p->display_table = WGET (w, display_table);
+      p->left_margin_cols = WGET (w, left_margin_cols);
+      p->right_margin_cols = WGET (w, right_margin_cols);
+      p->left_fringe_width = WGET (w, left_fringe_width);
+      p->right_fringe_width = WGET (w, right_fringe_width);
       p->fringes_outside_margins = w->fringes_outside_margins ? Qt : Qnil;
-      p->scroll_bar_width = WVAR (w, scroll_bar_width);
-      p->vertical_scroll_bar_type = WVAR (w, vertical_scroll_bar_type);
-      p->dedicated = WVAR (w, dedicated);
-      p->combination_limit = WVAR (w, combination_limit);
+      p->scroll_bar_width = WGET (w, scroll_bar_width);
+      p->vertical_scroll_bar_type = WGET (w, vertical_scroll_bar_type);
+      p->dedicated = WGET (w, dedicated);
+      p->combination_limit = WGET (w, combination_limit);
       p->window_parameters = Qnil;
 
       if (!NILP (Vwindow_persistent_parameters))
@@ -5918,7 +5912,7 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
              /* Save values for persistent window parameters. */
              if (CONSP (pers) && !NILP (XCDR (pers)))
                {
-                 par = Fassq (XCAR (pers), WVAR (w, window_parameters));
+                 par = Fassq (XCAR (pers), WGET (w, window_parameters));
                  if (NILP (par))
                    /* If the window has no value for the parameter,
                       make one.  */
@@ -5934,24 +5928,24 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
            }
        }
 
-      if (!NILP (WVAR (w, buffer)))
+      if (!NILP (WGET (w, buffer)))
        {
          /* Save w's value of point in the window configuration.  If w
             is the selected window, then get the value of point from
             the buffer; pointm is garbage in the selected window.  */
          if (EQ (window, selected_window))
-           p->pointm = build_marker (XBUFFER (WVAR (w, buffer)),
-                                     BUF_PT (XBUFFER (WVAR (w, buffer))),
-                                     BUF_PT_BYTE (XBUFFER (WVAR (w, buffer))));
+           p->pointm = build_marker (XBUFFER (WGET (w, buffer)),
+                                     BUF_PT (XBUFFER (WGET (w, buffer))),
+                                     BUF_PT_BYTE (XBUFFER (WGET (w, buffer))));
          else
-           p->pointm = Fcopy_marker (WVAR (w, pointm), Qnil);
+           p->pointm = Fcopy_marker (WGET (w, pointm), Qnil);
          XMARKER (p->pointm)->insertion_type
            = !NILP (Vwindow_point_insertion_type);
 
-         p->start = Fcopy_marker (WVAR (w, start), Qnil);
+         p->start = Fcopy_marker (WGET (w, start), Qnil);
          p->start_at_line_beg = w->start_at_line_beg ? Qt : Qnil;
 
-         tem = BVAR (XBUFFER (WVAR (w, buffer)), mark);
+         tem = BVAR (XBUFFER (WGET (w, buffer)), mark);
          p->mark = Fcopy_marker (tem, Qnil);
        }
       else
@@ -5962,20 +5956,20 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
          p->start_at_line_beg = Qnil;
        }
 
-      if (NILP (WVAR (w, parent)))
+      if (NILP (WGET (w, parent)))
        p->parent = Qnil;
       else
-       p->parent = WVAR (XWINDOW (WVAR (w, parent)), temslot);
+       p->parent = WGET (XWINDOW (WGET (w, parent)), temslot);
 
-      if (NILP (WVAR (w, prev)))
+      if (NILP (WGET (w, prev)))
        p->prev = Qnil;
       else
-       p->prev = WVAR (XWINDOW (WVAR (w, prev)), temslot);
+       p->prev = WGET (XWINDOW (WGET (w, prev)), temslot);
 
-      if (!NILP (WVAR (w, vchild)))
-       i = save_window_save (WVAR (w, vchild), vector, i);
-      if (!NILP (WVAR (w, hchild)))
-       i = save_window_save (WVAR (w, hchild), vector, i);
+      if (!NILP (WGET (w, vchild)))
+       i = save_window_save (WGET (w, vchild), vector, i);
+      if (!NILP (WGET (w, hchild)))
+       i = save_window_save (WGET (w, hchild), vector, i);
     }
 
   return i;
@@ -6064,11 +6058,11 @@ means no margin.  */)
        right_width = Qnil;
     }
 
-  if (!EQ (WVAR (w, left_margin_cols), left_width)
-      || !EQ (WVAR (w, right_margin_cols), right_width))
+  if (!EQ (WGET (w, left_margin_cols), left_width)
+      || !EQ (WGET (w, right_margin_cols), right_width))
     {
-      WVAR (w, left_margin_cols) = left_width;
-      WVAR (w, right_margin_cols) = right_width;
+      WSET (w, left_margin_cols, left_width);
+      WSET (w, right_margin_cols, right_width);
 
       adjust_window_margins (w);
 
@@ -6090,7 +6084,7 @@ as nil.  */)
   (Lisp_Object window)
 {
   struct window *w = decode_window (window);
-  return Fcons (WVAR (w, left_margin_cols), WVAR (w, right_margin_cols));
+  return Fcons (WGET (w, left_margin_cols), WGET (w, right_margin_cols));
 }
 
 
@@ -6124,18 +6118,18 @@ display marginal areas and the text area.  */)
 
   /* Do nothing on a tty.  */
   if (FRAME_WINDOW_P (WINDOW_XFRAME (w))
-      && (!EQ (WVAR (w, left_fringe_width), left_width)
-         || !EQ (WVAR (w, right_fringe_width), right_width)
+      && (!EQ (WGET (w, left_fringe_width), left_width)
+         || !EQ (WGET (w, right_fringe_width), right_width)
          || w->fringes_outside_margins != outside))
     {
-      WVAR (w, left_fringe_width) = left_width;
-      WVAR (w, right_fringe_width) = right_width;
+      WSET (w, left_fringe_width, left_width);
+      WSET (w, right_fringe_width, right_width);
       w->fringes_outside_margins = outside;
 
       adjust_window_margins (w);
 
       clear_glyph_matrix (w->current_matrix);
-      WVAR (w, window_end_valid) = Qnil;
+      WSET (w, window_end_valid, Qnil);
 
       ++windows_or_buffers_changed;
       adjust_glyphs (XFRAME (WINDOW_FRAME (w)));
@@ -6195,16 +6189,16 @@ Fourth parameter HORIZONTAL-TYPE is currently unused.  */)
        || EQ (vertical_type, Qt)))
     error ("Invalid type of vertical scroll bar");
 
-  if (!EQ (WVAR (w, scroll_bar_width), width)
-      || !EQ (WVAR (w, vertical_scroll_bar_type), vertical_type))
+  if (!EQ (WGET (w, scroll_bar_width), width)
+      || !EQ (WGET (w, vertical_scroll_bar_type), vertical_type))
     {
-      WVAR (w, scroll_bar_width) = width;
-      WVAR (w, vertical_scroll_bar_type) = vertical_type;
+      WSET (w, scroll_bar_width, width);
+      WSET (w, vertical_scroll_bar_type, vertical_type);
 
       adjust_window_margins (w);
 
       clear_glyph_matrix (w->current_matrix);
-      WVAR (w, window_end_valid) = Qnil;
+      WSET (w, window_end_valid, Qnil);
 
       ++windows_or_buffers_changed;
       adjust_glyphs (XFRAME (WINDOW_FRAME (w)));
@@ -6228,7 +6222,7 @@ value.  */)
                              ? WINDOW_CONFIG_SCROLL_BAR_WIDTH (w)
                              : WINDOW_SCROLL_BAR_AREA_WIDTH (w))),
                Fcons (make_number (WINDOW_SCROLL_BAR_COLS (w)),
-                      Fcons (WVAR (w, vertical_scroll_bar_type),
+                      Fcons (WGET (w, vertical_scroll_bar_type),
                              Fcons (Qnil, Qnil))));
 }
 
@@ -6254,7 +6248,7 @@ optional second arg PIXELS-P means value is measured in pixels.  */)
   else
     CHECK_WINDOW (window);
   w = XWINDOW (window);
-  f = XFRAME (WVAR (w, frame));
+  f = XFRAME (WGET (w, frame));
 
   if (FRAME_WINDOW_P (f))
     result = (NILP (pixels_p)
@@ -6288,7 +6282,7 @@ If PIXELS-P is non-nil, the return value is VSCROLL.  */)
   CHECK_NUMBER_OR_FLOAT (vscroll);
 
   w = XWINDOW (window);
-  f = XFRAME (WVAR (w, frame));
+  f = XFRAME (WGET (w, frame));
 
   if (FRAME_WINDOW_P (f))
     {
@@ -6307,7 +6301,7 @@ If PIXELS-P is non-nil, the return value is VSCROLL.  */)
            adjust_glyphs (f);
 
          /* Prevent redisplay shortcuts.  */
-         XBUFFER (WVAR (w, buffer))->prevent_redisplay_optimizations_p = 1;
+         XBUFFER (WGET (w, buffer))->prevent_redisplay_optimizations_p = 1;
        }
     }
 
@@ -6341,14 +6335,14 @@ foreach_window_1 (struct window *w, int (*fn) (struct window *, void *), void *u
 
   for (cont = 1; w && cont;)
     {
-      if (!NILP (WVAR (w, hchild)))
-       cont = foreach_window_1 (XWINDOW (WVAR (w, hchild)), fn, user_data);
-      else if (!NILP (WVAR (w, vchild)))
-       cont = foreach_window_1 (XWINDOW (WVAR (w, vchild)), fn, user_data);
+      if (!NILP (WGET (w, hchild)))
+       cont = foreach_window_1 (XWINDOW (WGET (w, hchild)), fn, user_data);
+      else if (!NILP (WGET (w, vchild)))
+       cont = foreach_window_1 (XWINDOW (WGET (w, vchild)), fn, user_data);
       else
        cont = fn (w, user_data);
 
-      w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next));
+      w = NILP (WGET (w, next)) ? 0 : XWINDOW (WGET (w, next));
     }
 
   return cont;
index da42250..b6a37e2 100644 (file)
@@ -86,9 +86,15 @@ struct cursor_pos
   int hpos, vpos;
 };
 
-/* Most code should use this macro to access Lisp fields in struct window.  */
+/* Most code should use these macros to access Lisp fields
+   in struct window.  WGET should not be used as lvalue.  */
 
-#define WVAR(w, field) ((w)->INTERNAL_FIELD (field))
+#define WGET(f, field)                                         \
+  (eassert (offsetof (struct window, field ## _)               \
+           < offsetof (struct window, current_matrix)),        \
+   ((f)->INTERNAL_FIELD (field)))
+
+#define WSET(w, field, value) ((w)->INTERNAL_FIELD (field) = (value))
 
 struct window
   {
@@ -396,13 +402,13 @@ struct window
    This includes scroll bars and fringes.  */
 
 #define WINDOW_TOTAL_COLS(W) \
-  (XFASTINT (WVAR (W, total_cols)))
+  (XFASTINT (WGET (W, total_cols)))
 
 /* Return the height of window W in canonical line units.
    This includes header and mode lines, if any.  */
 
 #define WINDOW_TOTAL_LINES(W) \
-  (XFASTINT (WVAR (W, total_lines)))
+  (XFASTINT (WGET (W, total_lines)))
 
 /* Return the total pixel width of window W.  */
 
@@ -430,7 +436,7 @@ struct window
    This includes a left-hand scroll bar, if any.  */
 
 #define WINDOW_LEFT_EDGE_COL(W) \
-  (XFASTINT (WVAR (W, left_col)))
+  (XFASTINT (WGET (W, left_col)))
 
 /* Return the canonical frame column before which window W ends.
    This includes a right-hand scroll bar, if any.  */
@@ -442,7 +448,7 @@ struct window
    This includes a header line, if any.  */
 
 #define WINDOW_TOP_EDGE_LINE(W) \
-  (XFASTINT (WVAR (W, top_line)))
+  (XFASTINT (WGET (W, top_line)))
 
 /* Return the canonical frame line before which window W ends.
    This includes a mode line, if any.  */
@@ -547,31 +553,31 @@ struct window
 /* Width of left margin area in columns.  */
 
 #define WINDOW_LEFT_MARGIN_COLS(W)                     \
-  (NILP (WVAR (W, left_margin_cols))                   \
+  (NILP (WGET (W, left_margin_cols))                   \
    ? 0                                                 \
-   : XINT (WVAR (W, left_margin_cols)))
+   : XINT (WGET (W, left_margin_cols)))
 
 /* Width of right marginal area in columns.  */
 
 #define WINDOW_RIGHT_MARGIN_COLS(W)                    \
-  (NILP (WVAR (W, right_margin_cols))                  \
+  (NILP (WGET (W, right_margin_cols))                  \
    ? 0                                                 \
-   : XINT (WVAR (W, right_margin_cols)))
+   : XINT (WGET (W, right_margin_cols)))
 
 /* Width of left margin area in pixels.  */
 
 #define WINDOW_LEFT_MARGIN_WIDTH(W)                    \
-  (NILP (WVAR (W, left_margin_cols))                   \
+  (NILP (WGET (W, left_margin_cols))                   \
    ? 0                                                 \
-   : (XINT (WVAR (W, left_margin_cols))                        \
+   : (XINT (WGET (W, left_margin_cols))                        \
       * WINDOW_FRAME_COLUMN_WIDTH (W)))
 
 /* Width of right marginal area in pixels.  */
 
 #define WINDOW_RIGHT_MARGIN_WIDTH(W)                   \
-  (NILP (WVAR (W, right_margin_cols))                  \
+  (NILP (WGET (W, right_margin_cols))                  \
    ? 0                                                 \
-   : (XINT (WVAR (W, right_margin_cols))               \
+   : (XINT (WGET (W, right_margin_cols))               \
       * WINDOW_FRAME_COLUMN_WIDTH (W)))
 
 /* Total width of fringes reserved for drawing truncation bitmaps,
@@ -581,8 +587,8 @@ struct window
    able to split windows horizontally nicely.  */
 
 #define WINDOW_FRINGE_COLS(W)                          \
-  ((INTEGERP (WVAR (W, left_fringe_width))             \
-    || INTEGERP (WVAR (W, right_fringe_width)))                \
+  ((INTEGERP (WGET (W, left_fringe_width))             \
+    || INTEGERP (WGET (W, right_fringe_width)))                \
    ? ((WINDOW_LEFT_FRINGE_WIDTH (W)                    \
        + WINDOW_RIGHT_FRINGE_WIDTH (W)                 \
        + WINDOW_FRAME_COLUMN_WIDTH (W) - 1)            \
@@ -604,13 +610,13 @@ struct window
 /* Pixel-width of the left and right fringe.  */
 
 #define WINDOW_LEFT_FRINGE_WIDTH(W)                    \
-  (INTEGERP (WVAR (W, left_fringe_width))              \
-   ? XFASTINT (WVAR (W, left_fringe_width))            \
+  (INTEGERP (WGET (W, left_fringe_width))              \
+   ? XFASTINT (WGET (W, left_fringe_width))            \
    : FRAME_LEFT_FRINGE_WIDTH (WINDOW_XFRAME (W)))
 
 #define WINDOW_RIGHT_FRINGE_WIDTH(W)                   \
-  (INTEGERP (WVAR (W, right_fringe_width))             \
-   ? XFASTINT (WVAR (W, right_fringe_width))           \
+  (INTEGERP (WGET (W, right_fringe_width))             \
+   ? XFASTINT (WGET (W, right_fringe_width))           \
    : FRAME_RIGHT_FRINGE_WIDTH (WINDOW_XFRAME (W)))
 
 /* Total width of fringes in pixels.  */
@@ -627,36 +633,36 @@ struct window
    and which side they are on.  */
 
 #define WINDOW_VERTICAL_SCROLL_BAR_TYPE(w)             \
-  (EQ (WVAR (w, vertical_scroll_bar_type), Qt)         \
+  (EQ (WGET (w, vertical_scroll_bar_type), Qt)         \
    ? FRAME_VERTICAL_SCROLL_BAR_TYPE (WINDOW_XFRAME (w))        \
-   : EQ (WVAR (w, vertical_scroll_bar_type), Qleft)    \
+   : EQ (WGET (w, vertical_scroll_bar_type), Qleft)    \
    ? vertical_scroll_bar_left                          \
-   : EQ (WVAR (w, vertical_scroll_bar_type), Qright)   \
+   : EQ (WGET (w, vertical_scroll_bar_type), Qright)   \
    ? vertical_scroll_bar_right                         \
    : vertical_scroll_bar_none)                         \
 
 #define WINDOW_HAS_VERTICAL_SCROLL_BAR(w)              \
-  (EQ (WVAR (w, vertical_scroll_bar_type), Qt)         \
+  (EQ (WGET (w, vertical_scroll_bar_type), Qt)         \
    ? FRAME_HAS_VERTICAL_SCROLL_BARS (WINDOW_XFRAME (w))        \
-   : !NILP (WVAR (w, vertical_scroll_bar_type)))
+   : !NILP (WGET (w, vertical_scroll_bar_type)))
 
 #define WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT(w)              \
-  (EQ (WVAR (w, vertical_scroll_bar_type), Qt)                 \
+  (EQ (WGET (w, vertical_scroll_bar_type), Qt)                 \
    ? FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (WINDOW_XFRAME (w))        \
-   : EQ (WVAR (w, vertical_scroll_bar_type), Qleft))
+   : EQ (WGET (w, vertical_scroll_bar_type), Qleft))
 
 #define WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT(w)             \
-  (EQ (WVAR (w, vertical_scroll_bar_type), Qt)                 \
+  (EQ (WGET (w, vertical_scroll_bar_type), Qt)                 \
    ? FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (WINDOW_XFRAME (w))\
-   : EQ (WVAR (w, vertical_scroll_bar_type), Qright))
+   : EQ (WGET (w, vertical_scroll_bar_type), Qright))
 
 /* Width that a scroll bar in window W should have, if there is one.
    Measured in pixels.  If scroll bars are turned off, this is still
    nonzero.  */
 
 #define WINDOW_CONFIG_SCROLL_BAR_WIDTH(w)              \
-  (INTEGERP (WVAR (w, scroll_bar_width))               \
-   ? XFASTINT (WVAR (w, scroll_bar_width))             \
+  (INTEGERP (WGET (w, scroll_bar_width))               \
+   ? XFASTINT (WGET (w, scroll_bar_width))             \
    : FRAME_CONFIG_SCROLL_BAR_WIDTH (WINDOW_XFRAME (w)))
 
 /* Width that a scroll bar in window W should have, if there is one.
@@ -664,8 +670,8 @@ struct window
    this is still nonzero.  */
 
 #define WINDOW_CONFIG_SCROLL_BAR_COLS(w)               \
-  (INTEGERP (WVAR (w, scroll_bar_width))               \
-   ? ((XFASTINT (WVAR (w, scroll_bar_width))           \
+  (INTEGERP (WGET (w, scroll_bar_width))               \
+   ? ((XFASTINT (WGET (w, scroll_bar_width))           \
        + WINDOW_FRAME_COLUMN_WIDTH (w) - 1)            \
       / WINDOW_FRAME_COLUMN_WIDTH (w))                 \
    : FRAME_CONFIG_SCROLL_BAR_COLS (WINDOW_XFRAME (w)))
@@ -887,9 +893,8 @@ struct glyph *get_phys_cursor_glyph (struct window *w);
 
 /* Value is non-zero if WINDOW is a live window.  */
 
-#define WINDOW_LIVE_P(WINDOW) \
-  (WINDOWP ((WINDOW)) && !NILP (WVAR (XWINDOW ((WINDOW)), buffer)))
-
+#define WINDOW_LIVE_P(WINDOW)                                  \
+  (WINDOWP (WINDOW) && !NILP (WGET (XWINDOW (WINDOW), buffer)))
 
 /* These used to be in lisp.h.  */
 
index 314fb44..9906a70 100644 (file)
@@ -984,7 +984,7 @@ window_text_bottom_y (struct window *w)
 int
 window_box_width (struct window *w, int area)
 {
-  int cols = XFASTINT (WVAR (w, total_cols));
+  int cols = XFASTINT (WGET (w, total_cols));
   int pixels = 0;
 
   if (!w->pseudo_window_p)
@@ -993,22 +993,22 @@ window_box_width (struct window *w, int area)
 
       if (area == TEXT_AREA)
        {
-         if (INTEGERP (WVAR (w, left_margin_cols)))
-           cols -= XFASTINT (WVAR (w, left_margin_cols));
-         if (INTEGERP (WVAR (w, right_margin_cols)))
-           cols -= XFASTINT (WVAR (w, right_margin_cols));
+         if (INTEGERP (WGET (w, left_margin_cols)))
+           cols -= XFASTINT (WGET (w, left_margin_cols));
+         if (INTEGERP (WGET (w, right_margin_cols)))
+           cols -= XFASTINT (WGET (w, right_margin_cols));
          pixels = -WINDOW_TOTAL_FRINGE_WIDTH (w);
        }
       else if (area == LEFT_MARGIN_AREA)
        {
-         cols = (INTEGERP (WVAR (w, left_margin_cols))
-                  ? XFASTINT (WVAR (w, left_margin_cols)) : 0);
+         cols = (INTEGERP (WGET (w, left_margin_cols))
+                  ? XFASTINT (WGET (w, left_margin_cols)) : 0);
          pixels = 0;
        }
       else if (area == RIGHT_MARGIN_AREA)
        {
-         cols = (INTEGERP (WVAR (w, right_margin_cols))
-                  ? XFASTINT (WVAR (w, right_margin_cols)) : 0);
+         cols = (INTEGERP (WGET (w, right_margin_cols))
+                  ? XFASTINT (WGET (w, right_margin_cols)) : 0);
          pixels = 0;
        }
     }
@@ -1023,7 +1023,7 @@ window_box_width (struct window *w, int area)
 int
 window_box_height (struct window *w)
 {
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
   int height = WINDOW_TOTAL_HEIGHT (w);
 
   eassert (height >= 0);
@@ -1112,7 +1112,7 @@ window_box_right_offset (struct window *w, int area)
 int
 window_box_left (struct window *w, int area)
 {
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
   int x;
 
   if (w->pseudo_window_p)
@@ -1288,13 +1288,13 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
   if (FRAME_INITIAL_P (XFRAME (WINDOW_FRAME (w))))
     return visible_p;
 
-  if (XBUFFER (WVAR (w, buffer)) != current_buffer)
+  if (XBUFFER (WGET (w, buffer)) != current_buffer)
     {
       old_buffer = current_buffer;
-      set_buffer_internal_1 (XBUFFER (WVAR (w, buffer)));
+      set_buffer_internal_1 (XBUFFER (WGET (w, buffer)));
     }
 
-  SET_TEXT_POS_FROM_MARKER (top, WVAR (w, start));
+  SET_TEXT_POS_FROM_MARKER (top, WGET (w, start));
   /* Scrolling a minibuffer window via scroll bar when the echo area
      shows long text sometimes resets the minibuffer contents behind
      our backs.  */
@@ -1913,7 +1913,7 @@ frame_to_window_pixel_xy (struct window *w, int *x, int *y)
     {
       /* A pseudo-window is always full-width, and starts at the
         left edge of the frame, plus a frame border.  */
-      struct frame *f = XFRAME (WVAR (w, frame));
+      struct frame *f = XFRAME (WGET (w, frame));
       *x -= FRAME_INTERNAL_BORDER_WIDTH (f);
       *y = FRAME_TO_WINDOW_PIXEL_Y (w, *y);
     }
@@ -2522,11 +2522,11 @@ static void
 check_window_end (struct window *w)
 {
   if (!MINI_WINDOW_P (w)
-      && !NILP (WVAR (w, window_end_valid)))
+      && !NILP (WGET (w, window_end_valid)))
     {
       struct glyph_row *row;
       eassert ((row = MATRIX_ROW (w->current_matrix,
-                                 XFASTINT (WVAR (w, window_end_vpos))),
+                                 XFASTINT (WGET (w, window_end_vpos))),
                !row->enabled_p
                || MATRIX_ROW_DISPLAYS_TEXT_P (row)
                || MATRIX_ROW_VPOS (row, w->current_matrix) == 0));
@@ -2592,7 +2592,7 @@ init_iterator (struct it *it, struct window *w,
   /* Perhaps remap BASE_FACE_ID to a user-specified alternative.  */
   if (! NILP (Vface_remapping_alist))
     remapped_base_face_id
-      = lookup_basic_face (XFRAME (WVAR (w, frame)), base_face_id);
+      = lookup_basic_face (XFRAME (WGET (w, frame)), base_face_id);
 
   /* Use one of the mode line rows of W's desired matrix if
      appropriate.  */
@@ -2620,7 +2620,7 @@ init_iterator (struct it *it, struct window *w,
   /* The window in which we iterate over current_buffer:  */
   XSETWINDOW (it->window, w);
   it->w = w;
-  it->f = XFRAME (WVAR (w, frame));
+  it->f = XFRAME (WGET (w, frame));
 
   it->cmp_it.id = -1;
 
@@ -2704,13 +2704,13 @@ init_iterator (struct it *it, struct window *w,
 
   /* Get the position at which the redisplay_end_trigger hook should
      be run, if it is to be run at all.  */
-  if (MARKERP (WVAR (w, redisplay_end_trigger))
-      && XMARKER (WVAR (w, redisplay_end_trigger))->buffer != 0)
+  if (MARKERP (WGET (w, redisplay_end_trigger))
+      && XMARKER (WGET (w, redisplay_end_trigger))->buffer != 0)
     it->redisplay_end_trigger_charpos
-      = marker_position (WVAR (w, redisplay_end_trigger));
-  else if (INTEGERP (WVAR (w, redisplay_end_trigger)))
+      = marker_position (WGET (w, redisplay_end_trigger));
+  else if (INTEGERP (WGET (w, redisplay_end_trigger)))
     it->redisplay_end_trigger_charpos =
-      clip_to_bounds (PTRDIFF_MIN, XINT (WVAR (w, redisplay_end_trigger)), PTRDIFF_MAX);
+      clip_to_bounds (PTRDIFF_MIN, XINT (WGET (w, redisplay_end_trigger)), PTRDIFF_MAX);
 
   it->tab_width = SANE_TAB_WIDTH (current_buffer);
 
@@ -4408,7 +4408,7 @@ handle_display_prop (struct it *it)
      if it was a text property.  */
 
   if (!STRINGP (it->string))
-    object = WVAR (it->w, buffer);
+    object = WGET (it->w, buffer);
 
   display_replaced_p = handle_display_spec (it, propval, object, overlay,
                                            position, bufpos,
@@ -4816,7 +4816,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
          it->what = IT_IMAGE;
          it->image_id = -1; /* no image */
          it->position = start_pos;
-         it->object = NILP (object) ? WVAR (it->w, buffer) : object;
+         it->object = NILP (object) ? WGET (it->w, buffer) : object;
          it->method = GET_FROM_IMAGE;
          it->from_overlay = Qnil;
          it->face_id = face_id;
@@ -4962,7 +4962,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
          it->what = IT_IMAGE;
          it->image_id = lookup_image (it->f, value);
          it->position = start_pos;
-         it->object = NILP (object) ? WVAR (it->w, buffer) : object;
+         it->object = NILP (object) ? WGET (it->w, buffer) : object;
          it->method = GET_FROM_IMAGE;
 
          /* Say that we haven't consumed the characters with
@@ -5785,7 +5785,7 @@ pop_it (struct it *it)
       it->object = p->u.stretch.object;
       break;
     case GET_FROM_BUFFER:
-      it->object = WVAR (it->w, buffer);
+      it->object = WGET (it->w, buffer);
       break;
     case GET_FROM_STRING:
       it->object = it->string;
@@ -5798,7 +5798,7 @@ pop_it (struct it *it)
       else
        {
          it->method = GET_FROM_BUFFER;
-         it->object = WVAR (it->w, buffer);
+         it->object = WGET (it->w, buffer);
        }
     }
   it->end_charpos = p->end_charpos;
@@ -6236,7 +6236,7 @@ reseat_1 (struct it *it, struct text_pos pos, int set_stop_p)
   IT_STRING_BYTEPOS (*it) = -1;
   it->string = Qnil;
   it->method = GET_FROM_BUFFER;
-  it->object = WVAR (it->w, buffer);
+  it->object = WGET (it->w, buffer);
   it->area = TEXT_AREA;
   it->multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters));
   it->sp = 0;
@@ -7085,7 +7085,7 @@ set_iterator_to_next (struct it *it, int reseat_p)
          else
            {
              it->method = GET_FROM_BUFFER;
-             it->object = WVAR (it->w, buffer);
+             it->object = WGET (it->w, buffer);
            }
 
          it->dpvec = NULL;
@@ -7660,7 +7660,7 @@ next_element_from_ellipsis (struct it *it)
         setting face_before_selective_p.  */
       it->saved_face_id = it->face_id;
       it->method = GET_FROM_BUFFER;
-      it->object = WVAR (it->w, buffer);
+      it->object = WGET (it->w, buffer);
       reseat_at_next_visible_line_start (it, 1);
       it->face_before_selective_p = 1;
     }
@@ -7924,7 +7924,7 @@ next_element_from_buffer (struct it *it)
 
       /* Record what we have and where it came from.  */
       it->what = IT_CHARACTER;
-      it->object = WVAR (it->w, buffer);
+      it->object = WGET (it->w, buffer);
       it->position = it->current.pos;
 
       /* Normally we return the character found above, except when we
@@ -7981,7 +7981,7 @@ run_redisplay_end_trigger_hook (struct it *it)
 
   /* Since we are *trying* to run these functions, don't try to run
      them again, even if they get an error.  */
-  WVAR (it->w, redisplay_end_trigger) = Qnil;
+  WSET (it->w, redisplay_end_trigger, Qnil);
   Frun_hook_with_args (3, args);
 
   /* Notice if it changed the face of the character we are on.  */
@@ -8030,7 +8030,7 @@ next_element_from_composition (struct it *it)
          return 0;
        }
       it->position = it->current.pos;
-      it->object = WVAR (it->w, buffer);
+      it->object = WGET (it->w, buffer);
       it->c = composition_update_it (&it->cmp_it, IT_CHARPOS (*it),
                                     IT_BYTEPOS (*it), Qnil);
     }
@@ -8891,7 +8891,7 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int to_x, int to_y, int to_vpos
       && it->current_x == it->last_visible_x - 1
       && it->c != '\n'
       && it->c != '\t'
-      && it->vpos < XFASTINT (WVAR (it->w, window_end_vpos)))
+      && it->vpos < XFASTINT (WGET (it->w, window_end_vpos)))
     {
       it->continuation_lines_width += it->current_x;
       it->current_x = it->hpos = it->max_ascent = it->max_descent = 0;
@@ -9643,7 +9643,7 @@ message3_nolog (Lisp_Object m, ptrdiff_t nbytes, int multibyte)
       /* Get the frame containing the mini-buffer
         that the selected frame is using.  */
       mini_window = FRAME_MINIBUF_WINDOW (sf);
-      frame = WVAR (XWINDOW (mini_window), frame);
+      frame = WGET (XWINDOW (mini_window), frame);
       f = XFRAME (frame);
 
       FRAME_SAMPLE_VISIBILITY (f);
@@ -9969,8 +9969,8 @@ with_echo_area_buffer (struct window *w, int which,
   set_buffer_internal_1 (XBUFFER (buffer));
   if (w)
     {
-      WVAR (w, buffer) = buffer;
-      set_marker_both (WVAR (w, pointm), buffer, BEG, BEG_BYTE);
+      WSET (w, buffer, buffer);
+      set_marker_both (WGET (w, pointm), buffer, BEG, BEG_BYTE);
     }
 
   BVAR (current_buffer, undo_list) = Qt;
@@ -10018,9 +10018,9 @@ with_echo_area_buffer_unwind_data (struct window *w)
   if (w)
     {
       XSETWINDOW (tmp, w); ASET (vector, i, tmp); ++i;
-      ASET (vector, i, WVAR (w, buffer)); ++i;
-      ASET (vector, i, make_number (XMARKER (WVAR (w, pointm))->charpos)); ++i;
-      ASET (vector, i, make_number (XMARKER (WVAR (w, pointm))->bytepos)); ++i;
+      ASET (vector, i, WGET (w, buffer)); ++i;
+      ASET (vector, i, make_number (XMARKER (WGET (w, pointm))->charpos)); ++i;
+      ASET (vector, i, make_number (XMARKER (WGET (w, pointm))->bytepos)); ++i;
     }
   else
     {
@@ -10054,8 +10054,8 @@ unwind_with_echo_area_buffer (Lisp_Object vector)
       charpos = AREF (vector, 5);
       bytepos = AREF (vector, 6);
 
-      WVAR (w, buffer) = buffer;
-      set_marker_both (WVAR (w, pointm), buffer,
+      WSET (w, buffer, buffer);
+      set_marker_both (WGET (w, pointm), buffer,
                       XFASTINT (charpos), XFASTINT (bytepos));
     }
 
@@ -10194,7 +10194,7 @@ display_echo_area_1 (ptrdiff_t a1, Lisp_Object a2, ptrdiff_t a3, ptrdiff_t a4)
   window_height_changed_p = resize_mini_window (w, 0);
 
   /* Use the starting position chosen by resize_mini_window.  */
-  SET_TEXT_POS_FROM_MARKER (start, WVAR (w, start));
+  SET_TEXT_POS_FROM_MARKER (start, WGET (w, start));
 
   /* Display.  */
   clear_glyph_matrix (w->desired_matrix);
@@ -10265,15 +10265,15 @@ resize_mini_window_1 (ptrdiff_t a1, Lisp_Object exactly, ptrdiff_t a3, ptrdiff_t
 int
 resize_mini_window (struct window *w, int exact_p)
 {
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
   int window_height_changed_p = 0;
 
   eassert (MINI_WINDOW_P (w));
 
   /* By default, start display at the beginning.  */
-  set_marker_both (WVAR (w, start), WVAR (w, buffer),
-                  BUF_BEGV (XBUFFER (WVAR (w, buffer))),
-                  BUF_BEGV_BYTE (XBUFFER (WVAR (w, buffer))));
+  set_marker_both (WGET (w, start), WGET (w, buffer),
+                  BUF_BEGV (XBUFFER (WGET (w, buffer))),
+                  BUF_BEGV_BYTE (XBUFFER (WGET (w, buffer))));
 
   /* Don't resize windows while redisplaying a window; it would
      confuse redisplay functions when the size of the window they are
@@ -10300,10 +10300,10 @@ resize_mini_window (struct window *w, int exact_p)
       struct text_pos start;
       struct buffer *old_current_buffer = NULL;
 
-      if (current_buffer != XBUFFER (WVAR (w, buffer)))
+      if (current_buffer != XBUFFER (WGET (w, buffer)))
        {
          old_current_buffer = current_buffer;
-         set_buffer_internal (XBUFFER (WVAR (w, buffer)));
+         set_buffer_internal (XBUFFER (WGET (w, buffer)));
        }
 
       init_iterator (&it, w, BEGV, BEGV_BYTE, NULL, DEFAULT_FACE_ID);
@@ -10345,7 +10345,7 @@ resize_mini_window (struct window *w, int exact_p)
        }
       else
        SET_TEXT_POS (start, BEGV, BEGV_BYTE);
-      SET_MARKER_FROM_TEXT_POS (WVAR (w, start), start);
+      SET_MARKER_FROM_TEXT_POS (WGET (w, start), start);
 
       if (EQ (Vresize_mini_windows, Qgrow_only))
        {
@@ -11053,7 +11053,7 @@ x_consider_frame_title (Lisp_Object frame)
 
       Fselect_window (FGET (f, selected_window), Qt);
       set_buffer_internal_1
-       (XBUFFER (WVAR (XWINDOW (FGET (f, selected_window)), buffer)));
+       (XBUFFER (WGET (XWINDOW (FGET (f, selected_window)), buffer)));
       fmt = FRAME_ICONIFIED_P (f) ? Vicon_title_format : Vframe_title_format;
 
       mode_line_target = MODE_LINE_TITLE;
@@ -11173,7 +11173,7 @@ prepare_menu_bars (void)
              && FRAME_NS_P (f))
             ns_set_doc_edited
              (f, Fbuffer_modified_p
-              (WVAR (XWINDOW (FGET (f, selected_window)), buffer)));
+              (WGET (XWINDOW (FGET (f, selected_window)), buffer)));
 #endif
          UNGCPRO;
        }
@@ -11238,19 +11238,19 @@ update_menu_bar (struct frame *f, int save_match_data, int hooks_run)
          /* This used to test w->update_mode_line, but we believe
             there is no need to recompute the menu in that case.  */
          || update_mode_lines
-         || ((BUF_SAVE_MODIFF (XBUFFER (WVAR (w, buffer)))
-              < BUF_MODIFF (XBUFFER (WVAR (w, buffer))))
+         || ((BUF_SAVE_MODIFF (XBUFFER (WGET (w, buffer)))
+              < BUF_MODIFF (XBUFFER (WGET (w, buffer))))
              != w->last_had_star)
          || ((!NILP (Vtransient_mark_mode)
-              && !NILP (BVAR (XBUFFER (WVAR (w, buffer)), mark_active)))
-             != !NILP (WVAR (w, region_showing))))
+              && !NILP (BVAR (XBUFFER (WGET (w, buffer)), mark_active)))
+             != !NILP (WGET (w, region_showing))))
        {
          struct buffer *prev = current_buffer;
          ptrdiff_t count = SPECPDL_INDEX ();
 
          specbind (Qinhibit_menubar_update, Qt);
 
-         set_buffer_internal_1 (XBUFFER (WVAR (w, buffer)));
+         set_buffer_internal_1 (XBUFFER (WGET (w, buffer)));
          if (save_match_data)
            record_unwind_save_match_data ();
          if (NILP (Voverriding_local_map_menu_flag))
@@ -11436,12 +11436,12 @@ update_tool_bar (struct frame *f, int save_match_data)
       if (windows_or_buffers_changed
          || w->update_mode_line
          || update_mode_lines
-         || ((BUF_SAVE_MODIFF (XBUFFER (WVAR (w, buffer)))
-              < BUF_MODIFF (XBUFFER (WVAR (w, buffer))))
+         || ((BUF_SAVE_MODIFF (XBUFFER (WGET (w, buffer)))
+              < BUF_MODIFF (XBUFFER (WGET (w, buffer))))
              != w->last_had_star)
          || ((!NILP (Vtransient_mark_mode)
-              && !NILP (BVAR (XBUFFER (WVAR (w, buffer)), mark_active)))
-             != !NILP (WVAR (w, region_showing))))
+              && !NILP (BVAR (XBUFFER (WGET (w, buffer)), mark_active)))
+             != !NILP (WGET (w, region_showing))))
        {
          struct buffer *prev = current_buffer;
          ptrdiff_t count = SPECPDL_INDEX ();
@@ -11452,7 +11452,7 @@ update_tool_bar (struct frame *f, int save_match_data)
          /* Set current_buffer to the buffer of the selected
             window of the frame, so that we get the right local
             keymaps.  */
-         set_buffer_internal_1 (XBUFFER (WVAR (w, buffer)));
+         set_buffer_internal_1 (XBUFFER (WGET (w, buffer)));
 
          /* Save match data, if we must.  */
          if (save_match_data)
@@ -12323,10 +12323,10 @@ hscroll_window_tree (Lisp_Object window)
     {
       struct window *w = XWINDOW (window);
 
-      if (WINDOWP (WVAR (w, hchild)))
-       hscrolled_p |= hscroll_window_tree (WVAR (w, hchild));
-      else if (WINDOWP (WVAR (w, vchild)))
-       hscrolled_p |= hscroll_window_tree (WVAR (w, vchild));
+      if (WINDOWP (WGET (w, hchild)))
+       hscrolled_p |= hscroll_window_tree (WGET (w, hchild));
+      else if (WINDOWP (WGET (w, vchild)))
+       hscrolled_p |= hscroll_window_tree (WGET (w, vchild));
       else if (w->cursor.vpos >= 0)
        {
          int h_margin;
@@ -12346,7 +12346,7 @@ hscroll_window_tree (Lisp_Object window)
          /* Scroll when cursor is inside this scroll margin.  */
          h_margin = hscroll_margin * WINDOW_FRAME_COLUMN_WIDTH (w);
 
-         if (!NILP (Fbuffer_local_value (Qauto_hscroll_mode, WVAR (w, buffer)))
+         if (!NILP (Fbuffer_local_value (Qauto_hscroll_mode, WGET (w, buffer)))
              /* For left-to-right rows, hscroll when cursor is either
                 (i) inside the right hscroll margin, or (ii) if it is
                 inside the left margin and the window is already
@@ -12381,13 +12381,13 @@ hscroll_window_tree (Lisp_Object window)
 
              /* Find point in a display of infinite width.  */
              saved_current_buffer = current_buffer;
-             current_buffer = XBUFFER (WVAR (w, buffer));
+             current_buffer = XBUFFER (WGET (w, buffer));
 
              if (w == XWINDOW (selected_window))
                pt = PT;
              else
                {
-                 pt = marker_position (WVAR (w, pointm));
+                 pt = marker_position (WGET (w, pointm));
                  pt = max (BEGV, pt);
                  pt = min (ZV, pt);
                }
@@ -12438,14 +12438,14 @@ hscroll_window_tree (Lisp_Object window)
                 redisplay.  */
              if (w->hscroll != hscroll)
                {
-                 XBUFFER (WVAR (w, buffer))->prevent_redisplay_optimizations_p = 1;
+                 XBUFFER (WGET (w, buffer))->prevent_redisplay_optimizations_p = 1;
                  w->hscroll = hscroll;
                  hscrolled_p = 1;
                }
            }
        }
 
-      window = WVAR (w, next);
+      window = WGET (w, next);
     }
 
   /* Value is non-zero if hscroll of any leaf window has been changed.  */
@@ -12527,9 +12527,9 @@ debug_method_add (struct window *w, char const *fmt, ...)
   if (trace_redisplay_p)
     fprintf (stderr, "%p (%s): %s\n",
             w,
-            ((BUFFERP (WVAR (w, buffer))
-              && STRINGP (BVAR (XBUFFER (WVAR (w, buffer)), name)))
-             ? SSDATA (BVAR (XBUFFER (WVAR (w, buffer)), name))
+            ((BUFFERP (WGET (w, buffer))
+              && STRINGP (BVAR (XBUFFER (WGET (w, buffer)), name)))
+             ? SSDATA (BVAR (XBUFFER (WGET (w, buffer)), name))
              : "no buffer"),
             method + len);
 }
@@ -12594,8 +12594,8 @@ text_outside_line_unchanged_p (struct window *w,
         require to redisplay the whole paragraph.  It might be worthwhile
         to find the paragraph limits and widen the range of redisplayed
         lines to that, but for now just give up this optimization.  */
-      if (!NILP (BVAR (XBUFFER (WVAR (w, buffer)), bidi_display_reordering))
-         && NILP (BVAR (XBUFFER (WVAR (w, buffer)), bidi_paragraph_direction)))
+      if (!NILP (BVAR (XBUFFER (WGET (w, buffer)), bidi_display_reordering))
+         && NILP (BVAR (XBUFFER (WGET (w, buffer)), bidi_paragraph_direction)))
        unchanged_p = 0;
     }
 
@@ -12807,7 +12807,7 @@ static inline void
 reconsider_clip_changes (struct window *w, struct buffer *b)
 {
   if (b->clip_changed
-          && !NILP (WVAR (w, window_end_valid))
+          && !NILP (WGET (w, window_end_valid))
           && w->current_matrix->buffer == b
           && w->current_matrix->zv == BUF_ZV (b)
           && w->current_matrix->begv == BUF_BEGV (b))
@@ -12819,20 +12819,20 @@ reconsider_clip_changes (struct window *w, struct buffer *b)
      b->clip_changed has already been set to 1, we can skip this
      check.  */
   if (!b->clip_changed
-      && BUFFERP (WVAR (w, buffer)) && !NILP (WVAR (w, window_end_valid)))
+      && BUFFERP (WGET (w, buffer)) && !NILP (WGET (w, window_end_valid)))
     {
       ptrdiff_t pt;
 
       if (w == XWINDOW (selected_window))
        pt = PT;
       else
-       pt = marker_position (WVAR (w, pointm));
+       pt = marker_position (WGET (w, pointm));
 
-      if ((w->current_matrix->buffer != XBUFFER (WVAR (w, buffer))
+      if ((w->current_matrix->buffer != XBUFFER (WGET (w, buffer))
           || pt != w->last_point)
          && check_point_in_composition (w->current_matrix->buffer,
                                         w->last_point,
-                                        XBUFFER (WVAR (w, buffer)), pt))
+                                        XBUFFER (WGET (w, buffer)), pt))
        b->clip_changed = 1;
     }
 }
@@ -12915,7 +12915,7 @@ redisplay_internal (void)
   /* Don't examine these until after testing Vinhibit_redisplay.
      When Emacs is shutting down, perhaps because its connection to
      X has dropped, we should not look at them at all.  */
-  fr = XFRAME (WVAR (w, frame));
+  fr = XFRAME (WGET (w, frame));
   sf = SELECTED_FRAME ();
 
   if (!fr->glyphs_initialized_p)
@@ -13051,18 +13051,18 @@ redisplay_internal (void)
   specbind (Qinhibit_point_motion_hooks, Qt);
 
   /* If %c is in the mode line, update it if needed.  */
-  if (!NILP (WVAR (w, column_number_displayed))
+  if (!NILP (WGET (w, column_number_displayed))
       /* This alternative quickly identifies a common case
         where no change is needed.  */
       && !(PT == w->last_point
           && w->last_modified >= MODIFF
           && w->last_overlay_modified >= OVERLAY_MODIFF)
-      && (XFASTINT (WVAR (w, column_number_displayed)) != current_column ()))
+      && (XFASTINT (WGET (w, column_number_displayed)) != current_column ()))
     w->update_mode_line = 1;
 
   unbind_to (count1, Qnil);
 
-  FRAME_SCROLL_BOTTOM_VPOS (XFRAME (WVAR (w, frame))) = -1;
+  FRAME_SCROLL_BOTTOM_VPOS (XFRAME (WGET (w, frame))) = -1;
 
   /* The variable buffer_shared is set in redisplay_window and
      indicates that we redisplay a buffer in different windows.  See
@@ -13146,11 +13146,11 @@ redisplay_internal (void)
      the whole window.  The assignment to this_line_start_pos prevents
      the optimization directly below this if-statement.  */
   if (((!NILP (Vtransient_mark_mode)
-       && !NILP (BVAR (XBUFFER (WVAR (w, buffer)), mark_active)))
-       != !NILP (WVAR (w, region_showing)))
-      || (!NILP (WVAR (w, region_showing))
-         && !EQ (WVAR (w, region_showing),
-                 Fmarker_position (BVAR (XBUFFER (WVAR (w, buffer)), mark)))))
+       && !NILP (BVAR (XBUFFER (WGET (w, buffer)), mark_active)))
+       != !NILP (WGET (w, region_showing)))
+      || (!NILP (WGET (w, region_showing))
+         && !EQ (WGET (w, region_showing),
+                 Fmarker_position (BVAR (XBUFFER (WGET (w, buffer)), mark)))))
     CHARPOS (this_line_start_pos) = 0;
 
   /* Optimize the case that only the line containing the cursor in the
@@ -13164,11 +13164,11 @@ redisplay_internal (void)
       && !w->update_mode_line
       && !current_buffer->clip_changed
       && !current_buffer->prevent_redisplay_optimizations_p
-      && FRAME_VISIBLE_P (XFRAME (WVAR (w, frame)))
-      && !FRAME_OBSCURED_P (XFRAME (WVAR (w, frame)))
+      && FRAME_VISIBLE_P (XFRAME (WGET (w, frame)))
+      && !FRAME_OBSCURED_P (XFRAME (WGET (w, frame)))
       /* Make sure recorded data applies to current buffer, etc.  */
       && this_line_buffer == current_buffer
-      && current_buffer == XBUFFER (WVAR (w, buffer))
+      && current_buffer == XBUFFER (WGET (w, buffer))
       && !w->force_start
       && !w->optional_new_start
       /* Point must be on the line that we have info recorded about.  */
@@ -13266,13 +13266,13 @@ redisplay_internal (void)
                 adjusted.  */
              if ((it.glyph_row - 1)->displays_text_p)
                {
-                 if (XFASTINT (WVAR (w, window_end_vpos)) < this_line_vpos)
-                   XSETINT (WVAR (w, window_end_vpos), this_line_vpos);
+                 if (XFASTINT (WGET (w, window_end_vpos)) < this_line_vpos)
+                   WSET (w, window_end_vpos, make_number (this_line_vpos));
                }
-             else if (XFASTINT (WVAR (w, window_end_vpos)) == this_line_vpos
+             else if (XFASTINT (WGET (w, window_end_vpos)) == this_line_vpos
                       && this_line_vpos > 0)
-               XSETINT (WVAR (w, window_end_vpos), this_line_vpos - 1);
-             WVAR (w, window_end_valid) = Qnil;
+               WSET (w, window_end_vpos, make_number (this_line_vpos - 1));
+             WSET (w, window_end_valid, Qnil);
 
              /* Update hint: No need to try to scroll in update_window.  */
              w->desired_matrix->no_scrolling_p = 1;
@@ -13318,7 +13318,7 @@ redisplay_internal (void)
               && (EQ (selected_window,
                       BVAR (current_buffer, last_selected_window))
                   || highlight_nonselected_windows)
-              && NILP (WVAR (w, region_showing))
+              && NILP (WGET (w, region_showing))
               && NILP (Vshow_trailing_whitespace)
               && !cursor_in_echo_area)
        {
@@ -13479,7 +13479,7 @@ redisplay_internal (void)
       Lisp_Object mini_window = FRAME_MINIBUF_WINDOW (sf);
       struct frame *mini_frame;
 
-      displayed_buffer = XBUFFER (WVAR (XWINDOW (selected_window), buffer));
+      displayed_buffer = XBUFFER (WGET (XWINDOW (selected_window), buffer));
       /* Use list_of_error, not Qerror, so that
         we catch only errors and don't run the debugger.  */
       internal_condition_case_1 (redisplay_window_1, selected_window,
@@ -13545,7 +13545,7 @@ redisplay_internal (void)
       /* If we pause after scrolling, some rows in the current
         matrices of some windows are not valid.  */
       if (!WINDOW_FULL_WIDTH_P (w)
-         && !FRAME_WINDOW_P (XFRAME (WVAR (w, frame))))
+         && !FRAME_WINDOW_P (XFRAME (WGET (w, frame))))
        update_mode_lines = 1;
     }
   else
@@ -13703,9 +13703,9 @@ unwind_redisplay (Lisp_Object val)
 static void
 mark_window_display_accurate_1 (struct window *w, int accurate_p)
 {
-  if (BUFFERP (WVAR (w, buffer)))
+  if (BUFFERP (WGET (w, buffer)))
     {
-      struct buffer *b = XBUFFER (WVAR (w, buffer));
+      struct buffer *b = XBUFFER (WGET (w, buffer));
 
       w->last_modified = accurate_p ? BUF_MODIFF(b) : 0;
       w->last_overlay_modified = accurate_p ? BUF_OVERLAY_MODIFF(b) : 0;
@@ -13732,13 +13732,13 @@ mark_window_display_accurate_1 (struct window *w, int accurate_p)
          if (w == XWINDOW (selected_window))
            w->last_point = BUF_PT (b);
          else
-           w->last_point = XMARKER (WVAR (w, pointm))->charpos;
+           w->last_point = XMARKER (WGET (w, pointm))->charpos;
        }
     }
 
   if (accurate_p)
     {
-      WVAR (w, window_end_valid) = WVAR (w, buffer);
+      WSET (w, window_end_valid, WGET (w, buffer));
       w->update_mode_line = 0;
     }
 }
@@ -13754,15 +13754,15 @@ mark_window_display_accurate (Lisp_Object window, int accurate_p)
 {
   struct window *w;
 
-  for (; !NILP (window); window = WVAR (w, next))
+  for (; !NILP (window); window = WGET (w, next))
     {
       w = XWINDOW (window);
       mark_window_display_accurate_1 (w, accurate_p);
 
-      if (!NILP (WVAR (w, vchild)))
-       mark_window_display_accurate (WVAR (w, vchild), accurate_p);
-      if (!NILP (WVAR (w, hchild)))
-       mark_window_display_accurate (WVAR (w, hchild), accurate_p);
+      if (!NILP (WGET (w, vchild)))
+       mark_window_display_accurate (WGET (w, vchild), accurate_p);
+      if (!NILP (WGET (w, hchild)))
+       mark_window_display_accurate (WGET (w, hchild), accurate_p);
     }
 
   if (accurate_p)
@@ -13822,13 +13822,13 @@ redisplay_windows (Lisp_Object window)
     {
       struct window *w = XWINDOW (window);
 
-      if (!NILP (WVAR (w, hchild)))
-       redisplay_windows (WVAR (w, hchild));
-      else if (!NILP (WVAR (w, vchild)))
-       redisplay_windows (WVAR (w, vchild));
-      else if (!NILP (WVAR (w, buffer)))
+      if (!NILP (WGET (w, hchild)))
+       redisplay_windows (WGET (w, hchild));
+      else if (!NILP (WGET (w, vchild)))
+       redisplay_windows (WGET (w, vchild));
+      else if (!NILP (WGET (w, buffer)))
        {
-         displayed_buffer = XBUFFER (WVAR (w, buffer));
+         displayed_buffer = XBUFFER (WGET (w, buffer));
          /* Use list_of_error, not Qerror, so that
             we catch only errors and don't run the debugger.  */
          internal_condition_case_1 (redisplay_window_0, window,
@@ -13836,7 +13836,7 @@ redisplay_windows (Lisp_Object window)
                                     redisplay_window_error);
        }
 
-      window = WVAR (w, next);
+      window = WGET (w, next);
     }
 }
 
@@ -14470,7 +14470,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
          && !MATRIX_ROW_CONTINUATION_LINE_P (row)
          && row->x == 0)
        {
-         this_line_buffer = XBUFFER (WVAR (w, buffer));
+         this_line_buffer = XBUFFER (WGET (w, buffer));
 
          CHARPOS (this_line_start_pos)
            = MATRIX_ROW_START_CHARPOS (row) + delta;
@@ -14504,19 +14504,19 @@ static inline struct text_pos
 run_window_scroll_functions (Lisp_Object window, struct text_pos startp)
 {
   struct window *w = XWINDOW (window);
-  SET_MARKER_FROM_TEXT_POS (WVAR (w, start), startp);
+  SET_MARKER_FROM_TEXT_POS (WGET (w, start), startp);
 
-  if (current_buffer != XBUFFER (WVAR (w, buffer)))
+  if (current_buffer != XBUFFER (WGET (w, buffer)))
     abort ();
 
   if (!NILP (Vwindow_scroll_functions))
     {
       run_hook_with_args_2 (Qwindow_scroll_functions, window,
                            make_number (CHARPOS (startp)));
-      SET_TEXT_POS_FROM_MARKER (startp, WVAR (w, start));
+      SET_TEXT_POS_FROM_MARKER (startp, WGET (w, start));
       /* In case the hook functions switch buffers.  */
-      if (current_buffer != XBUFFER (WVAR (w, buffer)))
-       set_buffer_internal_1 (XBUFFER (WVAR (w, buffer)));
+      if (current_buffer != XBUFFER (WGET (w, buffer)))
+       set_buffer_internal_1 (XBUFFER (WGET (w, buffer)));
     }
 
   return startp;
@@ -14606,7 +14606,7 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
               int temp_scroll_step, int last_line_misfit)
 {
   struct window *w = XWINDOW (window);
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
   struct text_pos pos, startp;
   struct it it;
   int this_scroll_margin, scroll_max, rc, height;
@@ -14620,7 +14620,7 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
   debug_method_add (w, "try_scrolling");
 #endif
 
-  SET_TEXT_POS_FROM_MARKER (startp, WVAR (w, start));
+  SET_TEXT_POS_FROM_MARKER (startp, WGET (w, start));
 
   /* Compute scroll margin height in pixels.  We scroll when point is
      within this distance from the top or bottom of the window.  */
@@ -14846,7 +14846,7 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
       if (!just_this_one_p
          || current_buffer->clip_changed
          || BEG_UNCHANGED < CHARPOS (startp))
-       WVAR (w, base_line_number) = Qnil;
+       WSET (w, base_line_number, Qnil);
 
       /* If cursor ends up on a partially visible line,
         treat that as being off the bottom of the screen.  */
@@ -14881,7 +14881,7 @@ compute_window_start_on_continuation_line (struct window *w)
   struct text_pos pos, start_pos;
   int window_start_changed_p = 0;
 
-  SET_TEXT_POS_FROM_MARKER (start_pos, WVAR (w, start));
+  SET_TEXT_POS_FROM_MARKER (start_pos, WGET (w, start));
 
   /* If window start is on a continuation line...  Window start may be
      < BEGV in case there's invisible text at the start of the
@@ -14929,7 +14929,7 @@ compute_window_start_on_continuation_line (struct window *w)
            }
 
          /* Set the window start there.  */
-         SET_MARKER_FROM_TEXT_POS (WVAR (w, start), pos);
+         SET_MARKER_FROM_TEXT_POS (WGET (w, start), pos);
          window_start_changed_p = 1;
        }
     }
@@ -14965,7 +14965,7 @@ static int
 try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_step)
 {
   struct window *w = XWINDOW (window);
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
   int rc = CURSOR_MOVEMENT_CANNOT_BE_USED;
 
 #ifdef GLYPH_DEBUG
@@ -14996,7 +14996,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
          set the cursor.  */
       && !(!NILP (Vtransient_mark_mode)
           && !NILP (BVAR (current_buffer, mark_active)))
-      && NILP (WVAR (w, region_showing))
+      && NILP (WGET (w, region_showing))
       && NILP (Vshow_trailing_whitespace)
       /* This code is not used for mini-buffer for the sake of the case
         of redisplaying to replace an echo area message; since in
@@ -15010,8 +15010,8 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
         larger than the window.  This should really be fixed in
         window.c.  I don't have this on my list, now, so we do
         approximately the same as the old redisplay code.  --gerd.  */
-      && INTEGERP (WVAR (w, window_end_vpos))
-      && XFASTINT (WVAR (w, window_end_vpos)) < w->current_matrix->nrows
+      && INTEGERP (WGET (w, window_end_vpos))
+      && XFASTINT (WGET (w, window_end_vpos)) < w->current_matrix->nrows
       && (FRAME_WINDOW_P (f)
          || !overlay_arrow_in_current_buffer_p ()))
     {
@@ -15148,7 +15148,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
              must_scroll = 1;
            }
          else if (rc != CURSOR_MOVEMENT_SUCCESS
-                  && !NILP (BVAR (XBUFFER (WVAR (w, buffer)), bidi_display_reordering)))
+                  && !NILP (BVAR (XBUFFER (WGET (w, buffer)), bidi_display_reordering)))
            {
              struct glyph_row *row1;
 
@@ -15211,7 +15211,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
          else if (scroll_p)
            rc = CURSOR_MOVEMENT_MUST_SCROLL;
          else if (rc != CURSOR_MOVEMENT_SUCCESS
-                  && !NILP (BVAR (XBUFFER (WVAR (w, buffer)), bidi_display_reordering)))
+                  && !NILP (BVAR (XBUFFER (WGET (w, buffer)), bidi_display_reordering)))
            {
              /* With bidi-reordered rows, there could be more than
                 one candidate row whose start and end positions
@@ -15318,12 +15318,12 @@ set_vertical_scroll_bar (struct window *w)
       || (w == XWINDOW (minibuf_window)
          && NILP (echo_area_buffer[0])))
     {
-      struct buffer *buf = XBUFFER (WVAR (w, buffer));
+      struct buffer *buf = XBUFFER (WGET (w, buffer));
       whole = BUF_ZV (buf) - BUF_BEGV (buf);
-      start = marker_position (WVAR (w, start)) - BUF_BEGV (buf);
+      start = marker_position (WGET (w, start)) - BUF_BEGV (buf);
       /* I don't think this is guaranteed to be right.  For the
         moment, we'll pretend it is.  */
-      end = BUF_Z (buf) - XFASTINT (WVAR (w, window_end_pos)) - BUF_BEGV (buf);
+      end = BUF_Z (buf) - XFASTINT (WGET (w, window_end_pos)) - BUF_BEGV (buf);
 
       if (end < start)
        end = start;
@@ -15334,8 +15334,8 @@ set_vertical_scroll_bar (struct window *w)
     start = end = whole = 0;
 
   /* Indicate what this scroll bar ought to be displaying now.  */
-  if (FRAME_TERMINAL (XFRAME (WVAR (w, frame)))->set_vertical_scroll_bar_hook)
-    (*FRAME_TERMINAL (XFRAME (WVAR (w, frame)))->set_vertical_scroll_bar_hook)
+  if (FRAME_TERMINAL (XFRAME (WGET (w, frame)))->set_vertical_scroll_bar_hook)
+    (*FRAME_TERMINAL (XFRAME (WGET (w, frame)))->set_vertical_scroll_bar_hook)
       (w, end - start, whole, start);
 }
 
@@ -15351,8 +15351,8 @@ static void
 redisplay_window (Lisp_Object window, int just_this_one_p)
 {
   struct window *w = XWINDOW (window);
-  struct frame *f = XFRAME (WVAR (w, frame));
-  struct buffer *buffer = XBUFFER (WVAR (w, buffer));
+  struct frame *f = XFRAME (WGET (w, frame));
+  struct buffer *buffer = XBUFFER (WGET (w, buffer));
   struct buffer *old = current_buffer;
   struct text_pos lpoint, opoint, startp;
   int update_mode_line;
@@ -15375,7 +15375,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
   opoint = lpoint;
 
   /* W must be a leaf window here.  */
-  eassert (!NILP (WVAR (w, buffer)));
+  eassert (!NILP (WGET (w, buffer)));
 #ifdef GLYPH_DEBUG
   *w->desired_matrix->method = 0;
 #endif
@@ -15405,10 +15405,10 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
       else if ((w != XWINDOW (minibuf_window)
                || minibuf_level == 0)
               /* When buffer is nonempty, redisplay window normally. */
-              && BUF_Z (XBUFFER (WVAR (w, buffer))) == BUF_BEG (XBUFFER (WVAR (w, buffer)))
+              && BUF_Z (XBUFFER (WGET (w, buffer))) == BUF_BEG (XBUFFER (WGET (w, buffer)))
               /* Quail displays non-mini buffers in minibuffer window.
                  In that case, redisplay the window normally.  */
-              && !NILP (Fmemq (WVAR (w, buffer), Vminibuffer_list)))
+              && !NILP (Fmemq (WGET (w, buffer), Vminibuffer_list)))
        {
          /* W is a mini-buffer window, but it's not active, so clear
             it.  */
@@ -15430,10 +15430,10 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
      value.  */
   /* Really select the buffer, for the sake of buffer-local
      variables.  */
-  set_buffer_internal_1 (XBUFFER (WVAR (w, buffer)));
+  set_buffer_internal_1 (XBUFFER (WGET (w, buffer)));
 
   current_matrix_up_to_date_p
-    = (!NILP (WVAR (w, window_end_valid))
+    = (!NILP (WGET (w, window_end_valid))
        && !current_buffer->clip_changed
        && !current_buffer->prevent_redisplay_optimizations_p
        && w->last_modified >= MODIFF
@@ -15457,7 +15457,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
   specbind (Qinhibit_point_motion_hooks, Qt);
 
   buffer_unchanged_p
-    = (!NILP (WVAR (w, window_end_valid))
+    = (!NILP (WGET (w, window_end_valid))
        && !current_buffer->clip_changed
        && w->last_modified >= MODIFF
        && w->last_overlay_modified >= OVERLAY_MODIFF);
@@ -15468,10 +15468,10 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
     {
       /* If window starts on a continuation line, maybe adjust the
         window start in case the window's width changed.  */
-      if (XMARKER (WVAR (w, start))->buffer == current_buffer)
+      if (XMARKER (WGET (w, start))->buffer == current_buffer)
        compute_window_start_on_continuation_line (w);
 
-      WVAR (w, window_end_valid) = Qnil;
+      WSET (w, window_end_valid, Qnil);
     }
 
   /* Some sanity checks.  */
@@ -15482,13 +15482,13 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
     abort ();
 
   /* If %c is in mode line, update it if needed.  */
-  if (!NILP (WVAR (w, column_number_displayed))
+  if (!NILP (WGET (w, column_number_displayed))
       /* This alternative quickly identifies a common case
         where no change is needed.  */
       && !(PT == w->last_point
           && w->last_modified >= MODIFF
           && w->last_overlay_modified >= OVERLAY_MODIFF)
-      && (XFASTINT (WVAR (w, column_number_displayed)) != current_column ()))
+      && (XFASTINT (WGET (w, column_number_displayed)) != current_column ()))
     update_mode_line = 1;
 
   /* Count number of windows showing the selected buffer.  An indirect
@@ -15497,7 +15497,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
     {
       struct buffer *current_base, *window_base;
       current_base = current_buffer;
-      window_base = XBUFFER (WVAR (XWINDOW (selected_window), buffer));
+      window_base = XBUFFER (WGET (XWINDOW (selected_window), buffer));
       if (current_base->base_buffer)
        current_base = current_base->base_buffer;
       if (window_base->base_buffer)
@@ -15510,19 +15510,19 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
      window, set up appropriate value.  */
   if (!EQ (window, selected_window))
     {
-      ptrdiff_t new_pt = XMARKER (WVAR (w, pointm))->charpos;
-      ptrdiff_t new_pt_byte = marker_byte_position (WVAR (w, pointm));
+      ptrdiff_t new_pt = XMARKER (WGET (w, pointm))->charpos;
+      ptrdiff_t new_pt_byte = marker_byte_position (WGET (w, pointm));
       if (new_pt < BEGV)
        {
          new_pt = BEGV;
          new_pt_byte = BEGV_BYTE;
-         set_marker_both (WVAR (w, pointm), Qnil, BEGV, BEGV_BYTE);
+         set_marker_both (WGET (w, pointm), Qnil, BEGV, BEGV_BYTE);
        }
       else if (new_pt > (ZV - 1))
        {
          new_pt = ZV;
          new_pt_byte = ZV_BYTE;
-         set_marker_both (WVAR (w, pointm), Qnil, ZV, ZV_BYTE);
+         set_marker_both (WGET (w, pointm), Qnil, ZV, ZV_BYTE);
        }
 
       /* We don't use SET_PT so that the point-motion hooks don't run.  */
@@ -15549,10 +15549,10 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
     }
 
   /* If window-start is screwed up, choose a new one.  */
-  if (XMARKER (WVAR (w, start))->buffer != current_buffer)
+  if (XMARKER (WGET (w, start))->buffer != current_buffer)
     goto recenter;
 
-  SET_TEXT_POS_FROM_MARKER (startp, WVAR (w, start));
+  SET_TEXT_POS_FROM_MARKER (startp, WGET (w, start));
 
   /* If someone specified a new starting point but did not insist,
      check whether it can be used.  */
@@ -15582,11 +15582,11 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
 
       w->force_start = 0;
       w->vscroll = 0;
-      WVAR (w, window_end_valid) = Qnil;
+      WSET (w, window_end_valid, Qnil);
 
       /* Forget any recorded base line for line number display.  */
       if (!buffer_unchanged_p)
-       WVAR (w, base_line_number) = Qnil;
+       WSET (w, base_line_number, Qnil);
 
       /* Redisplay the mode line.  Select the buffer properly for that.
         Also, run the hook window-scroll-functions
@@ -15651,7 +15651,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
                            MATRIX_ROW_START_BYTEPOS (row));
 
          if (w != XWINDOW (selected_window))
-           set_marker_both (WVAR (w, pointm), Qnil, PT, PT_BYTE);
+           set_marker_both (WGET (w, pointm), Qnil, PT, PT_BYTE);
          else if (current_buffer == old)
            SET_TEXT_POS (lpoint, PT, PT_BYTE);
 
@@ -15753,7 +15753,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
             sets it.  So, we need to check the return value of
             compute_window_start_on_continuation_line.  (See also
             bug#197).  */
-         && XMARKER (WVAR (w, start))->buffer == current_buffer
+         && XMARKER (WGET (w, start))->buffer == current_buffer
          && compute_window_start_on_continuation_line (w)
          /* It doesn't make sense to force the window start like we
             do at label force_start if it is already known that point
@@ -15764,7 +15764,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
          && pos_visible_p (w, PT, &d1, &d2, &d3, &d4, &d5, &d6))
        {
          w->force_start = 1;
-         SET_TEXT_POS_FROM_MARKER (startp, WVAR (w, start));
+         SET_TEXT_POS_FROM_MARKER (startp, WGET (w, start));
          goto force_start;
        }
 
@@ -15800,7 +15800,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
              || current_buffer->clip_changed
              || BEG_UNCHANGED < CHARPOS (startp))
            /* Forget any recorded base line for line number display.  */
-           WVAR (w, base_line_number) = Qnil;
+           WSET (w, base_line_number, Qnil);
 
          if (!cursor_row_fully_visible_p (w, 1, 0))
            {
@@ -15871,7 +15871,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
 
   /* Forget any previously recorded base line for line number display.  */
   if (!buffer_unchanged_p)
-    WVAR (w, base_line_number) = Qnil;
+    WSET (w, base_line_number, Qnil);
 
   /* Determine the window start relative to point.  */
   init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID);
@@ -15974,7 +15974,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
   /* Set the window start position here explicitly, to avoid an
      infinite loop in case the functions in window-scroll-functions
      get errors.  */
-  set_marker_both (WVAR (w, start), Qnil, IT_CHARPOS (it), IT_BYTEPOS (it));
+  set_marker_both (WGET (w, start), Qnil, IT_CHARPOS (it), IT_BYTEPOS (it));
 
   /* Run scroll hooks.  */
   startp = run_window_scroll_functions (window, it.current.pos);
@@ -16005,8 +16005,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
      line.)  */
   if (w->cursor.vpos < 0)
     {
-      if (!NILP (WVAR (w, window_end_valid))
-         && PT >= Z - XFASTINT (WVAR (w, window_end_pos)))
+      if (!NILP (WGET (w, window_end_valid))
+         && PT >= Z - XFASTINT (WGET (w, window_end_pos)))
        {
          clear_glyph_matrix (w->desired_matrix);
          move_it_by_lines (&it, 1);
@@ -16078,7 +16078,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
 
  done:
 
-  SET_TEXT_POS_FROM_MARKER (startp, WVAR (w, start));
+  SET_TEXT_POS_FROM_MARKER (startp, WGET (w, start));
   w->start_at_line_beg = (CHARPOS (startp) == BEGV
                            || FETCH_BYTE (BYTEPOS (startp) - 1) == '\n');
 
@@ -16092,10 +16092,10 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
           && !FRAME_WINDOW_P (f)
           && !WINDOW_FULL_WIDTH_P (w))
        /* Line number to display.  */
-       || INTEGERP (WVAR (w, base_line_pos))
+       || INTEGERP (WGET (w, base_line_pos))
        /* Column number is displayed and different from the one displayed.  */
-       || (!NILP (WVAR (w, column_number_displayed))
-          && (XFASTINT (WVAR (w, column_number_displayed)) != current_column ())))
+       || (!NILP (WGET (w, column_number_displayed))
+          && (XFASTINT (WGET (w, column_number_displayed)) != current_column ())))
       /* This means that the window has a mode line.  */
       && (WINDOW_WANTS_MODELINE_P (w)
          || WINDOW_WANTS_HEADER_LINE_P (w)))
@@ -16127,10 +16127,10 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
     }
 
   if (!line_number_displayed
-      && !BUFFERP (WVAR (w, base_line_pos)))
+      && !BUFFERP (WGET (w, base_line_pos)))
     {
-      WVAR (w, base_line_pos) = Qnil;
-      WVAR (w, base_line_number) = Qnil;
+      WSET (w, base_line_pos, Qnil);
+      WSET (w, base_line_number, Qnil);
     }
 
  finish_menu_bars:
@@ -16243,10 +16243,10 @@ try_window (Lisp_Object window, struct text_pos pos, int flags)
   struct window *w = XWINDOW (window);
   struct it it;
   struct glyph_row *last_text_row = NULL;
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
 
   /* Make POS the new window start.  */
-  set_marker_both (WVAR (w, start), Qnil, CHARPOS (pos), BYTEPOS (pos));
+  set_marker_both (WGET (w, start), Qnil, CHARPOS (pos), BYTEPOS (pos));
 
   /* Mark cursor position as unknown.  No overlay arrow seen.  */
   w->cursor.vpos = -1;
@@ -16295,7 +16295,7 @@ try_window (Lisp_Object window, struct text_pos pos, int flags)
     }
 
   /* If bottom moved off end of frame, change mode line percentage.  */
-  if (XFASTINT (WVAR (w, window_end_pos)) <= 0
+  if (XFASTINT (WGET (w, window_end_pos)) <= 0
       && Z != IT_CHARPOS (it))
     w->update_mode_line = 1;
 
@@ -16307,23 +16307,23 @@ try_window (Lisp_Object window, struct text_pos pos, int flags)
       eassert (MATRIX_ROW_DISPLAYS_TEXT_P (last_text_row));
       w->window_end_bytepos
        = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row);
-      WVAR (w, window_end_pos)
-       = make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row));
-      WVAR (w, window_end_vpos)
-       = make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix));
+      WSET (w, window_end_pos,
+           make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row)));
+      WSET (w, window_end_vpos,
+           make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix)));
       eassert
        (MATRIX_ROW (w->desired_matrix,
-                    XFASTINT (WVAR (w, window_end_vpos)))->displays_text_p);
+                    XFASTINT (WGET (w, window_end_vpos)))->displays_text_p);
     }
   else
     {
       w->window_end_bytepos = Z_BYTE - ZV_BYTE;
-      WVAR (w, window_end_pos) = make_number (Z - ZV);
-      WVAR (w, window_end_vpos) = make_number (0);
+      WSET (w, window_end_pos, make_number (Z - ZV));
+      WSET (w, window_end_vpos, make_number (0));
     }
 
   /* But that is not valid info until redisplay finishes.  */
-  WVAR (w, window_end_valid) = Qnil;
+  WSET (w, window_end_valid, Qnil);
   return 1;
 }
 
@@ -16341,7 +16341,7 @@ try_window (Lisp_Object window, struct text_pos pos, int flags)
 static int
 try_window_reusing_current_matrix (struct window *w)
 {
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
   struct glyph_row *bottom_row;
   struct it it;
   struct run run;
@@ -16368,7 +16368,7 @@ try_window_reusing_current_matrix (struct window *w)
   /* Can't do this if region may have changed.  */
   if ((!NILP (Vtransient_mark_mode)
        && !NILP (BVAR (current_buffer, mark_active)))
-      || !NILP (WVAR (w, region_showing))
+      || !NILP (WGET (w, region_showing))
       || !NILP (Vshow_trailing_whitespace))
     return 0;
 
@@ -16385,7 +16385,7 @@ try_window_reusing_current_matrix (struct window *w)
 
   /* The variable new_start now holds the new window start.  The old
      start `start' can be determined from the current matrix.  */
-  SET_TEXT_POS_FROM_MARKER (new_start, WVAR (w, start));
+  SET_TEXT_POS_FROM_MARKER (new_start, WGET (w, start));
   start = start_row->minpos;
   start_vpos = MATRIX_ROW_VPOS (start_row, w->current_matrix);
 
@@ -16547,29 +16547,28 @@ try_window_reusing_current_matrix (struct window *w)
        {
          w->window_end_bytepos
            = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_reused_text_row);
-         WVAR (w, window_end_pos)
-           = make_number (Z - MATRIX_ROW_END_CHARPOS (last_reused_text_row));
-         WVAR (w, window_end_vpos)
-           = make_number (MATRIX_ROW_VPOS (last_reused_text_row,
-                                           w->current_matrix));
+         WSET (w, window_end_pos,
+               make_number (Z - MATRIX_ROW_END_CHARPOS (last_reused_text_row)));
+         WSET (w, window_end_vpos,
+               make_number (MATRIX_ROW_VPOS (last_reused_text_row, w->current_matrix)));
        }
       else if (last_text_row)
        {
          w->window_end_bytepos
            = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row);
-         WVAR (w, window_end_pos)
-           = make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row));
-         WVAR (w, window_end_vpos)
-           = make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix));
+         WSET (w, window_end_pos,
+               make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row)));
+         WSET (w, window_end_vpos,
+               make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix)));
        }
       else
        {
          /* This window must be completely empty.  */
          w->window_end_bytepos = Z_BYTE - ZV_BYTE;
-         WVAR (w, window_end_pos) = make_number (Z - ZV);
-         WVAR (w, window_end_vpos) = make_number (0);
+         WSET (w, window_end_pos, make_number (Z - ZV));
+         WSET (w, window_end_vpos, make_number (0));
        }
-      WVAR (w, window_end_valid) = Qnil;
+      WSET (w, window_end_valid, Qnil);
 
       /* Update hint: don't try scrolling again in update_window.  */
       w->desired_matrix->no_scrolling_p = 1;
@@ -16723,7 +16722,7 @@ try_window_reusing_current_matrix (struct window *w)
 
              /* Can't use this optimization with bidi-reordered glyph
                 rows, unless cursor is already at point. */
-             if (!NILP (BVAR (XBUFFER (WVAR (w, buffer)), bidi_display_reordering)))
+             if (!NILP (BVAR (XBUFFER (WGET (w, buffer)), bidi_display_reordering)))
                {
                  if (!(w->cursor.hpos >= 0
                        && w->cursor.hpos < row->used[TEXT_AREA]
@@ -16750,18 +16749,18 @@ try_window_reusing_current_matrix (struct window *w)
        {
          w->window_end_bytepos
            = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row);
-         WVAR (w, window_end_pos)
-           = make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row));
-         WVAR (w, window_end_vpos)
-           = make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix));
+         WSET (w, window_end_pos,
+               make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row)));
+         WSET (w, window_end_vpos,
+               make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix)));
        }
       else
        {
-         WVAR (w, window_end_vpos)
-           = make_number (XFASTINT (WVAR (w, window_end_vpos)) - nrows_scrolled);
+         WSET (w, window_end_vpos,
+               make_number (XFASTINT (WGET (w, window_end_vpos)) - nrows_scrolled));
        }
 
-      WVAR (w, window_end_valid) = Qnil;
+      WSET (w, window_end_valid, Qnil);
       w->desired_matrix->no_scrolling_p = 1;
 
 #ifdef GLYPH_DEBUG
@@ -16894,16 +16893,16 @@ find_first_unchanged_at_end_row (struct window *w,
 
   /* Display must not have been paused, otherwise the current matrix
      is not up to date.  */
-  eassert (!NILP (WVAR (w, window_end_valid)));
+  eassert (!NILP (WGET (w, window_end_valid)));
 
   /* A value of window_end_pos >= END_UNCHANGED means that the window
      end is in the range of changed text.  If so, there is no
      unchanged row at the end of W's current matrix.  */
-  if (XFASTINT (WVAR (w, window_end_pos)) >= END_UNCHANGED)
+  if (XFASTINT (WGET (w, window_end_pos)) >= END_UNCHANGED)
     return NULL;
 
   /* Set row to the last row in W's current matrix displaying text.  */
-  row = MATRIX_ROW (w->current_matrix, XFASTINT (WVAR (w, window_end_vpos)));
+  row = MATRIX_ROW (w->current_matrix, XFASTINT (WGET (w, window_end_vpos)));
 
   /* If matrix is entirely empty, no unchanged row exists.  */
   if (MATRIX_ROW_DISPLAYS_TEXT_P (row))
@@ -16914,7 +16913,7 @@ find_first_unchanged_at_end_row (struct window *w,
         buffer positions in the current matrix to current buffer
         positions for characters not in changed text.  */
       ptrdiff_t Z_old =
-       MATRIX_ROW_END_CHARPOS (row) + XFASTINT (WVAR (w, window_end_pos));
+       MATRIX_ROW_END_CHARPOS (row) + XFASTINT (WGET (w, window_end_pos));
       ptrdiff_t Z_BYTE_old =
        MATRIX_ROW_END_BYTEPOS (row) + w->window_end_bytepos;
       ptrdiff_t last_unchanged_pos, last_unchanged_pos_old;
@@ -16962,12 +16961,12 @@ find_first_unchanged_at_end_row (struct window *w,
 static void
 sync_frame_with_window_matrix_rows (struct window *w)
 {
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
   struct glyph_row *window_row, *window_row_end, *frame_row;
 
   /* Preconditions: W must be a leaf window and full-width.  Its frame
      must have a frame matrix.  */
-  eassert (NILP (WVAR (w, hchild)) && NILP (WVAR (w, vchild)));
+  eassert (NILP (WGET (w, hchild)) && NILP (WGET (w, vchild)));
   eassert (WINDOW_FULL_WIDTH_P (w));
   eassert (!FRAME_WINDOW_P (f));
 
@@ -17009,7 +17008,7 @@ row_containing_pos (struct window *w, ptrdiff_t charpos,
 {
   struct glyph_row *row = start;
   struct glyph_row *best_row = NULL;
-  ptrdiff_t mindif = BUF_ZV (XBUFFER (WVAR (w, buffer))) + 1;
+  ptrdiff_t mindif = BUF_ZV (XBUFFER (WGET (w, buffer))) + 1;
   int last_y;
 
   /* If we happen to start on a header-line, skip that.  */
@@ -17045,7 +17044,7 @@ row_containing_pos (struct window *w, ptrdiff_t charpos,
        {
          struct glyph *g;
 
-         if (NILP (BVAR (XBUFFER (WVAR (w, buffer)), bidi_display_reordering))
+         if (NILP (BVAR (XBUFFER (WGET (w, buffer)), bidi_display_reordering))
              || (!best_row && !row->continued_p))
            return row;
          /* In bidi-reordered rows, there could be several rows
@@ -17114,7 +17113,7 @@ row_containing_pos (struct window *w, ptrdiff_t charpos,
 static int
 try_window_id (struct window *w)
 {
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
   struct glyph_matrix *current_matrix = w->current_matrix;
   struct glyph_matrix *desired_matrix = w->desired_matrix;
   struct glyph_row *last_unchanged_at_beg_row;
@@ -17148,7 +17147,7 @@ try_window_id (struct window *w)
 #define GIVE_UP(X) return 0
 #endif
 
-  SET_TEXT_POS_FROM_MARKER (start, WVAR (w, start));
+  SET_TEXT_POS_FROM_MARKER (start, WGET (w, start));
 
   /* Don't use this for mini-windows because these can show
      messages and mini-buffers, and we don't handle that here.  */
@@ -17186,7 +17185,7 @@ try_window_id (struct window *w)
     GIVE_UP (7);
 
   /* Verify that display wasn't paused.  */
-  if (NILP (WVAR (w, window_end_valid)))
+  if (NILP (WGET (w, window_end_valid)))
     GIVE_UP (8);
 
   /* Can't use this if highlighting a region because a cursor movement
@@ -17200,7 +17199,7 @@ try_window_id (struct window *w)
     GIVE_UP (11);
 
   /* Likewise if showing a region.  */
-  if (!NILP (WVAR (w, region_showing)))
+  if (!NILP (WGET (w, region_showing)))
     GIVE_UP (10);
 
   /* Can't use this if overlay arrow position and/or string have
@@ -17212,7 +17211,7 @@ try_window_id (struct window *w)
      wrapped line can change the wrap position, altering the line
      above it.  It might be worthwhile to handle this more
      intelligently, but for now just redisplay from scratch.  */
-  if (!NILP (BVAR (XBUFFER (WVAR (w, buffer)), word_wrap)))
+  if (!NILP (BVAR (XBUFFER (WGET (w, buffer)), word_wrap)))
     GIVE_UP (21);
 
   /* Under bidi reordering, adding or deleting a character in the
@@ -17223,8 +17222,8 @@ try_window_id (struct window *w)
      to find the paragraph limits and widen the range of redisplayed
      lines to that, but for now just give up this optimization and
      redisplay from scratch.  */
-  if (!NILP (BVAR (XBUFFER (WVAR (w, buffer)), bidi_display_reordering))
-      && NILP (BVAR (XBUFFER (WVAR (w, buffer)), bidi_paragraph_direction)))
+  if (!NILP (BVAR (XBUFFER (WGET (w, buffer)), bidi_display_reordering))
+      && NILP (BVAR (XBUFFER (WGET (w, buffer)), bidi_paragraph_direction)))
     GIVE_UP (22);
 
   /* Make sure beg_unchanged and end_unchanged are up to date.  Do it
@@ -17250,7 +17249,7 @@ try_window_id (struct window *w)
      This case happens with stealth-fontification.  Note that although
      the display is unchanged, glyph positions in the matrix have to
      be adjusted, of course.  */
-  row = MATRIX_ROW (w->current_matrix, XFASTINT (WVAR (w, window_end_vpos)));
+  row = MATRIX_ROW (w->current_matrix, XFASTINT (WGET (w, window_end_vpos)));
   if (MATRIX_ROW_DISPLAYS_TEXT_P (row)
       && ((last_changed_charpos < CHARPOS (start)
           && CHARPOS (start) == BEGV)
@@ -17262,7 +17261,7 @@ try_window_id (struct window *w)
 
       /* Compute how many chars/bytes have been added to or removed
         from the buffer.  */
-      Z_old = MATRIX_ROW_END_CHARPOS (row) + XFASTINT (WVAR (w, window_end_pos));
+      Z_old = MATRIX_ROW_END_CHARPOS (row) + XFASTINT (WGET (w, window_end_pos));
       Z_BYTE_old = MATRIX_ROW_END_BYTEPOS (row) + w->window_end_bytepos;
       Z_delta = Z - Z_old;
       Z_delta_bytes = Z_BYTE - Z_BYTE_old;
@@ -17333,8 +17332,8 @@ try_window_id (struct window *w)
        {
          /* We have to compute the window end anew since text
             could have been added/removed after it.  */
-         WVAR (w, window_end_pos)
-           = make_number (Z - MATRIX_ROW_END_CHARPOS (row));
+         WSET (w, window_end_pos,
+               make_number (Z - MATRIX_ROW_END_CHARPOS (row)));
          w->window_end_bytepos
            = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row);
 
@@ -17369,7 +17368,7 @@ try_window_id (struct window *w)
 
   /* Give up if the window ends in strings.  Overlay strings
      at the end are difficult to handle, so don't try.  */
-  row = MATRIX_ROW (current_matrix, XFASTINT (WVAR (w, window_end_vpos)));
+  row = MATRIX_ROW (current_matrix, XFASTINT (WGET (w, window_end_vpos)));
   if (MATRIX_ROW_START_CHARPOS (row) == MATRIX_ROW_END_CHARPOS (row))
     GIVE_UP (20);
 
@@ -17712,7 +17711,7 @@ try_window_id (struct window *w)
       /* Set last_row to the glyph row in the current matrix where the
         window end line is found.  It has been moved up or down in
         the matrix by dvpos.  */
-      int last_vpos = XFASTINT (WVAR (w, window_end_vpos)) + dvpos;
+      int last_vpos = XFASTINT (WGET (w, window_end_vpos)) + dvpos;
       struct glyph_row *last_row = MATRIX_ROW (current_matrix, last_vpos);
 
       /* If last_row is the window end line, it should display text.  */
@@ -17768,21 +17767,21 @@ try_window_id (struct window *w)
                                           first_unchanged_at_end_row);
       eassert (row && MATRIX_ROW_DISPLAYS_TEXT_P (row));
 
-      WVAR (w, window_end_pos) = make_number (Z - MATRIX_ROW_END_CHARPOS (row));
+      WSET (w, window_end_pos, make_number (Z - MATRIX_ROW_END_CHARPOS (row)));
       w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row);
-      WVAR (w, window_end_vpos)
-       = make_number (MATRIX_ROW_VPOS (row, w->current_matrix));
+      WSET (w, window_end_vpos,
+           make_number (MATRIX_ROW_VPOS (row, w->current_matrix)));
       eassert (w->window_end_bytepos >= 0);
       IF_DEBUG (debug_method_add (w, "A"));
     }
   else if (last_text_row_at_end)
     {
-      WVAR (w, window_end_pos)
-       = make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row_at_end));
+      WSET (w, window_end_pos,
+           make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row_at_end)));
       w->window_end_bytepos
        = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row_at_end);
-      WVAR (w, window_end_vpos)
-       = make_number (MATRIX_ROW_VPOS (last_text_row_at_end, desired_matrix));
+      WSET (w, window_end_vpos,
+           make_number (MATRIX_ROW_VPOS (last_text_row_at_end, desired_matrix)));
       eassert (w->window_end_bytepos >= 0);
       IF_DEBUG (debug_method_add (w, "B"));
     }
@@ -17791,12 +17790,12 @@ try_window_id (struct window *w)
       /* We have displayed either to the end of the window or at the
         end of the window, i.e. the last row with text is to be found
         in the desired matrix.  */
-      WVAR (w, window_end_pos)
-       = make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row));
+      WSET (w, window_end_pos,
+           make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row)));
       w->window_end_bytepos
        = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row);
-      WVAR (w, window_end_vpos)
-       = make_number (MATRIX_ROW_VPOS (last_text_row, desired_matrix));
+      WSET (w, window_end_vpos,
+           make_number (MATRIX_ROW_VPOS (last_text_row, desired_matrix)));
       eassert (w->window_end_bytepos >= 0);
     }
   else if (first_unchanged_at_end_row == NULL
@@ -17806,7 +17805,7 @@ try_window_id (struct window *w)
       /* Displayed to end of window, but no line containing text was
         displayed.  Lines were deleted at the end of the window.  */
       int first_vpos = WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0;
-      int vpos = XFASTINT (WVAR (w, window_end_vpos));
+      int vpos = XFASTINT (WGET (w, window_end_vpos));
       struct glyph_row *current_row = current_matrix->rows + vpos;
       struct glyph_row *desired_row = desired_matrix->rows + vpos;
 
@@ -17824,8 +17823,8 @@ try_window_id (struct window *w)
        }
 
       eassert (row != NULL);
-      WVAR (w, window_end_vpos) = make_number (vpos + 1);
-      WVAR (w, window_end_pos) = make_number (Z - MATRIX_ROW_END_CHARPOS (row));
+      WSET (w, window_end_vpos, make_number (vpos + 1));
+      WSET (w, window_end_pos, make_number (Z - MATRIX_ROW_END_CHARPOS (row)));
       w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row);
       eassert (w->window_end_bytepos >= 0);
       IF_DEBUG (debug_method_add (w, "C"));
@@ -17833,11 +17832,11 @@ try_window_id (struct window *w)
   else
     abort ();
 
-  IF_DEBUG (debug_end_pos = XFASTINT (WVAR (w, window_end_pos));
-           debug_end_vpos = XFASTINT (WVAR (w, window_end_vpos)));
+  IF_DEBUG (debug_end_pos = XFASTINT (WGET (w, window_end_pos));
+           debug_end_vpos = XFASTINT (WGET (w, window_end_vpos)));
 
   /* Record that display has not been completed.  */
-  WVAR (w, window_end_valid) = Qnil;
+  WSET (w, window_end_valid, Qnil);
   w->desired_matrix->no_scrolling_p = 1;
   return 3;
 
@@ -18067,7 +18066,7 @@ glyphs in short form, otherwise show glyphs in long form.  */)
   (Lisp_Object glyphs)
 {
   struct window *w = XWINDOW (selected_window);
-  struct buffer *buffer = XBUFFER (WVAR (w, buffer));
+  struct buffer *buffer = XBUFFER (WGET (w, buffer));
 
   fprintf (stderr, "PT = %"pI"d, BEGV = %"pI"d. ZV = %"pI"d\n",
           BUF_PT (buffer), BUF_BEGV (buffer), BUF_ZV (buffer));
@@ -18173,7 +18172,7 @@ static struct glyph_row *
 get_overlay_arrow_glyph_row (struct window *w, Lisp_Object overlay_arrow_string)
 {
   struct frame *f = XFRAME (WINDOW_FRAME (w));
-  struct buffer *buffer = XBUFFER (WVAR (w, buffer));
+  struct buffer *buffer = XBUFFER (WGET (w, buffer));
   struct buffer *old = current_buffer;
   const unsigned char *arrow_string = SDATA (overlay_arrow_string);
   int arrow_len = SCHARS (overlay_arrow_string);
@@ -19250,7 +19249,7 @@ display_line (struct it *it)
     }
 
   /* Is IT->w showing the region?  */
-  WVAR (it->w, region_showing) = it->region_beg_charpos > 0 ? Qt : Qnil;
+  WSET (it->w, region_showing, it->region_beg_charpos > 0 ? Qt : Qnil);
 
   /* Clear the result glyph row and enable it.  */
   prepare_desired_row (row);
@@ -19365,7 +19364,7 @@ display_line (struct it *it)
              row->glyphs[TEXT_AREA]->charpos = -1;
              row->displays_text_p = 0;
 
-             if (!NILP (BVAR (XBUFFER (WVAR (it->w, buffer)), indicate_empty_lines))
+             if (!NILP (BVAR (XBUFFER (WGET (it->w, buffer)), indicate_empty_lines))
                  && (!MINI_WINDOW_P (it->w)
                      || (minibuf_level && EQ (it->window, minibuf_window))))
                row->indicate_empty_line_p = 1;
@@ -20188,12 +20187,12 @@ redisplay_mode_lines (Lisp_Object window, int force)
     {
       struct window *w = XWINDOW (window);
 
-      if (WINDOWP (WVAR (w, hchild)))
-       nwindows += redisplay_mode_lines (WVAR (w, hchild), force);
-      else if (WINDOWP (WVAR (w, vchild)))
-       nwindows += redisplay_mode_lines (WVAR (w, vchild), force);
+      if (WINDOWP (WGET (w, hchild)))
+       nwindows += redisplay_mode_lines (WGET (w, hchild), force);
+      else if (WINDOWP (WGET (w, vchild)))
+       nwindows += redisplay_mode_lines (WGET (w, vchild), force);
       else if (force
-              || FRAME_GARBAGED_P (XFRAME (WVAR (w, frame)))
+              || FRAME_GARBAGED_P (XFRAME (WGET (w, frame)))
               || !MATRIX_MODE_LINE_ROW (w->current_matrix)->enabled_p)
        {
          struct text_pos lpoint;
@@ -20201,7 +20200,7 @@ redisplay_mode_lines (Lisp_Object window, int force)
 
          /* Set the window's buffer for the mode line display.  */
          SET_TEXT_POS (lpoint, PT, PT_BYTE);
-         set_buffer_internal_1 (XBUFFER (WVAR (w, buffer)));
+         set_buffer_internal_1 (XBUFFER (WGET (w, buffer)));
 
          /* Point refers normally to the selected window.  For any
             other window, set up appropriate value.  */
@@ -20209,7 +20208,7 @@ redisplay_mode_lines (Lisp_Object window, int force)
            {
              struct text_pos pt;
 
-             SET_TEXT_POS_FROM_MARKER (pt, WVAR (w, pointm));
+             SET_TEXT_POS_FROM_MARKER (pt, WGET (w, pointm));
              if (CHARPOS (pt) < BEGV)
                TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE);
              else if (CHARPOS (pt) > (ZV - 1))
@@ -20231,7 +20230,7 @@ redisplay_mode_lines (Lisp_Object window, int force)
          TEMP_SET_PT_BOTH (CHARPOS (lpoint), BYTEPOS (lpoint));
        }
 
-      window = WVAR (w, next);
+      window = WGET (w, next);
     }
 
   return nwindows;
@@ -20248,13 +20247,13 @@ display_mode_lines (struct window *w)
   int n = 0;
 
   old_selected_frame = selected_frame;
-  selected_frame = WVAR (w, frame);
+  selected_frame = WGET (w, frame);
   old_selected_window = selected_window;
   XSETWINDOW (selected_window, w);
 
   /* These will be set while the mode line specs are processed.  */
   line_number_displayed = 0;
-  WVAR (w, column_number_displayed) = Qnil;
+  WSET (w, column_number_displayed, Qnil);
 
   if (WINDOW_WANTS_MODELINE_P (w))
     {
@@ -20984,7 +20983,7 @@ are the selected window and the WINDOW's buffer).  */)
   w = XWINDOW (window);
 
   if (NILP (buffer))
-    buffer = WVAR (w, buffer);
+    buffer = WGET (w, buffer);
   CHECK_BUFFER (buffer);
 
   /* Make formatting the modeline a non-op when noninteractive, otherwise
@@ -21390,7 +21389,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
       else
        {
          ptrdiff_t col = current_column ();
-         WVAR (w, column_number_displayed) = make_number (col);
+         WSET (w, column_number_displayed, make_number (col));
          pint2str (decode_mode_spec_buf, field_width, col);
          return decode_mode_spec_buf;
        }
@@ -21443,33 +21442,33 @@ decode_mode_spec (struct window *w, register int c, int field_width,
        if (mode_line_target == MODE_LINE_TITLE)
          return "";
 
-       startpos = XMARKER (WVAR (w, start))->charpos;
-       startpos_byte = marker_byte_position (WVAR (w, start));
+       startpos = XMARKER (WGET (w, start))->charpos;
+       startpos_byte = marker_byte_position (WGET (w, start));
        height = WINDOW_TOTAL_LINES (w);
 
        /* If we decided that this buffer isn't suitable for line numbers,
           don't forget that too fast.  */
-       if (EQ (WVAR (w, base_line_pos), WVAR (w, buffer)))
+       if (EQ (WGET (w, base_line_pos), WGET (w, buffer)))
          goto no_value;
        /* But do forget it, if the window shows a different buffer now.  */
-       else if (BUFFERP (WVAR (w, base_line_pos)))
-         WVAR (w, base_line_pos) = Qnil;
+       else if (BUFFERP (WGET (w, base_line_pos)))
+         WSET (w, base_line_pos, Qnil);
 
        /* If the buffer is very big, don't waste time.  */
        if (INTEGERP (Vline_number_display_limit)
            && BUF_ZV (b) - BUF_BEGV (b) > XINT (Vline_number_display_limit))
          {
-           WVAR (w, base_line_pos) = Qnil;
-           WVAR (w, base_line_number) = Qnil;
+           WSET (w, base_line_pos, Qnil);
+           WSET (w, base_line_number, Qnil);
            goto no_value;
          }
 
-       if (INTEGERP (WVAR (w, base_line_number))
-           && INTEGERP (WVAR (w, base_line_pos))
-           && XFASTINT (WVAR (w, base_line_pos)) <= startpos)
+       if (INTEGERP (WGET (w, base_line_number))
+           && INTEGERP (WGET (w, base_line_pos))
+           && XFASTINT (WGET (w, base_line_pos)) <= startpos)
          {
-           line = XFASTINT (WVAR (w, base_line_number));
-           linepos = XFASTINT (WVAR (w, base_line_pos));
+           line = XFASTINT (WGET (w, base_line_number));
+           linepos = XFASTINT (WGET (w, base_line_pos));
            linepos_byte = buf_charpos_to_bytepos (b, linepos);
          }
        else
@@ -21492,8 +21491,8 @@ decode_mode_spec (struct window *w, register int c, int field_width,
           go back past it.  */
        if (startpos == BUF_BEGV (b))
          {
-           WVAR (w, base_line_number) = make_number (topline);
-           WVAR (w, base_line_pos) = make_number (BUF_BEGV (b));
+           WSET (w, base_line_number, make_number (topline));
+           WSET (w, base_line_pos, make_number (BUF_BEGV (b)));
          }
        else if (nlines < height + 25 || nlines > height * 3 + 50
                 || linepos == BUF_BEGV (b))
@@ -21519,13 +21518,13 @@ decode_mode_spec (struct window *w, register int c, int field_width,
               give up on line numbers for this window.  */
            if (position == limit_byte && limit == startpos - distance)
              {
-               WVAR (w, base_line_pos) = WVAR (w, buffer);
-               WVAR (w, base_line_number) = Qnil;
+               WSET (w, base_line_pos, WGET (w, buffer));
+               WSET (w, base_line_number, Qnil);
                goto no_value;
              }
 
-           WVAR (w, base_line_number) = make_number (topline - nlines);
-           WVAR (w, base_line_pos) = make_number (BYTE_TO_CHAR (position));
+           WSET (w, base_line_number, make_number (topline - nlines));
+           WSET (w, base_line_pos, make_number (BYTE_TO_CHAR (position)));
          }
 
        /* Now count lines from the start pos to point.  */
@@ -21563,10 +21562,10 @@ decode_mode_spec (struct window *w, register int c, int field_width,
 
     case 'p':
       {
-       ptrdiff_t pos = marker_position (WVAR (w, start));
+       ptrdiff_t pos = marker_position (WGET (w, start));
        ptrdiff_t total = BUF_ZV (b) - BUF_BEGV (b);
 
-       if (XFASTINT (WVAR (w, window_end_pos)) <= BUF_Z (b) - BUF_ZV (b))
+       if (XFASTINT (WGET (w, window_end_pos)) <= BUF_Z (b) - BUF_ZV (b))
          {
            if (pos <= BUF_BEGV (b))
              return "All";
@@ -21594,8 +21593,8 @@ decode_mode_spec (struct window *w, register int c, int field_width,
       /* Display percentage of size above the bottom of the screen.  */
     case 'P':
       {
-       ptrdiff_t toppos = marker_position (WVAR (w, start));
-       ptrdiff_t botpos = BUF_Z (b) - XFASTINT (WVAR (w, window_end_pos));
+       ptrdiff_t toppos = marker_position (WGET (w, start));
+       ptrdiff_t botpos = BUF_Z (b) - XFASTINT (WGET (w, window_end_pos));
        ptrdiff_t total = BUF_ZV (b) - BUF_BEGV (b);
 
        if (botpos >= BUF_ZV (b))
@@ -22302,7 +22301,7 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
            return OK_PIXELS (WINDOW_SCROLL_BAR_AREA_WIDTH (it->w));
        }
 
-      prop = buffer_local_value_1 (prop, WVAR (it->w, buffer));
+      prop = buffer_local_value_1 (prop, WGET (it->w, buffer));
       if (EQ (prop, Qunbound))
        prop = Qnil;
     }
@@ -22354,7 +22353,7 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
              return OK_PIXELS (pixels);
            }
 
-         car = buffer_local_value_1 (car, WVAR (it->w, buffer));
+         car = buffer_local_value_1 (car, WGET (it->w, buffer));
          if (EQ (car, Qunbound))
            car = Qnil;
        }
@@ -22435,7 +22434,7 @@ init_glyph_string (struct glyph_string *s,
 {
   memset (s, 0, sizeof *s);
   s->w = w;
-  s->f = XFRAME (WVAR (w, frame));
+  s->f = XFRAME (WGET (w, frame));
 #ifdef HAVE_NTGUI
   s->hdc = hdc;
 #endif
@@ -22767,7 +22766,7 @@ fill_glyph_string (struct glyph_string *s, int face_id,
   int voffset;
   int glyph_not_available_p;
 
-  eassert (s->f == XFRAME (WVAR (s->w, frame)));
+  eassert (s->f == XFRAME (WGET (s->w, frame)));
   eassert (s->nchars == 0);
   eassert (start >= 0 && end > start);
 
@@ -24162,7 +24161,7 @@ produce_stretch_glyph (struct it *it)
       int n = width;
 
       if (!STRINGP (object))
-       object = WVAR (it->w, buffer);
+       object = WGET (it->w, buffer);
 #ifdef HAVE_WINDOW_SYSTEM
       if (FRAME_WINDOW_P (it->f))
        append_stretch_glyph (it, object, width, height, ascent);
@@ -25389,7 +25388,7 @@ x_clear_end_of_line (int to_x)
   int from_x, from_y, to_y;
 
   eassert (updated_window && updated_row);
-  f = XFRAME (WVAR (w, frame));
+  f = XFRAME (WGET (w, frame));
 
   if (updated_row->full_width_p)
     max_x = WINDOW_TOTAL_WIDTH (w);
@@ -25547,8 +25546,8 @@ static enum text_cursor_kinds
 get_window_cursor_type (struct window *w, struct glyph *glyph, int *width,
                        int *active_cursor)
 {
-  struct frame *f = XFRAME (WVAR (w, frame));
-  struct buffer *b = XBUFFER (WVAR (w, buffer));
+  struct frame *f = XFRAME (WGET (w, frame));
+  struct buffer *b = XBUFFER (WGET (w, buffer));
   int cursor_type = DEFAULT_CURSOR;
   Lisp_Object alt_cursor;
   int non_selected = 0;
@@ -25859,7 +25858,7 @@ draw_phys_cursor_glyph (struct window *w, struct glyph_row *row,
 void
 erase_phys_cursor (struct window *w)
 {
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
   Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
   int hpos = w->phys_cursor.hpos;
   int vpos = w->phys_cursor.vpos;
@@ -25978,7 +25977,7 @@ void
 display_and_set_cursor (struct window *w, int on,
                        int hpos, int vpos, int x, int y)
 {
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
   int new_cursor_type;
   int new_cursor_width;
   int active_cursor;
@@ -26099,14 +26098,14 @@ update_cursor_in_window_tree (struct window *w, int on_p)
 {
   while (w)
     {
-      if (!NILP (WVAR (w, hchild)))
-       update_cursor_in_window_tree (XWINDOW (WVAR (w, hchild)), on_p);
-      else if (!NILP (WVAR (w, vchild)))
-       update_cursor_in_window_tree (XWINDOW (WVAR (w, vchild)), on_p);
+      if (!NILP (WGET (w, hchild)))
+       update_cursor_in_window_tree (XWINDOW (WGET (w, hchild)), on_p);
+      else if (!NILP (WGET (w, vchild)))
+       update_cursor_in_window_tree (XWINDOW (WGET (w, vchild)), on_p);
       else
        update_window_cursor (w, on_p);
 
-      w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next));
+      w = NILP (WGET (w, next)) ? 0 : XWINDOW (WGET (w, next));
     }
 }
 
@@ -26130,7 +26129,7 @@ x_update_cursor (struct frame *f, int on_p)
 void
 x_clear_cursor (struct window *w)
 {
-  if (FRAME_VISIBLE_P (XFRAME (WVAR (w, frame))) && w->phys_cursor_on_p)
+  if (FRAME_VISIBLE_P (XFRAME (WGET (w, frame))) && w->phys_cursor_on_p)
     update_window_cursor (w, 0);
 }
 
@@ -26144,7 +26143,7 @@ draw_row_with_mouse_face (struct window *w, int start_x, struct glyph_row *row,
                          enum draw_glyphs_face draw)
 {
 #ifdef HAVE_WINDOW_SYSTEM
-  if (FRAME_WINDOW_P (XFRAME (WVAR (w, frame))))
+  if (FRAME_WINDOW_P (XFRAME (WGET (w, frame))))
     {
       draw_glyphs (w, start_x, row, TEXT_AREA, start_hpos, end_hpos, draw, 0);
       return;
@@ -26315,7 +26314,7 @@ clear_mouse_face (Mouse_HLInfo *hlinfo)
 static int
 coords_in_mouse_face_p (struct window *w, int hpos, int vpos)
 {
-  Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (WVAR (w, frame)));
+  Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (WGET (w, frame)));
 
   /* Quickly resolve the easy cases.  */
   if (!(WINDOWP (hlinfo->mouse_face_window)
@@ -26567,7 +26566,7 @@ mouse_face_from_buffer_pos (Lisp_Object window,
   /* Find the rows corresponding to START_CHARPOS and END_CHARPOS.  */
   rows_from_pos_range (w, start_charpos, end_charpos, disp_string, &r1, &r2);
   if (r1 == NULL)
-    r1 = MATRIX_ROW (w->current_matrix, XFASTINT (WVAR (w, window_end_vpos)));
+    r1 = MATRIX_ROW (w->current_matrix, XFASTINT (WGET (w, window_end_vpos)));
   /* If the before-string or display-string contains newlines,
      rows_from_pos_range skips to its last row.  Move back.  */
   if (!NILP (before_string) || !NILP (disp_string))
@@ -26589,7 +26588,7 @@ mouse_face_from_buffer_pos (Lisp_Object window,
     }
   if (r2 == NULL)
     {
-      r2 = MATRIX_ROW (w->current_matrix, XFASTINT (WVAR (w, window_end_vpos)));
+      r2 = MATRIX_ROW (w->current_matrix, XFASTINT (WGET (w, window_end_vpos)));
       hlinfo->mouse_face_past_end = 1;
     }
   else if (!NILP (after_string))
@@ -26597,7 +26596,7 @@ mouse_face_from_buffer_pos (Lisp_Object window,
       /* If the after-string has newlines, advance to its last row.  */
       struct glyph_row *next;
       struct glyph_row *last
-       = MATRIX_ROW (w->current_matrix, XFASTINT (WVAR (w, window_end_vpos)));
+       = MATRIX_ROW (w->current_matrix, XFASTINT (WGET (w, window_end_vpos)));
 
       for (next = r2 + 1;
           next <= last
@@ -27262,7 +27261,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
                                    enum window_part area)
 {
   struct window *w = XWINDOW (window);
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
   Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
 #ifdef HAVE_WINDOW_SYSTEM
   Display_Info *dpyinfo;
@@ -27346,7 +27345,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
                {
                  help_echo_string = help;
                  XSETWINDOW (help_echo_window, w);
-                 help_echo_object = WVAR (w, buffer);
+                 help_echo_object = WGET (w, buffer);
                  help_echo_pos = charpos;
                }
            }
@@ -27382,7 +27381,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
            {
              Lisp_Object default_help
                = buffer_local_value_1 (Qmode_line_default_help_echo,
-                                       WVAR (w, buffer));
+                                       WGET (w, buffer));
 
              if (STRINGP (default_help))
                {
@@ -27663,9 +27662,9 @@ note_mouse_highlight (struct frame *f, int x, int y)
 
   /* Are we in a window whose display is up to date?
      And verify the buffer's text has not changed.  */
-  b = XBUFFER (WVAR (w, buffer));
+  b = XBUFFER (WGET (w, buffer));
   if (part == ON_TEXT
-      && EQ (WVAR (w, window_end_valid), WVAR (w, buffer))
+      && EQ (WGET (w, window_end_valid), WGET (w, buffer))
       && w->last_modified == BUF_MODIFF (b)
       && w->last_overlay_modified == BUF_OVERLAY_MODIFF (b))
     {
@@ -27872,8 +27871,8 @@ note_mouse_highlight (struct frame *f, int x, int y)
                  if (pos > 0)
                    {
                      mouse_face = get_char_property_and_overlay
-                       (make_number (pos), Qmouse_face, WVAR (w, buffer), &overlay);
-                     buffer = WVAR (w, buffer);
+                       (make_number (pos), Qmouse_face, WGET (w, buffer), &overlay);
+                     buffer = WGET (w, buffer);
                      disp_string = object;
                    }
                }
@@ -27899,12 +27898,12 @@ note_mouse_highlight (struct frame *f, int x, int y)
                     is the smallest.  */
                  Lisp_Object lim1 =
                    NILP (BVAR (XBUFFER (buffer), bidi_display_reordering))
-                   ? Fmarker_position (WVAR (w, start))
+                   ? Fmarker_position (WGET (w, start))
                    : Qnil;
                  Lisp_Object lim2 =
                    NILP (BVAR (XBUFFER (buffer), bidi_display_reordering))
                    ? make_number (BUF_Z (XBUFFER (buffer))
-                                  - XFASTINT (WVAR (w, window_end_pos)))
+                                  - XFASTINT (WGET (w, window_end_pos)))
                    : Qnil;
 
                  if (NILP (overlay))
@@ -27986,11 +27985,11 @@ note_mouse_highlight (struct frame *f, int x, int y)
                    if (p > 0)
                      {
                        help = Fget_char_property (make_number (p),
-                                                  Qhelp_echo, WVAR (w, buffer));
+                                                  Qhelp_echo, WGET (w, buffer));
                        if (!NILP (help))
                          {
                            charpos = p;
-                           obj = WVAR (w, buffer);
+                           obj = WGET (w, buffer);
                          }
                      }
                  }
@@ -28041,7 +28040,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
                      ptrdiff_t p = string_buffer_position (obj, start);
                      if (p > 0)
                        pointer = Fget_char_property (make_number (p),
-                                                     Qpointer, WVAR (w, buffer));
+                                                     Qpointer, WGET (w, buffer));
                    }
                }
              else if (BUFFERP (obj)
@@ -28079,7 +28078,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
 void
 x_clear_window_mouse_face (struct window *w)
 {
-  Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (WVAR (w, frame)));
+  Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (WGET (w, frame)));
   Lisp_Object window;
 
   BLOCK_INPUT;
@@ -28101,7 +28100,7 @@ cancel_mouse_face (struct frame *f)
   Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
 
   window = hlinfo->mouse_face_window;
-  if (! NILP (window) && XFRAME (WVAR (XWINDOW (window), frame)) == f)
+  if (! NILP (window) && XFRAME (WGET (XWINDOW (window), frame)) == f)
     {
       hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
       hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
@@ -28295,7 +28294,7 @@ x_draw_vertical_border (struct window *w)
      do it for frames with vertical scroll bars because either the
      right scroll bar of a window, or the left scroll bar of its
      neighbor will suffice as a border.  */
-  if (FRAME_HAS_VERTICAL_SCROLL_BARS (XFRAME (WVAR (w, frame))))
+  if (FRAME_HAS_VERTICAL_SCROLL_BARS (XFRAME (WGET (w, frame))))
     return;
 
   if (!WINDOW_RIGHTMOST_P (w)
@@ -28335,7 +28334,7 @@ x_draw_vertical_border (struct window *w)
 static int
 expose_window (struct window *w, XRectangle *fr)
 {
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
   XRectangle wr, r;
   int mouse_face_overwritten_p = 0;
 
@@ -28476,21 +28475,21 @@ expose_window (struct window *w, XRectangle *fr)
 static int
 expose_window_tree (struct window *w, XRectangle *r)
 {
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
   int mouse_face_overwritten_p = 0;
 
   while (w && !FRAME_GARBAGED_P (f))
     {
-      if (!NILP (WVAR (w, hchild)))
+      if (!NILP (WGET (w, hchild)))
        mouse_face_overwritten_p
-         |= expose_window_tree (XWINDOW (WVAR (w, hchild)), r);
-      else if (!NILP (WVAR (w, vchild)))
+         |= expose_window_tree (XWINDOW (WGET (w, hchild)), r);
+      else if (!NILP (WGET (w, vchild)))
        mouse_face_overwritten_p
-         |= expose_window_tree (XWINDOW (WVAR (w, vchild)), r);
+         |= expose_window_tree (XWINDOW (WGET (w, vchild)), r);
       else
        mouse_face_overwritten_p |= expose_window (w, r);
 
-      w = NILP (WVAR (w, next)) ? NULL : XWINDOW (WVAR (w, next));
+      w = NILP (WGET (w, next)) ? NULL : XWINDOW (WGET (w, next));
     }
 
   return mouse_face_overwritten_p;
@@ -29282,7 +29281,7 @@ init_xdisp (void)
   if (!noninteractive)
     {
       struct window *m = XWINDOW (minibuf_window);
-      Lisp_Object frame = WVAR (m, frame);
+      Lisp_Object frame = WGET (m, frame);
       struct frame *f = XFRAME (frame);
       Lisp_Object root = FRAME_ROOT_WINDOW (f);
       struct window *r = XWINDOW (root);
@@ -29290,12 +29289,12 @@ init_xdisp (void)
 
       echo_area_window = minibuf_window;
 
-      XSETFASTINT (WVAR (r, top_line), FRAME_TOP_MARGIN (f));
-      XSETFASTINT (WVAR (r, total_lines), FRAME_LINES (f) - 1 - FRAME_TOP_MARGIN (f));
-      XSETFASTINT (WVAR (r, total_cols), FRAME_COLS (f));
-      XSETFASTINT (WVAR (m, top_line), FRAME_LINES (f) - 1);
-      XSETFASTINT (WVAR (m, total_lines), 1);
-      XSETFASTINT (WVAR (m, total_cols), FRAME_COLS (f));
+      WSET (r, top_line, make_number (FRAME_TOP_MARGIN (f)));
+      WSET (r, total_lines, make_number (FRAME_LINES (f) - 1 - FRAME_TOP_MARGIN (f)));
+      WSET (r, total_cols, make_number (FRAME_COLS (f)));
+      WSET (m, top_line, make_number (FRAME_LINES (f) - 1));
+      WSET (m, total_lines, make_number (1));
+      WSET (m, total_cols, make_number (FRAME_COLS (f)));
 
       scratch_glyph_row.glyphs[TEXT_AREA] = scratch_glyphs;
       scratch_glyph_row.glyphs[TEXT_AREA + 1]
index bdee8fd..ff9df49 100644 (file)
@@ -6033,7 +6033,7 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos,
                         ptrdiff_t *endptr, ptrdiff_t limit,
                         int mouse, int base_face_id)
 {
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
   Lisp_Object attrs[LFACE_VECTOR_SIZE];
   Lisp_Object prop, position;
   ptrdiff_t i, noverlays;
@@ -6055,9 +6055,9 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos,
 
   /* Get the `face' or `mouse_face' text property at POS, and
      determine the next position at which the property changes.  */
-  prop = Fget_text_property (position, propname, WVAR (w, buffer));
+  prop = Fget_text_property (position, propname, WGET (w, buffer));
   XSETFASTINT (limit1, (limit < endpos ? limit : endpos));
-  end = Fnext_single_property_change (position, propname, WVAR (w, buffer), limit1);
+  end = Fnext_single_property_change (position, propname, WGET (w, buffer), limit1);
   if (INTEGERP (end))
     endpos = XINT (end);
 
@@ -6143,7 +6143,7 @@ face_for_overlay_string (struct window *w, ptrdiff_t pos,
                         ptrdiff_t *endptr, ptrdiff_t limit,
                         int mouse, Lisp_Object overlay)
 {
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
   Lisp_Object attrs[LFACE_VECTOR_SIZE];
   Lisp_Object prop, position;
   ptrdiff_t endpos;
@@ -6163,9 +6163,9 @@ face_for_overlay_string (struct window *w, ptrdiff_t pos,
 
   /* Get the `face' or `mouse_face' text property at POS, and
      determine the next position at which the property changes.  */
-  prop = Fget_text_property (position, propname, WVAR (w, buffer));
+  prop = Fget_text_property (position, propname, WGET (w, buffer));
   XSETFASTINT (limit1, (limit < endpos ? limit : endpos));
-  end = Fnext_single_property_change (position, propname, WVAR (w, buffer), limit1);
+  end = Fnext_single_property_change (position, propname, WGET (w, buffer), limit1);
   if (INTEGERP (end))
     endpos = XINT (end);
 
index e92b0e5..e1bfffe 100644 (file)
@@ -2260,7 +2260,7 @@ free_frame_xic (struct frame *f)
 void
 xic_set_preeditarea (struct window *w, int x, int y)
 {
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
   XVaNestedList attr;
   XPoint spot;
 
@@ -5069,28 +5069,29 @@ Text larger than the specified size is clipped.  */)
 
   /* Set up the frame's root window.  */
   w = XWINDOW (FRAME_ROOT_WINDOW (f));
-  WVAR (w, left_col) = WVAR (w, top_line) = make_number (0);
+  WSET (w, left_col, make_number (0));
+  WSET (w, top_line, make_number (0));
 
   if (CONSP (Vx_max_tooltip_size)
       && RANGED_INTEGERP (1, XCAR (Vx_max_tooltip_size), INT_MAX)
       && RANGED_INTEGERP (1, XCDR (Vx_max_tooltip_size), INT_MAX))
     {
-      WVAR (w, total_cols) = XCAR (Vx_max_tooltip_size);
-      WVAR (w, total_lines) = XCDR (Vx_max_tooltip_size);
+      WSET (w, total_cols, XCAR (Vx_max_tooltip_size));
+      WSET (w, total_lines, XCDR (Vx_max_tooltip_size));
     }
   else
     {
-      WVAR (w, total_cols) = make_number (80);
-      WVAR (w, total_lines) = make_number (40);
+      WSET (w, total_cols, make_number (80));
+      WSET (w, total_lines, make_number (40));
     }
 
-  FRAME_TOTAL_COLS (f) = XINT (WVAR (w, total_cols));
+  FRAME_TOTAL_COLS (f) = XINT (WGET (w, total_cols));
   adjust_glyphs (f);
   w->pseudo_window_p = 1;
 
   /* Display the tooltip text in a temporary buffer.  */
   old_buffer = current_buffer;
-  set_buffer_internal_1 (XBUFFER (WVAR (XWINDOW (FRAME_ROOT_WINDOW (f)), buffer)));
+  set_buffer_internal_1 (XBUFFER (WGET (XWINDOW (FRAME_ROOT_WINDOW (f)), buffer)));
   BVAR (current_buffer, truncate_lines) = Qnil;
   clear_glyph_matrix (w->desired_matrix);
   clear_glyph_matrix (w->current_matrix);
@@ -5151,7 +5152,7 @@ Text larger than the specified size is clipped.  */)
       /* w->total_cols and FRAME_TOTAL_COLS want the width in columns,
         not in pixels.  */
       width /= WINDOW_FRAME_COLUMN_WIDTH (w);
-      WVAR (w, total_cols) = make_number (width);
+      WSET (w, total_cols, make_number (width));
       FRAME_TOTAL_COLS (f) = width;
       adjust_glyphs (f);
       clear_glyph_matrix (w->desired_matrix);
index 17d493b..23f96dc 100644 (file)
@@ -985,7 +985,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
       if (! menubar_widget)
        previous_menu_items_used = 0;
 
-      buffer = WVAR (XWINDOW (FRAME_SELECTED_WINDOW (f)), buffer);
+      buffer = WGET (XWINDOW (FRAME_SELECTED_WINDOW (f)), buffer);
       specbind (Qinhibit_quit, Qt);
       /* Don't let the debugger step into this code
         because it is not reentrant.  */
@@ -2575,7 +2575,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
 /* Detect if a dialog or menu has been posted.  MSDOS has its own
    implementation on msdos.c.  */
 
-int
+int ATTRIBUTE_CONST
 popup_activated (void)
 {
   return popup_activated_flag;
index ea74c2c..771b68e 100644 (file)
@@ -628,7 +628,7 @@ x_draw_vertical_window_border (struct window *w, int x, int y0, int y1)
 static void
 x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritten_p)
 {
-  Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (WVAR (w, frame)));
+  Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (WGET (w, frame)));
 
   if (!w->pseudo_window_p)
     {
@@ -728,7 +728,7 @@ x_after_update_window_line (struct glyph_row *desired_row)
      overhead is very small.  */
   if (windows_or_buffers_changed
       && desired_row->full_width_p
-      && (f = XFRAME (WVAR (w, frame)),
+      && (f = XFRAME (WGET (w, frame)),
          width = FRAME_INTERNAL_BORDER_WIDTH (f),
          width != 0)
       && (height = desired_row->visible_height,
@@ -3295,7 +3295,7 @@ x_ins_del_lines (struct frame *f, int vpos, int n)
 static void
 x_scroll_run (struct window *w, struct run *run)
 {
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
   int x, y, width, height, from_y, to_y, bottom_y;
 
   /* 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,
                               scroll_bar_end_scroll, 0, 0);
       w = XWINDOW (window_being_scrolled);
 
-      if (!NILP (XSCROLL_BAR (WVAR (w, vertical_scroll_bar))->dragging))
+      if (!NILP (XSCROLL_BAR (WGET (w, vertical_scroll_bar))->dragging))
        {
-         XSCROLL_BAR (WVAR (w, vertical_scroll_bar))->dragging = Qnil;
+         XSCROLL_BAR (WGET (w, vertical_scroll_bar))->dragging = Qnil;
          /* The thumb size is incorrect while dragging: fix it.  */
          set_vertical_scroll_bar (w);
        }
@@ -4277,7 +4277,7 @@ x_send_scroll_bar_event (Lisp_Object window, int part, int portion, int whole)
   XEvent event;
   XClientMessageEvent *ev = (XClientMessageEvent *) &event;
   struct window *w = XWINDOW (window);
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
   ptrdiff_t i;
 
   BLOCK_INPUT;
@@ -4353,7 +4353,7 @@ x_scroll_bar_to_input_event (XEvent *event, struct input_event *ievent)
   ievent->timestamp = CurrentTime;
 #else
   ievent->timestamp =
-    XtLastTimestampProcessed (FRAME_X_DISPLAY (XFRAME (WVAR (w, frame))));
+    XtLastTimestampProcessed (FRAME_X_DISPLAY (XFRAME (WGET (w, frame))));
 #endif
   ievent->part = ev->data.l[1];
   ievent->code = ev->data.l[2];
@@ -4954,7 +4954,7 @@ x_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion, int positio
 static struct scroll_bar *
 x_scroll_bar_create (struct window *w, int top, int left, int width, int height)
 {
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
   struct scroll_bar *bar
     = ALLOCATE_PSEUDOVECTOR (struct scroll_bar, x_window, PVEC_OTHER);
   Lisp_Object barobj;
@@ -5182,7 +5182,7 @@ x_scroll_bar_remove (struct scroll_bar *bar)
 #endif
 
   /* Dissociate this scroll bar from its window.  */
-  WVAR (XWINDOW (bar->window), vertical_scroll_bar) = Qnil;
+  WSET (XWINDOW (bar->window), vertical_scroll_bar, Qnil);
 
   UNBLOCK_INPUT;
 }
@@ -5196,7 +5196,8 @@ x_scroll_bar_remove (struct scroll_bar *bar)
 static void
 XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int position)
 {
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
+  Lisp_Object barobj;
   struct scroll_bar *bar;
   int top, height, left, sb_left, width, sb_width;
   int window_y, window_height;
@@ -5247,7 +5248,7 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio
 #endif
 
   /* Does the scroll bar exist yet?  */
-  if (NILP (WVAR (w, vertical_scroll_bar)))
+  if (NILP (WGET (w, vertical_scroll_bar)))
     {
       if (width > 0 && height > 0)
        {
@@ -5270,7 +5271,7 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio
       /* It may just need to be moved and resized.  */
       unsigned int mask = 0;
 
-      bar = XSCROLL_BAR (WVAR (w, vertical_scroll_bar));
+      bar = XSCROLL_BAR (WGET (w, vertical_scroll_bar));
 
       BLOCK_INPUT;
 
@@ -5394,7 +5395,8 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio
     }
 #endif /* not USE_TOOLKIT_SCROLL_BARS */
 
-  XSETVECTOR (WVAR (w, vertical_scroll_bar), bar);
+  XSETVECTOR (barobj, bar);
+  WSET (w, vertical_scroll_bar, barobj);
 }
 
 
@@ -5439,10 +5441,10 @@ XTredeem_scroll_bar (struct window *window)
   Lisp_Object barobj;
 
   /* We can't redeem this window's scroll bar if it doesn't have one.  */
-  if (NILP (WVAR (window, vertical_scroll_bar)))
+  if (NILP (WGET (window, vertical_scroll_bar)))
     abort ();
 
-  bar = XSCROLL_BAR (WVAR (window, vertical_scroll_bar));
+  bar = XSCROLL_BAR (WGET (window, vertical_scroll_bar));
 
   /* Unlink it from the condemned list.  */
   f = XFRAME (WINDOW_FRAME (window));
@@ -5450,11 +5452,11 @@ XTredeem_scroll_bar (struct window *window)
     {
       /* If the prev pointer is nil, it must be the first in one of
         the lists.  */
-      if (EQ (FRAME_SCROLL_BARS (f), WVAR (window, vertical_scroll_bar)))
+      if (EQ (FRAME_SCROLL_BARS (f), WGET (window, vertical_scroll_bar)))
        /* It's not condemned.  Everything's fine.  */
        return;
       else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f),
-                  WVAR (window, vertical_scroll_bar)))
+                  WGET (window, vertical_scroll_bar)))
        FSET (f, condemned_scroll_bars, bar->next);
       else
        /* If its prev pointer is nil, it must be at the front of
@@ -5614,7 +5616,7 @@ x_scroll_bar_handle_click (struct scroll_bar *bar, XEvent *event, struct input_e
 static void
 x_scroll_bar_note_movement (struct scroll_bar *bar, XEvent *event)
 {
-  FRAME_PTR f = XFRAME (WVAR (XWINDOW (bar->window), frame));
+  FRAME_PTR f = XFRAME (WGET (XWINDOW (bar->window), frame));
 
   last_mouse_movement_time = event->xmotion.time;
 
@@ -6788,8 +6790,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
                       create event iff we don't leave the
                       selected frame.  */
                    && (focus_follows_mouse
-                       || (EQ (WVAR (XWINDOW (window), frame),
-                               WVAR (XWINDOW (selected_window), frame)))))
+                       || (EQ (WGET (XWINDOW (window), frame),
+                               WGET (XWINDOW (selected_window), frame)))))
                   {
                     inev.ie.kind = SELECT_WINDOW_EVENT;
                     inev.ie.frame_or_window = window;
@@ -7338,7 +7340,7 @@ x_draw_hollow_cursor (struct window *w, struct glyph_row *row)
 static void
 x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text_cursor_kinds kind)
 {
-  struct frame *f = XFRAME (WVAR (w, frame));
+  struct frame *f = XFRAME (WGET (w, frame));
   struct glyph *cursor_glyph;
 
   /* If cursor is out of bounds, don't draw garbage.  This can happen