]> code.delx.au - gnu-emacs/blobdiff - src/window.c
Use macro SPECPDL_INDEX.
[gnu-emacs] / src / window.c
index ffe05bca9823cec1ced9177c1de2ef3572b61e7b..0bacf5fd549a5be16945e3ddfa533da2523bfcfc 100644 (file)
@@ -958,7 +958,7 @@ if it isn't already recorded.  */)
       struct buffer *old_buffer = NULL, *b = XBUFFER (buf);
 
       /* In case W->start is out of the range, use something
-         reasonable.  This situation occured when loading a file with
+         reasonable.  This situation occurred when loading a file with
          `-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.  */
@@ -2664,7 +2664,7 @@ set_window_buffer (window, buffer, run_hooks_p)
 {
   struct window *w = XWINDOW (window);
   struct buffer *b = XBUFFER (buffer);
-  int count = specpdl_ptr - specpdl;
+  int count = SPECPDL_INDEX ();
 
   w->buffer = buffer;
 
@@ -3174,7 +3174,7 @@ temp_output_buffer_show (buf)
              tem = Fsymbol_value (Qtemp_buffer_show_hook);
              if (!NILP (tem))
                {
-                 int count = specpdl_ptr - specpdl;
+                 int count = SPECPDL_INDEX ();
                  Lisp_Object prev_window;
                  prev_window = selected_window;
 
@@ -4398,7 +4398,7 @@ scroll_command (n, direction)
      Lisp_Object n;
      int direction;
 {
-  int count = BINDING_STACK_SIZE ();
+  int count = SPECPDL_INDEX ();
 
   xassert (abs (direction) == 1);
 
@@ -4512,7 +4512,7 @@ showing that buffer, popping the buffer up if necessary.  */)
 {
   Lisp_Object window;
   struct window *w;
-  int count = BINDING_STACK_SIZE ();
+  int count = SPECPDL_INDEX ();
 
   window = Fother_window_for_scrolling ();
   w = XWINDOW (window);
@@ -4781,7 +4781,9 @@ and redisplay normally--don't erase and redraw the frame.  */)
   /* Set the new window start.  */
   set_marker_both (w->start, w->buffer, charpos, bytepos);
   w->window_end_valid = Qnil;
-  w->force_start = Qt;
+  
+  w->optional_new_start = Qt;
+
   if (bytepos == BEGV_BYTE || FETCH_BYTE (bytepos - 1) == '\n')
     w->start_at_line_beg = Qt;
   else
@@ -4941,6 +4943,7 @@ the return value is nil.  Otherwise the value is t.  */)
   Lisp_Object new_current_buffer;
   Lisp_Object frame;
   FRAME_PTR f;
+  int old_point = -1;
 
   while (!WINDOW_CONFIGURATIONP (configuration))
     wrong_type_argument (Qwindow_configuration_p, configuration);
@@ -4951,6 +4954,8 @@ the return value is nil.  Otherwise the value is t.  */)
   new_current_buffer = data->current_buffer;
   if (NILP (XBUFFER (new_current_buffer)->name))
     new_current_buffer = Qnil;
+  else
+    old_point = BUF_PT (XBUFFER (new_current_buffer));
 
   frame = XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window)->frame;
   f = XFRAME (frame);
@@ -5138,12 +5143,13 @@ the return value is nil.  Otherwise the value is t.  */)
       FRAME_ROOT_WINDOW (f) = data->root_window;
       /* Prevent "swapping out point" in the old selected window
         using the buffer that has been restored into it.
-        That swapping out has already been done,
-        near the beginning of this function.  */
+        Use the point value from the beginning of this function
+        since unshow_buffer (called from delete_all_subwindows)
+        could have altered it.  */
       selected_window = Qnil;
       if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer))
        set_marker_restricted (XWINDOW (data->current_window)->pointm,
-                              make_number (BUF_PT (XBUFFER (XWINDOW (data->current_window)->buffer))),
+                              make_number (old_point),
                               XWINDOW (data->current_window)->buffer);
                  
       Fselect_window (data->current_window);
@@ -5456,7 +5462,7 @@ usage: (save-window-excursion BODY ...)  */)
      Lisp_Object args;
 {
   register Lisp_Object val;
-  register int count = specpdl_ptr - specpdl;
+  register int count = SPECPDL_INDEX ();
 
   record_unwind_protect (Fset_window_configuration,
                         Fcurrent_window_configuration (Qnil));