changeset 21424:fbfd26142e76

(redisplay_window): If updating mode line, temporarily change selected_frame
author Richard M. Stallman <rms@gnu.org>
date Wed, 08 Apr 1998 07:15:02 +0000
parents f866f7cadda2
children 69491a9294a4
files src/xdisp.c
diffstat 1 files changed, 30 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/xdisp.c	Wed Apr 08 07:08:28 1998 +0000
+++ b/src/xdisp.c	Wed Apr 08 07:15:02 1998 +0000
@@ -1739,6 +1739,7 @@
   int tem;
   int update_mode_line;
   struct Lisp_Char_Table *dp = window_display_table (w);
+  int really_switched_buffer = 0;
 
   if (Z == Z_BYTE && lpoint != lpoint_byte)
     abort ();
@@ -1794,7 +1795,11 @@
   /* Otherwise set up data on this window; select its buffer and point value */
 
   if (update_mode_line)
-    set_buffer_internal_1 (XBUFFER (w->buffer));
+    /* Really select the buffer, for the sake of buffer-local variables.  */
+    {
+      set_buffer_internal_1 (XBUFFER (w->buffer));
+      really_switched_buffer = 1;
+    }
   else
     set_buffer_temp (XBUFFER (w->buffer));
 
@@ -1925,8 +1930,12 @@
 	{
 	  Lisp_Object temp[3];
 
-	  set_buffer_temp (old);
-	  set_buffer_internal_1 (XBUFFER (w->buffer));
+	  if (!really_switched_buffer)
+	    {
+	      set_buffer_temp (old);
+	      set_buffer_internal_1 (XBUFFER (w->buffer));
+	    }
+	  really_switched_buffer = 1;
 	  update_mode_line = 1;
 	  w->update_mode_line = Qt;
 	  if (! NILP (Vwindow_scroll_functions))
@@ -2170,8 +2179,11 @@
   /* Redisplay the mode line.  Select the buffer properly for that.  */
   if (!update_mode_line)
     {
-      set_buffer_temp (old);
-      set_buffer_internal_1 (XBUFFER (w->buffer));
+      if (!really_switched_buffer)
+	{
+	  set_buffer_temp (old);
+	  set_buffer_internal_1 (XBUFFER (w->buffer));
+	}
       update_mode_line = 1;
       w->update_mode_line = Qt;
     }
@@ -2357,7 +2369,18 @@
        || (!NILP (w->column_number_displayed)
 	   && XFASTINT (w->column_number_displayed) != current_column ()))
       && height != XFASTINT (w->height))
-    display_mode_line (w);
+    {
+      FRAME_PTR oframe = selected_frame;
+      if (!really_switched_buffer)
+	{
+	  set_buffer_temp (old);
+	  set_buffer_internal_1 (XBUFFER (w->buffer));
+	  really_switched_buffer = 1;
+	}
+      selected_frame = f;
+      display_mode_line (w);
+      selected_frame = oframe;
+    }
   if (! line_number_displayed
       && ! BUFFERP (w->base_line_pos))
     {
@@ -2414,7 +2437,7 @@
     }
 
   TEMP_SET_PT_BOTH (opoint, opoint_byte);
-  if (update_mode_line)
+  if (really_switched_buffer)
     set_buffer_internal_1 (old);
   else
     set_buffer_temp (old);