(intern_face): Update mask properly to set stipple
[bpt/emacs.git] / src / window.c
index cf5aa8d..a4c6d7e 100644 (file)
@@ -105,7 +105,7 @@ DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0,
   (obj)
      Lisp_Object obj;
 {
-  return XTYPE (obj) == Lisp_Window ? Qt : Qnil;
+  return WINDOWP (obj) ? Qt : Qnil;
 }
 
 DEFUN ("window-live-p", Fwindow_live_p, Swindow_live_p, 1, 1, 0,
@@ -113,9 +113,7 @@ DEFUN ("window-live-p", Fwindow_live_p, Swindow_live_p, 1, 1, 0,
      (obj)
      Lisp_Object obj;
 {
-  return ((XTYPE (obj) == Lisp_Window
-          && ! NILP (XWINDOW (obj)->buffer))
-         ? Qt : Qnil);
+  return (WINDOWP (obj) && ! NILP (XWINDOW (obj)->buffer) ? Qt : Qnil);
 }
 
 Lisp_Object
@@ -133,14 +131,17 @@ make_window ()
     Qnil);
   XSETTYPE (val, Lisp_Window);
   p = XWINDOW (val);
-  XFASTINT (p->sequence_number) = ++sequence_number;
-  XFASTINT (p->left) = XFASTINT (p->top)
-    = XFASTINT (p->height) = XFASTINT (p->width)
-      = XFASTINT (p->hscroll) = 0;
-  XFASTINT (p->last_point_x) = XFASTINT (p->last_point_y) = 0;
+  XSETFASTINT (p->sequence_number, ++sequence_number);
+  XSETFASTINT (p->left, 0);
+  XSETFASTINT (p->top, 0);
+  XSETFASTINT (p->height, 0);
+  XSETFASTINT (p->width, 0);
+  XSETFASTINT (p->hscroll, 0);
+  XSETFASTINT (p->last_point_x, 0);
+  XSETFASTINT (p->last_point_y, 0);
   p->start = Fmake_marker ();
   p->pointm = Fmake_marker ();
-  XFASTINT (p->use_time) = 0;
+  XSETFASTINT (p->use_time, 0);
   p->frame = Qnil;
   p->display_table = Qnil;
   p->dedicated = Qnil;
@@ -163,7 +164,7 @@ used by that frame.")
 {
 #ifdef MULTI_FRAME
   if (NILP (frame))
-    XSET (frame, Lisp_Frame, selected_frame);
+    XSETFRAME (frame, selected_frame);
   else
     CHECK_LIVE_FRAME (frame, 0);
 #endif
@@ -297,7 +298,7 @@ NCOL should be zero or positive.")
   register struct window *w;
 
   CHECK_NUMBER (ncol, 1);
-  if (XINT (ncol) < 0) XFASTINT (ncol) = 0;
+  if (XINT (ncol) < 0) XSETFASTINT (ncol, 0);
   if (XFASTINT (ncol) >= (1 << (SHORTBITS - 1)))
     args_out_of_range (ncol, Qnil);
   w = decode_window (window);
@@ -448,7 +449,7 @@ column 0.")
 
 #ifdef MULTI_FRAME
   if (NILP (frame))
-    XSET (frame, Lisp_Frame, selected_frame);
+    XSETFRAME (frame, selected_frame);
   else
     CHECK_LIVE_FRAME (frame, 2);
 #endif
@@ -524,8 +525,8 @@ does not update this value.")
     return Qnil;
 #endif
 
-  XSET (value, Lisp_Int,
-       BUF_Z (XBUFFER (buf)) - XFASTINT (w->window_end_pos));
+  XSETINT (value,
+          BUF_Z (XBUFFER (buf)) - XFASTINT (w->window_end_pos));
 
   return value;
 }
@@ -562,7 +563,7 @@ from overriding motion of point in order to display at this exact start.")
   if (NILP (noforce))
     w->force_start = Qt;
   w->update_mode_line = Qt;
-  XFASTINT (w->last_modified) = 0;
+  XSETFASTINT (w->last_modified, 0);
   if (!EQ (window, selected_window))
     windows_or_buffers_changed++;
   return pos;
@@ -618,13 +619,13 @@ window_display_table (w)
 {
   Lisp_Object tem;
   tem = w->display_table;
-  if (XTYPE (tem) == Lisp_Vector && XVECTOR (tem)->size == DISP_TABLE_SIZE)
+  if (VECTORP (tem) && XVECTOR (tem)->size == DISP_TABLE_SIZE)
     return XVECTOR (tem);
   tem = XBUFFER (w->buffer)->display_table;
-  if (XTYPE (tem) == Lisp_Vector && XVECTOR (tem)->size == DISP_TABLE_SIZE)
+  if (VECTORP (tem) && XVECTOR (tem)->size == DISP_TABLE_SIZE)
     return XVECTOR (tem);
   tem = Vstandard_display_table;
-  if (XTYPE (tem) == Lisp_Vector && XVECTOR (tem)->size == DISP_TABLE_SIZE)
+  if (VECTORP (tem) && XVECTOR (tem)->size == DISP_TABLE_SIZE)
     return XVECTOR (tem);
   return 0;
 }
@@ -955,7 +956,7 @@ DEFUN ("next-window", Fnext_window, Snext_window, 0, 3, 0,
                   If that happens, go back to the selected frame
                   so we can complete the cycle.  */
                if (EQ (tem, tem1))
-                 XSET (tem, Lisp_Frame, selected_frame);
+                 XSETFRAME (tem, selected_frame);
              }
 #endif
            tem = FRAME_ROOT_WINDOW (XFRAME (tem));
@@ -1099,7 +1100,7 @@ DEFUN ("previous-window", Fprevious_window, Sprevious_window, 0, 3, 0,
                   If that happens, go back to the selected frame
                   so we can complete the cycle.  */
                if (EQ (tem, tem1))
-                 XSET (tem, Lisp_Frame, selected_frame);
+                 XSETFRAME (tem, selected_frame);
              }
 #endif
            /* If this frame has a minibuffer, find that window first,
@@ -1227,7 +1228,7 @@ window_loop (type, obj, mini, frames)
      or Qt otherwise.  */
 
   /* Pick a window to start with.  */
-  if (XTYPE (obj) == Lisp_Window)
+  if (WINDOWP (obj))
     w = obj;
   else if (frame)
     w = FRAME_SELECTED_WINDOW (frame);
@@ -1423,7 +1424,7 @@ If FRAME is a frame, search only that frame.")
     Lisp_Object buffer, frame;
 {
   buffer = Fget_buffer (buffer);
-  if (XTYPE (buffer) == Lisp_Buffer)
+  if (BUFFERP (buffer))
     return window_loop (GET_BUFFER_WINDOW, buffer, 1, frame);
   else
     return Qnil;
@@ -1452,9 +1453,13 @@ value is reasonable when this function is called.")
     CHECK_LIVE_WINDOW (window, 0);
 
   w = XWINDOW (window);
+
   startpos = marker_position (w->start);
   top = XFASTINT (w->top) - FRAME_MENU_BAR_LINES (XFRAME (WINDOW_FRAME (w)));
 
+  if (MINI_WINDOW_P (w) && top > 0)
+    error ("Can't expand minibuffer to full frame");
+
   window_loop (DELETE_OTHER_WINDOWS, window, 0, WINDOW_FRAME (w));
 
   /* Try to minimize scrolling, by setting the window start to the point
@@ -1597,9 +1602,9 @@ set_window_height (window, height, nodelete)
       return;
     }
 
-  XFASTINT (w->last_modified) = 0;
+  XSETFASTINT (w->last_modified, 0);
   windows_or_buffers_changed++;
-  XFASTINT (w->height) = height;
+  XSETFASTINT (w->height, height);
   if (!NILP (w->hchild))
     {
       for (child = w->hchild; !NILP (child); child = XWINDOW (child)->next)
@@ -1618,7 +1623,7 @@ set_window_height (window, height, nodelete)
 
          opos = lastobot + XFASTINT (c->height);
 
-         XFASTINT (c->top) = lastbot;
+         XSETFASTINT (c->top, lastbot);
 
          pos = (((opos * height) << 1) + oheight) / (oheight << 1);
 
@@ -1658,9 +1663,9 @@ set_window_width (window, width, nodelete)
       return;
     }
 
-  XFASTINT (w->last_modified) = 0;
+  XSETFASTINT (w->last_modified, 0);
   windows_or_buffers_changed++;
-  XFASTINT (w->width) = width;
+  XSETFASTINT (w->width, width);
   if (!NILP (w->vchild))
     {
       for (child = w->vchild; !NILP (child); child = XWINDOW (child)->next)
@@ -1679,7 +1684,7 @@ set_window_width (window, width, nodelete)
 
          opos = lastoright + XFASTINT (c->width);
 
-         XFASTINT (c->left) = lastright;
+         XSETFASTINT (c->left, lastright);
 
          pos = (((opos * width) << 1) + owidth) / (owidth << 1);
 
@@ -1730,9 +1735,9 @@ BUFFER can be a buffer or buffer name.")
     }
 
   w->buffer = buffer;
-  w->window_end_pos = 0;
+  XSETFASTINT (w->window_end_pos, 0);
   w->window_end_valid = Qnil;
-  w->hscroll = 0;
+  XSETFASTINT(w->hscroll, 0);
   Fset_marker (w->pointm,
               make_number (BUF_PT (XBUFFER (buffer))),
               buffer);
@@ -1741,7 +1746,7 @@ BUFFER can be a buffer or buffer name.")
                         buffer);
   w->start_at_line_beg = Qnil;
   w->force_start = Qnil;
-  XFASTINT (w->last_modified) = 0;
+  XSETFASTINT (w->last_modified, 0);
   windows_or_buffers_changed++;
   if (EQ (window, selected_window))
     Fset_buffer (buffer);
@@ -1766,7 +1771,7 @@ before each command.")
   if (NILP (w->buffer))
     error ("Trying to select deleted window or non-leaf window");
 
-  XFASTINT (w->use_time) = ++window_select_count;
+  XSETFASTINT (w->use_time, ++window_select_count);
   if (EQ (window, selected_window))
     return window;
 
@@ -1858,9 +1863,24 @@ Returns the window displaying BUFFER.")
       if (!NILP (tem))
        return call1 (Vspecial_display_function, buffer);
 
+      tem = Fassoc (XBUFFER (buffer)->name, Vspecial_display_buffer_names);
+      if (!NILP (tem))
+       return call2 (Vspecial_display_function, buffer, XCONS (tem)->cdr);
+      
       for (tem = Vspecial_display_regexps; CONSP (tem); tem = XCONS (tem)->cdr)
-       if (fast_string_match (XCONS (tem)->car, XBUFFER (buffer)->name) >= 0)
-         return call1 (Vspecial_display_function, buffer);
+       {
+         Lisp_Object car = XCONS (tem)->car;
+         if (STRINGP (car)
+             && fast_string_match (car, XBUFFER (buffer)->name) >= 0)
+           return call1 (Vspecial_display_function, buffer);
+         else if (CONSP (car)
+                  && STRINGP (XCONS (car)->car)
+                  && fast_string_match (XCONS (car)->car,
+                                        XBUFFER (buffer)->name) >= 0)
+           return call2 (Vspecial_display_function,
+                         buffer,
+                         XCONS (car)->cdr);
+       }
     }
 
 #ifdef MULTI_FRAME
@@ -1888,7 +1908,7 @@ Returns the window displaying BUFFER.")
       frames = Qnil;      
 #ifdef MULTI_FRAME
       if (FRAME_MINIBUF_ONLY_P (selected_frame))
-       XSET (frames, Lisp_Frame, last_nonminibuf_frame);
+       XSETFRAME (frames, last_nonminibuf_frame);
 #endif
       /* Don't try to create a window if would get an error */
       if (split_height_threshold < window_min_height << 1)
@@ -1987,7 +2007,7 @@ temp_output_buffer_show (buf)
 #endif /* MULTI_FRAME */
       Vminibuf_scroll_window = window;
       w = XWINDOW (window);
-      XFASTINT (w->hscroll) = 0;
+      XSETFASTINT (w->hscroll, 0);
       set_marker_restricted (w->start, make_number (1), buf);
       set_marker_restricted (w->pointm, make_number (1), buf);
     }
@@ -2007,7 +2027,7 @@ make_dummy_parent (window)
 
   o = XWINDOW (old);
   p = XWINDOW (new);
-  XFASTINT (p->sequence_number) = ++sequence_number;
+  XSETFASTINT (p->sequence_number, ++sequence_number);
 
   /* Put new into window structure in place of window */
   replace_window (window, new);
@@ -2116,17 +2136,17 @@ and put SIZE columns in the first of the pair.")
     {
       p->height = o->height;
       p->top = o->top;
-      XFASTINT (p->width) = XFASTINT (o->width) - size;
-      XFASTINT (o->width) = size;
-      XFASTINT (p->left) = XFASTINT (o->left) + size;
+      XSETFASTINT (p->width, XFASTINT (o->width) - size);
+      XSETFASTINT (o->width, size);
+      XSETFASTINT (p->left, XFASTINT (o->left) + size);
     }
   else
     {
       p->left = o->left;
       p->width = o->width;
-      XFASTINT (p->height) = XFASTINT (o->height) - size;
-      XFASTINT (o->height) = size;
-      XFASTINT (p->top) = XFASTINT (o->top) + size;
+      XSETFASTINT (p->height, XFASTINT (o->height) - size);
+      XSETFASTINT (o->height, size);
+      XSETFASTINT (p->top, XFASTINT (o->top) + size);
     }
 
   return new;
@@ -2292,7 +2312,7 @@ change_window_height (delta, widthflag)
       (*setsizefun) (parent, opht, 0);
     }
 
-  XFASTINT (p->last_modified) = 0;
+  XSETFASTINT (p->last_modified, 0);
 }
 #undef MINSIZE
 #undef CURBEG
@@ -2340,7 +2360,7 @@ window_internal_width (w)
 
   /* Scroll bars occupy a few columns.  */
   if (FRAME_HAS_VERTICAL_SCROLL_BARS (f))
-    return width - VERTICAL_SCROLL_BAR_WIDTH;
+    return width - FRAME_SCROLL_BAR_COLS (f);
 
   /* The column of `|' characters separating side-by-side windows
      occupies one column only.  */
@@ -2364,13 +2384,13 @@ window_scroll (window, n, noerror)
   int lose;
   Lisp_Object bolp, nmoved;
 
-  XFASTINT (tem) = PT;
+  XSETFASTINT (tem, PT);
   tem = Fpos_visible_in_window_p (tem, window);
 
   if (NILP (tem))
     {
       Fvertical_motion (make_number (- (ht / 2)), window);
-      XFASTINT (tem) = PT;
+      XSETFASTINT (tem, PT);
       Fset_marker (w->start, tem, w->buffer);
       w->force_start = Qt;
     }
@@ -2395,7 +2415,7 @@ window_scroll (window, n, noerror)
       set_marker_restricted (w->start, make_number (pos), w->buffer);
       w->start_at_line_beg = bolp;
       w->update_mode_line = Qt;
-      XFASTINT (w->last_modified) = 0;
+      XSETFASTINT (w->last_modified, 0);
       if (pos > opoint)
        SET_PT (pos);
       if (n < 0)
@@ -2554,7 +2574,7 @@ showing that buffer, popping the buffer up if necessary.")
     window_scroll (window, next_screen_context_lines - ht, 1);
   else
     {
-      if (XTYPE (n) == Lisp_Cons)
+      if (CONSP (n))
        n = Fcar (n);
       CHECK_NUMBER (n, 0);
       window_scroll (window, XINT (n), 1);
@@ -2574,7 +2594,7 @@ Default for ARG is window width minus 2.")
 {
 
   if (NILP (arg))
-    XFASTINT (arg) = window_internal_width (XWINDOW (selected_window)) - 2;
+    XSETFASTINT (arg, window_internal_width (XWINDOW (selected_window)) - 2);
   else
     arg = Fprefix_numeric_value (arg);
 
@@ -2591,7 +2611,7 @@ Default for ARG is window width minus 2.")
      register Lisp_Object arg;
 {
   if (NILP (arg))
-    XFASTINT (arg) = window_internal_width (XWINDOW (selected_window)) - 2;
+    XSETFASTINT (arg, window_internal_width (XWINDOW (selected_window)) - 2);
   else
     arg = Fprefix_numeric_value (arg);
 
@@ -2612,7 +2632,7 @@ redraws with point in the center of the current window.")
 {
   register struct window *w = XWINDOW (selected_window);
   register int ht = window_internal_height (w);
-  register int opoint = PT;
+  struct position pos;
   Lisp_Object window;
 
   if (NILP (n))
@@ -2620,11 +2640,11 @@ redraws with point in the center of the current window.")
       extern int frame_garbaged;
 
       SET_FRAME_GARBAGED (XFRAME (WINDOW_FRAME (w)));
-      XFASTINT (n) = ht / 2;
+      XSETFASTINT (n, ht / 2);
     }
-  else if (XTYPE (n) == Lisp_Cons) /* Just C-u. */
+  else if (CONSP (n)) /* Just C-u. */
     {
-      XFASTINT (n) = ht / 2;
+      XSETFASTINT (n, ht / 2);
     }
   else
     {
@@ -2635,14 +2655,14 @@ redraws with point in the center of the current window.")
   if (XINT (n) < 0)
     XSETINT (n, XINT (n) + ht);
 
-  XSETINT (n, - XINT (n));
-
-  XSET (window, Lisp_Window, w);
-  Fvertical_motion (n, window);
-  Fset_marker (w->start, make_number (PT), w->buffer);
-  w->start_at_line_beg = Fbolp ();
+  XSETWINDOW (window, w);
+  pos = *vmotion (point, - XINT (n), window_internal_width (w) - 1,
+                 XINT (w->hscroll), window);
 
-  SET_PT (opoint);
+  Fset_marker (w->start, make_number (pos.bufpos), w->buffer);
+  w->start_at_line_beg = ((pos.bufpos == BEGV
+                          || FETCH_CHAR (pos.bufpos - 1) == '\n')
+                         ? Qt : Qnil);
   w->force_start = Qt;
 
   return Qnil;
@@ -2663,7 +2683,7 @@ negative means relative to bottom of window.")
   Lisp_Object window;
 
   if (NILP (arg))
-    XFASTINT (arg) = height / 2;
+    XSETFASTINT (arg, height / 2);
   else
     {
       arg = Fprefix_numeric_value (arg);
@@ -2672,7 +2692,7 @@ negative means relative to bottom of window.")
     }
 
   start = marker_position (w->start);
-  XSET (window, Lisp_Window, w);
+  XSETWINDOW (window, w);
   if (start < BEGV || start > ZV)
     {
       Fvertical_motion (make_number (- (height / 2)), window);
@@ -2697,6 +2717,9 @@ struct save_window_data
     Lisp_Object minibuf_scroll_window;
     Lisp_Object root_window;
     Lisp_Object focus_frame;
+    /* Record the values of window-min-width and window-min-height
+       so that window sizes remain consistent with them.  */
+    Lisp_Object min_width, min_height;
     /* A vector, interpreted as a struct saved_window */
     Lisp_Object saved_windows;
   };
@@ -2733,7 +2756,7 @@ DEFUN ("window-configuration-p", Fwindow_configuration_p, Swindow_configuration_
   (obj)
      Lisp_Object obj;
 {
-  if (XTYPE (obj) == Lisp_Window_Configuration)
+  if (WINDOW_CONFIGURATIONP (obj))
     return Qt;
   return Qnil;
 }
@@ -2753,7 +2776,7 @@ by `current-window-configuration' (which see).")
   Lisp_Object frame;
   FRAME_PTR f;
 
-  while (XTYPE (configuration) != Lisp_Window_Configuration)
+  while (!WINDOW_CONFIGURATIONP (configuration))
     {
       configuration = wrong_type_argument (intern ("window-configuration-p"),
                                           configuration);
@@ -2796,6 +2819,11 @@ by `current-window-configuration' (which see).")
 
       windows_or_buffers_changed++;
 
+      /* Temporarily avoid any problems with windows that are smaller
+        than they are supposed to be.  */
+      window_min_height = 1;
+      window_min_width = 1;
+
       /* Kludge Alert!
         Mark all windows now on frame as "deleted".
         Restoring the new configuration "undeletes" any that are in it.
@@ -2843,7 +2871,7 @@ by `current-window-configuration' (which see).")
 
          /* If we squirreled away the buffer in the window's height,
             restore it now.  */
-         if (XTYPE (w->height) == Lisp_Buffer)
+         if (BUFFERP (w->height))
            w->buffer = w->height;
          w->left = p->left;
          w->top = p->top;
@@ -2851,7 +2879,7 @@ by `current-window-configuration' (which see).")
          w->height = p->height;
          w->hscroll = p->hscroll;
          w->display_table = p->display_table;
-         XFASTINT (w->last_modified) = 0;
+         XSETFASTINT (w->last_modified, 0);
 
          /* Reinstall the saved buffer and pointers into it.  */
          if (NILP (p->buffer))
@@ -2912,7 +2940,7 @@ by `current-window-configuration' (which see).")
 
 #ifdef MULTI_FRAME
       if (NILP (data->focus_frame)
-         || (XTYPE (data->focus_frame) == Lisp_Frame
+         || (FRAMEP (data->focus_frame)
              && FRAME_LIVE_P (XFRAME (data->focus_frame))))
        Fredirect_frame_focus (frame, data->focus_frame);
 #endif
@@ -2936,6 +2964,10 @@ by `current-window-configuration' (which see).")
 #endif
     }
 
+  /* Restore the minimum heights recorded in the configuration.  */
+  window_min_height = XINT (data->min_height);
+  window_min_width = XINT (data->min_width);
+
 #ifdef MULTI_FRAME
   /* Fselect_window will have made f the selected frame, so we
      reselect the proper frame here.  Fhandle_switch_frame will change the
@@ -3007,7 +3039,7 @@ save_window_save (window, vector, i)
       p = SAVED_WINDOW_N (vector, i);
       w = XWINDOW (window);
 
-      XFASTINT (w->temslot) = i++;
+      XSETFASTINT (w->temslot, i++);
       p->window = window;
       p->buffer = w->buffer;
       p->left = w->left;
@@ -3094,17 +3126,19 @@ redirection (see `redirect-frame-focus').")
   data = (struct save_window_data *)
            XVECTOR (Fmake_vector (make_number (SAVE_WINDOW_DATA_SIZE),
                                  Qnil));
-  XFASTINT (data->frame_width) = FRAME_WIDTH (f);
-  XFASTINT (data->frame_height) = FRAME_HEIGHT (f);
-  XFASTINT (data->frame_menu_bar_lines) = FRAME_MENU_BAR_LINES (f);
+  XSETFASTINT (data->frame_width, FRAME_WIDTH (f));
+  XSETFASTINT (data->frame_height, FRAME_HEIGHT (f));
+  XSETFASTINT (data->frame_menu_bar_lines, FRAME_MENU_BAR_LINES (f));
 #ifdef MULTI_FRAME
-  XSET (data->selected_frame, Lisp_Frame, selected_frame);
+  XSETFRAME (data->selected_frame, selected_frame);
 #endif
   data->current_window = FRAME_SELECTED_WINDOW (f);
-  XSET (data->current_buffer, Lisp_Buffer, current_buffer);
+  XSETBUFFER (data->current_buffer, current_buffer);
   data->minibuf_scroll_window = Vminibuf_scroll_window;
   data->root_window = FRAME_ROOT_WINDOW (f);
   data->focus_frame = FRAME_FOCUS_FRAME (f);
+  XSETINT (data->min_height, window_min_height);
+  XSETINT (data->min_width, window_min_width);
   tem = Fmake_vector (make_number (n_windows), Qnil);
   data->saved_windows = tem;
   for (i = 0; i < n_windows; i++)
@@ -3112,7 +3146,7 @@ redirection (see `redirect-frame-focus').")
       = Fmake_vector (make_number (SAVED_WINDOW_VECTOR_SIZE), Qnil);
   save_window_save (FRAME_ROOT_WINDOW (f),
                    XVECTOR (tem), 0);
-  XSET (tem, Lisp_Window_Configuration, data);
+  XSETWINDOW_CONFIGURATION (tem, data);
   return (tem);
 }
 
@@ -3157,12 +3191,12 @@ init_window_once ()
      just so that there is "something there."
      Correct values are put in in init_xdisp */
 
-  XFASTINT (XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->width) = 10;
-  XFASTINT (XWINDOW (minibuf_window)->width) = 10;
+  XSETFASTINT (XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->width, 10);
+  XSETFASTINT (XWINDOW (minibuf_window)->width, 10);
 
-  XFASTINT (XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->height) = 9;
-  XFASTINT (XWINDOW (minibuf_window)->top) = 9;
-  XFASTINT (XWINDOW (minibuf_window)->height) = 1;
+  XSETFASTINT (XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->height, 9);
+  XSETFASTINT (XWINDOW (minibuf_window)->top, 9);
+  XSETFASTINT (XWINDOW (minibuf_window)->height, 1);
 
   /* Prevent error in Fset_window_buffer.  */
   XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->buffer = Qt;
@@ -3178,7 +3212,7 @@ init_window_once ()
      a newly-created, never-selected window.  Increment
      window_select_count so the first selection ever will get
      something newer than this.  */
-  XFASTINT (XWINDOW (selected_window)->use_time) = ++window_select_count;
+  XSETFASTINT (XWINDOW (selected_window)->use_time, ++window_select_count);
 #endif /* not MULTI_FRAME */
 }
 
@@ -3231,22 +3265,30 @@ where `pop-up-frame-alist' would hold the default frame parameters.");
   DEFVAR_LISP ("special-display-buffer-names", &Vspecial_display_buffer_names,
     "*List of buffer names that should have their own special frames.\n\
 Displaying a buffer whose name is in this list makes a special frame for it\n\
-using `special-display-function'.  See also `special-display-regexps'.");
+using `special-display-function'.\n\
+Instead of a buffer name, the list entries can be cons cells.  In that\n\
+case the car should be a buffer name, and the cdr data to be passed as a 
+second argument to `special-display-function'.\n\
+See also `special-display-regexps'.");
   Vspecial_display_buffer_names = Qnil;
 
   DEFVAR_LISP ("special-display-regexps", &Vspecial_display_regexps,
     "*List of regexps saying which buffers should have their own special frames.\n\
 If a buffer name matches one of these regexps, it gets its own frame.\n\
 Displaying a buffer whose name is in this list makes a special frame for it\n\
-using `special-display-function'.  See also `special-display-buffer-names'.");
+using `special-display-function'.\n\
+Instead of a buffer name, the list entries can be cons cells.  In that\n\
+case the car should be the regexp, and the cdr data to be passed as a 
+second argument to `special-display-function'.\n\
+See also `special-display-buffer-names'.");
   Vspecial_display_regexps = Qnil;
 
   DEFVAR_LISP ("special-display-function", &Vspecial_display_function,
     "Function to call to make a new frame for a special buffer.\n\
-It is called with one argument, the buffer,\n\
-and should return a window displaying that buffer.\n\
+It is called with two arguments, the buffer and optional buffer specific\n\
+data, and should return a window displaying that buffer.\n\
 The default value makes a separate frame for the buffer,\n\
-using `special-display-alist' to specify the frame parameters.\n\
+using `special-display-frame-alist' to specify the frame parameters.\n\
 \n\
 A buffer is special if its is listed in `special-display-buffer-names'\n\
 or matches a regexp in `special-display-regexps'.");