Separate read and write access to Lisp_Object slots of struct window.
[bpt/emacs.git] / src / minibuf.c
index b0f4e3d..4ef433b 100644 (file)
@@ -102,23 +102,23 @@ choose_minibuf_frame (void)
 {
   if (FRAMEP (selected_frame)
       && FRAME_LIVE_P (XFRAME (selected_frame))
-      && !EQ (minibuf_window, XFRAME (selected_frame)->minibuffer_window))
+      && !EQ (minibuf_window, FGET (XFRAME (selected_frame), minibuffer_window)))
     {
       struct frame *sf = XFRAME (selected_frame);
       Lisp_Object buffer;
 
       /* I don't think that any frames may validly have a null minibuffer
         window anymore.  */
-      if (NILP (sf->minibuffer_window))
+      if (NILP (FGET (sf, minibuffer_window)))
        abort ();
 
       /* Under X, we come here with minibuf_window being the
         minibuffer window of the unused termcap window created in
         init_window_once.  That window doesn't have a buffer.  */
-      buffer = XWINDOW (minibuf_window)->buffer;
+      buffer = WGET (XWINDOW (minibuf_window), buffer);
       if (BUFFERP (buffer))
-       Fset_window_buffer (sf->minibuffer_window, buffer, Qnil);
-      minibuf_window = sf->minibuffer_window;
+       Fset_window_buffer (FGET (sf, minibuffer_window), buffer, Qnil);
+      minibuf_window = FGET (sf, minibuffer_window);
     }
 
   /* Make sure no other frame has a minibuffer as its selected window,
@@ -248,7 +248,7 @@ read_minibuf_noninteractive (Lisp_Object map, Lisp_Object initial,
   val = Qnil;
   size = 100;
   len = 0;
-  line = (char *) xmalloc (size);
+  line = xmalloc (size);
 
   while ((c = getchar ()) != '\n')
     {
@@ -264,7 +264,7 @@ read_minibuf_noninteractive (Lisp_Object map, Lisp_Object initial,
              if (STRING_BYTES_BOUND / 2 < size)
                memory_full (SIZE_MAX);
              size *= 2;
-             line = (char *) xrealloc (line, size);
+             line = xrealloc (line, size);
            }
          line[len++] = c;
        }
@@ -424,8 +424,8 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
     {
       if (CONSP (initial))
        {
-         Lisp_Object backup_n = Fcdr (initial);
-         initial = Fcar (initial);
+         Lisp_Object backup_n = XCDR (initial);
+         initial = XCAR (initial);
          CHECK_STRING (initial);
          if (!NILP (backup_n))
            {
@@ -612,7 +612,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
   FOR_EACH_FRAME (dummy, frame)
     {
       Lisp_Object root_window = Fframe_root_window (frame);
-      Lisp_Object mini_window = XWINDOW (root_window)->next;
+      Lisp_Object mini_window = WGET (XWINDOW (root_window), next);
 
       if (! NILP (mini_window) && ! EQ (mini_window, minibuf_window)
          && !NILP (Fwindow_minibuffer_p (mini_window)))
@@ -622,7 +622,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
   /* Display this minibuffer in the proper window.  */
   Fset_window_buffer (minibuf_window, Fcurrent_buffer (), Qnil);
   Fselect_window (minibuf_window, Qnil);
-  XSETFASTINT (XWINDOW (minibuf_window)->hscroll, 0);
+  XWINDOW (minibuf_window)->hscroll = 0;
 
   Fmake_local_variable (Qprint_escape_newlines);
   print_escape_newlines = 1;
@@ -687,7 +687,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
       XWINDOW (minibuf_window)->must_be_updated_p = 1;
       update_frame (XFRAME (selected_frame), 1, 1);
       {
-        struct frame *f = XFRAME (XWINDOW (minibuf_window)->frame);
+        struct frame *f = XFRAME (WGET (XWINDOW (minibuf_window), frame));
         struct redisplay_interface *rif = FRAME_RIF (f);
         if (rif && rif->flush_display)
           rif->flush_display (f);
@@ -792,8 +792,8 @@ get_minibuffer (EMACS_INT depth)
   buf = Fcar (tail);
   if (NILP (buf) || NILP (BVAR (XBUFFER (buf), name)))
     {
-      sprintf (name, " *Minibuf-%"pI"d*", depth);
-      buf = Fget_buffer_create (build_string (name));
+      buf = Fget_buffer_create
+       (make_formatted_string (name, " *Minibuf-%"pI"d*", depth));
 
       /* Although the buffer's name starts with a space, undo should be
         enabled in it.  */
@@ -804,10 +804,9 @@ get_minibuffer (EMACS_INT depth)
   else
     {
       ptrdiff_t count = SPECPDL_INDEX ();
-      /* `reset_buffer' blindly sets the list of overlays to NULL, so we
-        have to empty the list, otherwise we end up with overlays that
-        think they belong to this buffer while the buffer doesn't know about
-        them any more.  */
+      /* We have to empty both overlay lists.  Otherwise we end
+        up with overlays that think they belong to this buffer
+        while the buffer doesn't know about them any more.  */
       delete_all_overlays (XBUFFER (buf));
       reset_buffer (XBUFFER (buf));
       record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
@@ -845,7 +844,7 @@ read_minibuf_unwind (Lisp_Object data)
   window = minibuf_window;
   /* To keep things predictable, in case it matters, let's be in the
      minibuffer when we reset the relevant variables.  */
-  Fset_buffer (XWINDOW (window)->buffer);
+  Fset_buffer (WGET (XWINDOW (window), buffer));
 
   /* Restore prompt, etc, from outer minibuffer level.  */
   minibuf_prompt = Fcar (minibuf_save_list);
@@ -888,8 +887,8 @@ read_minibuf_unwind (Lisp_Object data)
 
   /* Make sure minibuffer window is erased, not ignored.  */
   windows_or_buffers_changed++;
-  XSETFASTINT (XWINDOW (window)->last_modified, 0);
-  XSETFASTINT (XWINDOW (window)->last_overlay_modified, 0);
+  XWINDOW (window)->last_modified = 0;
+  XWINDOW (window)->last_overlay_modified = 0;
 
   /* In case the previous minibuffer displayed in this miniwindow is
      dead, we may keep displaying this buffer (tho it's inactive), so reset it,