changeset 10303:e951e8dddc8b

Use SAVE_MODIFF and BUF_SAVE_MODIFF instead of direct access to the save_modiff field. (redisplay_window): Call set_buffer_temp. (redisplay_window): For buffer_shared count, treat an indirect buffer as equivalent to its base.
author Richard M. Stallman <rms@gnu.org>
date Mon, 02 Jan 1995 06:33:09 +0000
parents 34556316a48a
children ce5ab980a14f
files src/xdisp.c
diffstat 1 files changed, 27 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/xdisp.c	Mon Jan 02 06:30:49 1995 +0000
+++ b/src/xdisp.c	Mon Jan 02 06:33:09 1995 +0000
@@ -122,7 +122,8 @@
  since the last redisplay that paused */
 static int blank_end_of_window;
 
-/* Number of windows showing the buffer of the selected window.
+/* Number of windows showing the buffer of the selected window
+   (or another buffer with the same base buffer).
    keyboard.c refers to this.  */
 int buffer_shared;
 
@@ -591,7 +592,7 @@
 
   /* Detect case that we need to write a star in the mode line.  */
   if (XFASTINT (w->last_modified) < MODIFF
-      && XFASTINT (w->last_modified) <= current_buffer->save_modified)
+      && XFASTINT (w->last_modified) <= SAVE_MODIFF)
     {
       w->update_mode_line = Qt;
       if (buffer_shared > 1)
@@ -1015,7 +1016,7 @@
 	  || !NILP (w->update_mode_line)
 	  || (XFASTINT (w->last_modified) < MODIFF
 	      && (XFASTINT (w->last_modified)
-		  <= XBUFFER (w->buffer)->save_modified)))
+		  <= BUF_SAVE_MODIFF (XBUFFER (w->buffer)))))
 	{
 	  struct buffer *prev = current_buffer;
 	  call1 (Vrun_hooks, Qmenu_bar_update_hook);
@@ -1110,14 +1111,24 @@
 
   /* Otherwise set up data on this window; select its buffer and point value */
 
-  current_buffer = XBUFFER (w->buffer);
+  set_buffer_temp (XBUFFER (w->buffer));
   opoint = PT;
 
-  /* Count number of windows showing the selected buffer.  */
-
-  if (!just_this_one
-      && current_buffer == XBUFFER (XWINDOW (selected_window)->buffer))
-    buffer_shared++;
+  /* Count number of windows showing the selected buffer.
+     An indirect buffer counts as its base buffer.  */
+
+  if (!just_this_one)
+    {
+      struct buffer *current_base, *window_base;
+      current_base = current_buffer;
+      window_base = XBUFFER (XWINDOW (selected_window)->buffer);
+      if (current_base->base_buffer)
+	current_base = current_base->base_buffer;
+      if (window_base->base_buffer)
+	window_base = window_base->base_buffer;
+      if (current_base == window_base)
+	buffer_shared++;
+    }
 
   /* POINT refers normally to the selected window.
      For any other window, set up appropriate value.  */
@@ -1415,7 +1426,7 @@
     }
 
   BUF_PT (current_buffer) = opoint;
-  current_buffer = old;
+  set_buffer_temp (old);
   BUF_PT (current_buffer) = lpoint;
 }
 
@@ -1932,9 +1943,9 @@
     }
 
   /* Increment the buffer's time stamp, but also increment the save
-     and autosave timestamps, so as not to screw up that timekeeping. */
-  if (BUF_MODIFF (buf) == buf->save_modified)
-    buf->save_modified++;
+     and autosave timestamps, so as not to screw up that timekeeping.  */
+  if (BUF_MODIFF (buf) == BUF_SAVE_MODIFF (buf))
+    BUF_SAVE_MODIFF (buf)++;
   if (BUF_MODIFF (buf) == buf->auto_save_modified)
     buf->auto_save_modified++;
 
@@ -3131,13 +3142,13 @@
     case '*':
       if (!NILP (b->read_only))
 	return "%";
-      if (BUF_MODIFF (b) > b->save_modified)
+      if (BUF_MODIFF (b) > BUF_SAVE_MODIFF (b))
 	return "*";
       return "-";
 
     case '+':
       /* This differs from %* only for a modified read-only buffer.  */
-      if (BUF_MODIFF (b) > b->save_modified)
+      if (BUF_MODIFF (b) > BUF_SAVE_MODIFF (b))
 	return "*";
       if (!NILP (b->read_only))
 	return "%";
@@ -3145,7 +3156,7 @@
 
     case '&':
       /* This differs from %* in ignoring read-only-ness.  */
-      if (BUF_MODIFF (b) > b->save_modified)
+      if (BUF_MODIFF (b) > BUF_SAVE_MODIFF (b))
 	return "*";
       return "-";