Separate read and write access to Lisp_Object slots of struct window.
[bpt/emacs.git] / src / window.c
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;