CVS update by didierv xemacs/src, redisplay.h ...

xemacs-cvs at xemacs.org xemacs-cvs at xemacs.org
Wed Sep 26 09:28:04 EDT 2007


  User: didierv 
  Date: 07/09/26 15:28:04

  Modified:    xemacs/src ChangeLog faces.c redisplay-output.c redisplay.c
                        redisplay.h
Log:
More fixes about face indexes

Revision  Changes    Path
1.1096    +11 -0     XEmacs/xemacs/src/ChangeLog

Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/ChangeLog,v
retrieving revision 1.1095
retrieving revision 1.1096
diff -u -p -r1.1095 -r1.1096
--- ChangeLog	2007/09/26 09:36:49	1.1095
+++ ChangeLog	2007/09/26 13:27:59	1.1096
@@ -1,5 +1,16 @@
 2007-09-26  Didier Verna  <didier at xemacs.org>
 
+	More fixes similar to previous patch:
+
+	* faces.c (reset_face_cachels): Add informative comment about the
+	order of faces cache addition.
+	* redisplay.h: Ditto.
+	* redisplay-output.c (output_display_line): Don't rely on
+	DEFAULT_INDEX being 0.
+	* redisplay.c (create_string_text_block): Ditto.
+
+2007-09-26  Didier Verna  <didier at xemacs.org>
+
 	* gutter.c (calculate_gutter_size): Don't hardwire face index to
 	0: use DEFAULT_INDEX instead.
 



1.56      +95 -91    XEmacs/xemacs/src/faces.c

Index: faces.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/faces.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -p -r1.55 -r1.56
--- faces.c	2007/04/22 19:58:59	1.55
+++ faces.c	2007/09/26 13:28:00	1.56
@@ -76,7 +76,7 @@ Lisp_Object Vbuilt_in_face_specifiers;
 Fixnum debug_x_faces;
 #endif
 
-#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901) 
+#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)
 
 #ifdef DEBUG_XEMACS
 # define DEBUG_FACES(FORMAT, ...)  \
@@ -587,7 +587,7 @@ face_property_matching_instance (Lisp_Ob
   struct gcpro gcpro1;
 
   if (!NILP (charset))
-    matchspec = noseeum_cons (charset, 
+    matchspec = noseeum_cons (charset,
 			      stage == initial ? Qinitial : Qfinal);
 
   GCPRO1 (matchspec);
@@ -725,21 +725,21 @@ default_face_font_info (Lisp_Object doma
   if (noninteractive)
     {
       if (ascent)
-        *ascent = 1;
+	*ascent = 1;
       if (descent)
-        *descent = 0;
+	*descent = 0;
       if (height)
-        *height = 1;
+	*height = 1;
       if (width)
-        *width = 1;
+	*width = 1;
       if (proportional_p)
-        *proportional_p = 0;
+	*proportional_p = 0;
       return;
     }
 
   /* We use ASCII here.  This is reasonable because the people calling this
      function are using the resulting values to come up with overall sizes
-     for windows and frames. 
+     for windows and frames.
 
      It's possible for this function to get called when the face cachels
      have not been initialized--put a call to debug-print in
@@ -748,7 +748,7 @@ default_face_font_info (Lisp_Object doma
   if (WINDOWP (domain) && (w = XWINDOW (domain)) && w->face_cachels)
     {
       if (!Dynarr_length (w->face_cachels))
-        reset_face_cachels (w);
+	reset_face_cachels (w);
       cachel = WINDOW_FACE_CACHEL (w, DEFAULT_INDEX);
       font_instance = FACE_CACHEL_FONT (cachel, Vcharset_ascii);
     }
@@ -956,15 +956,15 @@ init_frame_faces (struct frame *frm)
 
 
       /* DO NOT change the selected frame here.  If the debugger goes off
-         it will try and display on the frame being created, but it is not
-         ready for that yet and a horrible death will occur.  Any random
-         code depending on the selected-frame as an implicit arg should be
-         tracked down and shot.  For the benefit of the one known,
-         xpm-color-symbols, make-frame sets the variable
-         Vframe_being_created to the frame it is making and sets it to nil
-         when done.  Internal functions that this could trigger which are
-         currently depending on selected-frame should use this instead.  It
-         is not currently visible at the lisp level. */
+	 it will try and display on the frame being created, but it is not
+	 ready for that yet and a horrible death will occur.  Any random
+	 code depending on the selected-frame as an implicit arg should be
+	 tracked down and shot.  For the benefit of the one known,
+	 xpm-color-symbols, make-frame sets the variable
+	 Vframe_being_created to the frame it is making and sets it to nil
+	 when done.  Internal functions that this could trigger which are
+	 currently depending on selected-frame should use this instead.  It
+	 is not currently visible at the lisp level. */
       call_critical_lisp_code (XDEVICE (FRAME_DEVICE (frm)),
 			       Qinit_frame_faces, tframe);
     }
@@ -1094,7 +1094,7 @@ ensure_face_cachel_contains_charset (str
   int bound = 1, final_stage = 0;
   int offs = XCHARSET_LEADING_BYTE (charset) - MIN_LEADING_BYTE;
 
-  if (!UNBOUNDP (cachel->font[offs]) && 
+  if (!UNBOUNDP (cachel->font[offs]) &&
       bit_vector_bit(FACE_CACHEL_FONT_UPDATED (cachel), offs))
     return cachel->font[offs];
 
@@ -1121,7 +1121,7 @@ ensure_face_cachel_contains_charset (str
 	      new_val = oth->font[offs];
 	      set_bit_vector_bit(FACE_CACHEL_FONT_SPECIFIED(cachel), offs, 1);
 	      set_bit_vector_bit
-		(FACE_CACHEL_FONT_FINAL_STAGE(cachel), offs, 
+		(FACE_CACHEL_FONT_FINAL_STAGE(cachel), offs,
 		 bit_vector_bit(FACE_CACHEL_FONT_FINAL_STAGE(oth), offs));
 	      break;
 	    }
@@ -1137,7 +1137,7 @@ ensure_face_cachel_contains_charset (str
 	  new_val = oth->font[offs];
 	}
 
-      if (!UNBOUNDP (cachel->font[offs]) && 
+      if (!UNBOUNDP (cachel->font[offs]) &&
 	  !EQ (cachel->font[offs], new_val))
 	cachel->dirty = 1;
       set_bit_vector_bit(FACE_CACHEL_FONT_UPDATED(cachel), offs, 1);
@@ -1158,8 +1158,8 @@ ensure_face_cachel_contains_charset (str
 					       ERROR_ME_DEBUG_WARN, 1, Qzero,
 					       initial);
     DEBUG_FACES("just called f_p_m_i on face %s, charset %s, initial, "
-		"result was something %s\n", 
-		XSTRING_DATA(XSYMBOL_NAME(XFACE(cachel->face)->name)), 
+		"result was something %s\n",
+		XSTRING_DATA(XSYMBOL_NAME(XFACE(cachel->face)->name)),
 		XSTRING_DATA(XSYMBOL_NAME(XCHARSET_NAME(charset))),
 		UNBOUNDP(new_val) ? "not bound" : "bound");
 
@@ -1173,12 +1173,12 @@ ensure_face_cachel_contains_charset (str
     new_val = face_property_matching_instance (face, Qfont,
 					       charset, domain,
 					       ERROR_ME_DEBUG_WARN, 0,
-					       Qzero, 
+					       Qzero,
 					       initial);
 
     DEBUG_FACES("just called f_p_m_i on face %s, charset %s, initial, "
-		"allow fallback, result was something %s\n", 
-		XSTRING_DATA(XSYMBOL_NAME(XFACE(cachel->face)->name)), 
+		"allow fallback, result was something %s\n",
+		XSTRING_DATA(XSYMBOL_NAME(XFACE(cachel->face)->name)),
 		XSTRING_DATA(XSYMBOL_NAME(XCHARSET_NAME(charset))),
 		UNBOUNDP(new_val) ? "not bound" : "bound");
 
@@ -1192,12 +1192,12 @@ ensure_face_cachel_contains_charset (str
     new_val = face_property_matching_instance (face, Qfont,
 					       charset, domain,
 					       ERROR_ME_DEBUG_WARN, 1,
-					       Qzero, 
+					       Qzero,
 					       final);
 
     DEBUG_FACES("just called f_p_m_i on face %s, charset %s, final, "
-		"result was something %s\n", 
-		XSTRING_DATA(XSYMBOL_NAME(XFACE(cachel->face)->name)), 
+		"result was something %s\n",
+		XSTRING_DATA(XSYMBOL_NAME(XFACE(cachel->face)->name)),
 		XSTRING_DATA(XSYMBOL_NAME(XCHARSET_NAME(charset))),
 		UNBOUNDP(new_val) ? "not bound" : "bound");
     /* Tell X11 redisplay that it should translate to iso10646-1. */
@@ -1214,12 +1214,12 @@ ensure_face_cachel_contains_charset (str
     new_val = face_property_matching_instance (face, Qfont,
 					       charset, domain,
 					       ERROR_ME_DEBUG_WARN, 0,
-					       Qzero, 
+					       Qzero,
 					       final);
 
     DEBUG_FACES("just called f_p_m_i on face %s, charset %s, initial, "
-		"allow fallback, result was something %s\n", 
-		XSTRING_DATA(XSYMBOL_NAME(XFACE(cachel->face)->name)), 
+		"allow fallback, result was something %s\n",
+		XSTRING_DATA(XSYMBOL_NAME(XFACE(cachel->face)->name)),
 		XSTRING_DATA(XSYMBOL_NAME(XCHARSET_NAME(charset))),
 		UNBOUNDP(new_val) ? "not bound" : "bound");
     if (!UNBOUNDP(new_val))
@@ -1236,7 +1236,7 @@ ensure_face_cachel_contains_charset (str
   set_bit_vector_bit(FACE_CACHEL_FONT_UPDATED(cachel), offs, 1);
   set_bit_vector_bit(FACE_CACHEL_FONT_FINAL_STAGE(cachel), offs,
 		     final_stage);
-  set_bit_vector_bit(FACE_CACHEL_FONT_SPECIFIED(cachel), offs, 
+  set_bit_vector_bit(FACE_CACHEL_FONT_SPECIFIED(cachel), offs,
 		     (bound || EQ (face, Vdefault_face)));
   cachel->font[offs] = new_val;
   return new_val;
@@ -1379,8 +1379,8 @@ update_face_cachel_data (struct face_cac
       cachel->face = face;
 
       /* We normally only set the _specified flags if the value was
-         actually bound.  The exception is for the default face where
-         we always set it since it is the ultimate fallback. */
+	 actually bound.  The exception is for the default face where
+	 we always set it since it is the ultimate fallback. */
 
       FROB (foreground);
       FROB (background);
@@ -1509,7 +1509,7 @@ merge_face_cachel_data (struct window *w
 	  set_bit_vector_bit(FACE_CACHEL_FONT_SPECIFIED(cachel), offs, 1);
 	  /* Also propagate whether we're translating to Unicode for the
 	     given face.  */
-	  set_bit_vector_bit(FACE_CACHEL_FONT_FINAL_STAGE(cachel), offs, 
+	  set_bit_vector_bit(FACE_CACHEL_FONT_FINAL_STAGE(cachel), offs,
 			     bit_vector_bit(FACE_CACHEL_FONT_FINAL_STAGE
 					    (Dynarr_atp(w->face_cachels,
 							findex)), offs));
@@ -1592,6 +1592,10 @@ reset_face_cachels (struct window *w)
 	    Dynarr_free (cachel->merged_faces);
 	}
       Dynarr_reset (w->face_cachels);
+      /* #### NOTE: be careful with the order !
+	 The cpp macros DEFAULT_INDEX and MODELINE_INDEX defined in
+	 redisplay.h depend on the code below, which is really clumsy.
+	 -- dvl */
       get_builtin_face_cache_index (w, Vdefault_face);
       get_builtin_face_cache_index (w, Vmodeline_face);
       XFRAME (w->frame)->window_face_cache_reset = 1;
@@ -1618,7 +1622,7 @@ mark_face_cachels_as_not_updated (struct
       struct face_cachel *cachel = Dynarr_atp (w->face_cachels, elt);
 
       cachel->updated = 0;
-      memset(FACE_CACHEL_FONT_UPDATED(cachel)->bits, 0, 
+      memset(FACE_CACHEL_FONT_UPDATED(cachel)->bits, 0,
 	     BIT_VECTOR_LONG_STORAGE (NUM_LEADING_BYTES));
     }
 }
@@ -1987,7 +1991,7 @@ LOCALE, TAG-SET, EXACT-P, and HOW-TO-ADD
 
 #define COPY_PROPERTY(property) \
   Fcopy_specifier (fold->property, fnew->property, \
-                   locale, tag_set, exact_p, how_to_add);
+		   locale, tag_set, exact_p, how_to_add);
 
   COPY_PROPERTY (foreground);
   COPY_PROPERTY (background);
@@ -2013,8 +2017,8 @@ LOCALE, TAG-SET, EXACT-P, and HOW-TO-ADD
 
 Lisp_Object Qone_dimensional, Qtwo_dimensional, Qx_coverage_instantiator;
 
-DEFUN ("specifier-tag-one-dimensional-p", 
-       Fspecifier_tag_one_dimensional_p, 
+DEFUN ("specifier-tag-one-dimensional-p",
+       Fspecifier_tag_one_dimensional_p,
        2, 2, 0, /*
 Return non-nil if (charset-dimension CHARSET) is 1.
 
@@ -2027,8 +2031,8 @@ shouldn't ever need to call this yoursel
   return (1 == XCHARSET_DIMENSION(charset)) ? Qt : Qnil;
 }
 
-DEFUN ("specifier-tag-two-dimensional-p", 
-       Fspecifier_tag_two_dimensional_p, 
+DEFUN ("specifier-tag-two-dimensional-p",
+       Fspecifier_tag_two_dimensional_p,
        2, 2, 0, /*
 Return non-nil if (charset-dimension CHARSET) is 2.
 
@@ -2041,34 +2045,34 @@ shouldn't ever need to call this yoursel
   return (2 == XCHARSET_DIMENSION(charset)) ? Qt : Qnil;
 }
 
-DEFUN ("specifier-tag-final-stage-p", 
-       Fspecifier_tag_final_stage_p, 
+DEFUN ("specifier-tag-final-stage-p",
+       Fspecifier_tag_final_stage_p,
        2, 2, 0, /*
 Return non-nil if STAGE is 'final.
 
 Used by the X11 platform font code for giving fallbacks; see
-`define-specifier-tag'.  You shouldn't ever need to call this. 
+`define-specifier-tag'.  You shouldn't ever need to call this.
 */
        (UNUSED(charset), stage))
 {
   return EQ(stage, Qfinal) ? Qt : Qnil;
 }
 
-DEFUN ("specifier-tag-initial-stage-p", 
-       Fspecifier_tag_initial_stage_p, 
+DEFUN ("specifier-tag-initial-stage-p",
+       Fspecifier_tag_initial_stage_p,
        2, 2, 0, /*
 Return non-nil if STAGE is 'initial.
 
 Used by the X11 platform font code for giving fallbacks; see
-`define-specifier-tag'.  You shouldn't ever need to call this. 
+`define-specifier-tag'.  You shouldn't ever need to call this.
 */
        (UNUSED(charset), stage))
 {
   return EQ(stage, Qinitial) ? Qt : Qnil;
 }
 
-DEFUN ("specifier-tag-encode-as-utf-8-p", 
-       Fspecifier_tag_encode_as_utf_8_p, 
+DEFUN ("specifier-tag-encode-as-utf-8-p",
+       Fspecifier_tag_encode_as_utf_8_p,
        2, 2, 0, /*
 Return t if and only if (charset-property CHARSET 'encode-as-utf-8)).
 
@@ -2271,12 +2275,12 @@ complex_vars_of_faces (void)
 	 call.  We should use this facility. */
       "Monospace-12",
       /* do we need to worry about non-Latin characters for monospace?
-         No, at least in Debian's implementation of Xft.
+	 No, at least in Debian's implementation of Xft.
 	 We should recommend that "gothic" and "mincho" aliases be created? */
       "Sazanami Mincho-12",
       /* Japanese #### add encoding info? */
-      				/* Arphic for Chinese? */
-      				/* Korean */
+				/* Arphic for Chinese? */
+				/* Korean */
 #else
       /* The default Japanese fonts installed with XFree86 4.0 use this
 	 point size, and the -misc-fixed fonts (which look really bad with
@@ -2302,10 +2306,10 @@ complex_vars_of_faces (void)
     define_specifier_tag(Qone_dimensional, Qnil,
 			 intern ("specifier-tag-one-dimensional-p"));
 
-    define_specifier_tag(Qinitial, Qnil, 
+    define_specifier_tag(Qinitial, Qnil,
 			 intern ("specifier-tag-initial-stage-p"));
 
-    define_specifier_tag(Qfinal, Qnil, 
+    define_specifier_tag(Qfinal, Qnil,
 			 intern ("specifier-tag-final-stage-p"));
 
     define_specifier_tag (Qencode_as_utf_8, Qnil,
@@ -2327,12 +2331,12 @@ complex_vars_of_faces (void)
 
 #else /* !USE_XFT */
     inst_list =
-      Fcons 
+      Fcons
       (Fcons
-       (list1 (device_symbol), 
+       (list1 (device_symbol),
 	build_string ("*")),
        inst_list);
-#ifdef MULE 
+#ifdef MULE
 
     /* For Han characters and Ethiopic, we want the misc-fixed font used to
        be distinct from that for alphabetic scripts, because the font
@@ -2340,11 +2344,11 @@ complex_vars_of_faces (void)
        (this is slightly less so) and because its coverage isn't up to
        handling them (well, chiefly, it's not up to handling Ethiopic--we do
        have charset-specific fallbacks for the East Asian charsets.) */
-    inst_list = 
+    inst_list =
       Fcons
       (Fcons
-       (list4(device_symbol, Qtwo_dimensional, Qfinal, Qx_coverage_instantiator), 
-	build_string 
+       (list4(device_symbol, Qtwo_dimensional, Qfinal, Qx_coverage_instantiator),
+	build_string
 	("-misc-fixed-medium-r-normal--15-140-75-75-c-90-iso10646-1")),
        inst_list);
 
@@ -2352,16 +2356,16 @@ complex_vars_of_faces (void)
        when a given charset's registries can't be found and redisplay for
        that charset falls back to iso10646-1. */
 
-    inst_list = 
+    inst_list =
       Fcons
       (Fcons
-       (list4(device_symbol, Qone_dimensional, Qfinal, Qx_coverage_instantiator), 
-	build_string 
-	("-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1")), 
+       (list4(device_symbol, Qone_dimensional, Qfinal, Qx_coverage_instantiator),
+	build_string
+	("-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1")),
        inst_list);
 
     for (fontptr = fonts + countof(fonts) - 1; fontptr >= fonts; fontptr--)
-      inst_list = Fcons (Fcons (list3 (device_symbol, 
+      inst_list = Fcons (Fcons (list3 (device_symbol,
 				       Qtwo_dimensional, Qinitial),
 				build_string (*fontptr)),
 			 inst_list);
@@ -2372,12 +2376,12 @@ complex_vars_of_faces (void)
        above). They also use Markus Kuhn's ISO 10646-1 fixed fonts for
        redisplay. */
 
-    inst_list = 
+    inst_list =
       Fcons
       (Fcons
-       (list4(device_symbol, Qencode_as_utf_8, Qinitial, Qx_coverage_instantiator), 
-	build_string 
-	("-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1")), 
+       (list4(device_symbol, Qencode_as_utf_8, Qinitial, Qx_coverage_instantiator),
+	build_string
+	("-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1")),
        inst_list);
 
 #endif /* MULE */
@@ -2385,9 +2389,9 @@ complex_vars_of_faces (void)
     /* Needed to make sure that charsets with non-specified fonts don't
        use bold and oblique first if medium and regular are available. */
     inst_list =
-      Fcons 
+      Fcons
       (Fcons
-       (list1 (device_symbol), 
+       (list1 (device_symbol),
 	build_string ("-*-*-medium-r-*-*-*-120-*-*-c-*-*-*")),
        inst_list);
 
@@ -2398,9 +2402,9 @@ complex_vars_of_faces (void)
        here gave horrendous results. */
 
     inst_list =
-      Fcons 
+      Fcons
       (Fcons
-       (list1 (device_symbol), 
+       (list1 (device_symbol),
 	build_string ("-*-lucidatypewriter-medium-r-*-*-*-120-*-*-*-*-*-*")),
        inst_list);
 
@@ -2416,28 +2420,28 @@ complex_vars_of_faces (void)
 #ifdef HAVE_MS_WINDOWS
     {
        const Ascbyte *mswfonts[] =
- 	    {
- 	      "Courier New:Regular:10::",
- 	      "Courier:Regular:10::",
- 	      ":Regular:10::"
- 	    };
+	    {
+	      "Courier New:Regular:10::",
+	      "Courier:Regular:10::",
+	      ":Regular:10::"
+	    };
        const Ascbyte **mswfontptr;
 
        for (mswfontptr = mswfonts + countof (mswfonts) - 1;
 	    mswfontptr >= mswfonts; mswfontptr--)
- 	{
- 	  /* display device */
- 	  inst_list = Fcons (Fcons (list1 (Qmswindows),
- 				    build_string (*mswfontptr)),
- 			     inst_list);
- 	  /* printer device */
- 	  inst_list = Fcons (Fcons (list1 (Qmsprinter),
- 				    build_string (*mswfontptr)),
- 			     inst_list);
- 	}
+	{
+	  /* display device */
+	  inst_list = Fcons (Fcons (list1 (Qmswindows),
+				    build_string (*mswfontptr)),
+			     inst_list);
+	  /* printer device */
+	  inst_list = Fcons (Fcons (list1 (Qmsprinter),
+				    build_string (*mswfontptr)),
+			     inst_list);
+	}
        /* Use Lucida Console rather than Courier New if it exists -- the
-          line spacing is much less, so many more lines fit with the same
-          size font. (And it's specifically designed for screens.) */
+	  line spacing is much less, so many more lines fit with the same
+	  size font. (And it's specifically designed for screens.) */
        inst_list = Fcons (Fcons (list1 (Qmswindows),
 				 build_string ("Lucida Console:Regular:10::")),
 			  inst_list);



1.28      +51 -50    XEmacs/xemacs/src/redisplay-output.c

Index: redisplay-output.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/redisplay-output.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -p -r1.27 -r1.28
--- redisplay-output.c	2006/06/27 22:59:40	1.27
+++ redisplay-output.c	2007/09/26 13:28:01	1.28
@@ -79,9 +79,9 @@ sync_rune_structs (struct window *UNUSED
   if (max_move)
     {
       /* #### Doing this directly breaks the encapsulation.  But, the
-         running time of this function has a measurable impact on
-         redisplay performance so avoiding all excess overhead is a
-         good thing.  Is all of this true? */
+	 running time of this function has a measurable impact on
+	 redisplay performance so avoiding all excess overhead is a
+	 good thing.  Is all of this true? */
       memcpy (cra->base, dra->base, sizeof (struct rune) * max_move);
       Dynarr_set_size (cra, max_move);
     }
@@ -237,8 +237,8 @@ compare_runes (struct window *w, struct 
 	    !EQ (crb->object.dglyph.extent, drb->object.dglyph.extent) ||
 	    crb->object.dglyph.xoffset != drb->object.dglyph.xoffset ||
 	    crb->object.dglyph.yoffset != drb->object.dglyph.yoffset ||
-            crb->object.dglyph.ascent != drb->object.dglyph.ascent ||
-            crb->object.dglyph.descent != drb->object.dglyph.descent))
+	    crb->object.dglyph.ascent != drb->object.dglyph.ascent ||
+	    crb->object.dglyph.descent != drb->object.dglyph.descent))
     return 0;
   /* Only check dirtiness if we know something has changed. */
   else if (crb->type == RUNE_DGLYPH &&
@@ -246,14 +246,14 @@ compare_runes (struct window *w, struct 
 	    crb->findex != drb->findex))
     {
       /* We need some way of telling redisplay_output_layout () that the
-         only reason we are outputting it is because something has
-         changed internally. That way we can optimize whether we need
-         to clear the layout first and also only output the components
-         that have changed. The image_instance dirty flag and
-         display_hash are no good to us because these will invariably
-         have been set anyway if the layout has changed. So it looks
-         like we need yet another change flag that we can set here and
-         then clear in redisplay_output_layout (). */
+	 only reason we are outputting it is because something has
+	 changed internally. That way we can optimize whether we need
+	 to clear the layout first and also only output the components
+	 that have changed. The image_instance dirty flag and
+	 display_hash are no good to us because these will invariably
+	 have been set anyway if the layout has changed. So it looks
+	 like we need yet another change flag that we can set here and
+	 then clear in redisplay_output_layout (). */
       Lisp_Object window, image;
       Lisp_Image_Instance* ii;
       window = wrap_window (w);
@@ -340,16 +340,16 @@ compare_runes_2 (struct window *w, struc
 	  image = glyph_image_instance (crb->object.dglyph.glyph,
 					window, crb->object.dglyph.matchspec,
 					ERROR_ME_DEBUG_WARN, 1);
-	  
+
 	  if (!IMAGE_INSTANCEP (image))
 	    return 0;
 	  ii = XIMAGE_INSTANCE (image);
-	  
+
 	  if (TEXT_IMAGE_INSTANCEP (image) &&
 	      (crb->findex != drb->findex ||
 	       WINDOW_FACE_CACHEL_DIRTY (w, drb->findex)))
 	    return 0;
-	  
+
 	  /* It is quite common for the two glyphs to be EQ since in many
 	     cases they will actually be the same object. This does not
 	     mean, however, that nothing has changed. We therefore need to
@@ -366,7 +366,7 @@ compare_runes_2 (struct window *w, struc
 		 take some short cuts. This is most useful for
 		 layouts. This flag should get reset by the output
 		 routines.
-		 
+
 		 #### It is possible for us to get here when the
 		 face_cachel is dirty. I do not know what the implications
 		 of this are.*/
@@ -540,12 +540,12 @@ compare_display_blocks (struct window *w
 
   if (f->windows_structure_changed ||
       /* #### Why is this so? We have face cachels so that we don't
-         have to recalculate all the display blocks when faces
-         change. I have fixed this for glyphs and am inclined to think
-         that faces should "Just Work", but I'm not feeling brave
-         today. Maybe its because the face cachels represent merged
-         faces rather than simply instantiations in a particular
-         domain. */
+	 have to recalculate all the display blocks when faces
+	 change. I have fixed this for glyphs and am inclined to think
+	 that faces should "Just Work", but I'm not feeling brave
+	 today. Maybe its because the face cachels represent merged
+	 faces rather than simply instantiations in a particular
+	 domain. */
       f->faces_changed ||
       cdl->ypos != ddl->ypos ||
       cdl->ascent != ddl->ascent ||
@@ -706,9 +706,9 @@ output_display_line (struct window *w, d
       struct display_block *db;
 
       /* If the lines cursor parameter is not -1 then it indicates
-         which rune in the TEXT block contains the cursor.  This means
-         that there must be at least one display block.  The TEXT
-         block, if present, must always be the first display block. */
+	 which rune in the TEXT block contains the cursor.  This means
+	 that there must be at least one display block.  The TEXT
+	 block, if present, must always be the first display block. */
       assert (Dynarr_length (ddba) != 0);
 
       db = Dynarr_atp (ddba, 0);
@@ -727,7 +727,7 @@ output_display_line (struct window *w, d
   if (ddl->modeline)
     {
       /* The shadow thickness check is necessary if only the sign of
-         the size changed. */
+	 the size changed. */
       if (cdba && !w->shadow_thickness_changed)
 	{
 	  must_sync |= compare_display_blocks (w, cdl, ddl, 0, 0,
@@ -753,13 +753,13 @@ output_display_line (struct window *w, d
 				      &next_start_pixpos);
 
       /* If we didn't find a block then we should blank the area
-         between start_pos and next_start if necessary. */
+	 between start_pos and next_start if necessary. */
       if (block == NO_BLOCK)
 	{
 	  /* We only erase those areas which were actually previously
-             covered by a display block unless the window structure
-             changed.  In that case we clear all areas since the current
-             structures may actually represent a different buffer. */
+	     covered by a display block unless the window structure
+	     changed.  In that case we clear all areas since the current
+	     structures may actually represent a different buffer. */
 	  while (start_pixpos < next_start_pixpos)
 	    {
 	      int block_end;
@@ -795,18 +795,19 @@ output_display_line (struct window *w, d
 
 		  if (x < ddl->bounds.left_in)
 		    {
-		      findex = ddl->left_margin_findex ?
+		      findex = (ddl->left_margin_findex > DEFAULT_INDEX) ?
 			ddl->left_margin_findex
 			: get_builtin_face_cache_index (w, Vleft_margin_face);
 		    }
 		  else if (x < ddl->bounds.right_in)
 		    {
-		      /* no check here because DEFAULT_INDEX == 0 anyway */
-		      findex = ddl->default_findex;
+		      findex = (ddl->default_findex >= DEFAULT_INDEX) ?
+			ddl->default_findex
+			: DEFAULT_INDEX;
 		    }
 		  else if (x < ddl->bounds.right_out)
 		    {
-		      findex = ddl->right_margin_findex ?
+		      findex = (ddl->right_margin_findex > DEFAULT_INDEX) ?
 			ddl->right_margin_findex
 			: get_builtin_face_cache_index (w, Vright_margin_face);
 		    }
@@ -852,7 +853,7 @@ output_display_line (struct window *w, d
 	     ddb and output only the changed region. */
 	  if (!force && cdb && ddb->type == cdb->type
 	      /* If there was no buffer being display before the
-                 compare anyway as we might be outputting a gutter. */
+		 compare anyway as we might be outputting a gutter. */
 	      &&
 	      (b == old_b || !old_b))
 	    {
@@ -1452,15 +1453,15 @@ redisplay_output_layout (Lisp_Object dom
 	  /* The bevel_area routines always draw in from the specified
 	     area so there is no need to adjust the displayed area to
 	     make sure that the lines are visible. */
-	  if (dga->xoffset >= 0) 
+	  if (dga->xoffset >= 0)
 	    edges |= EDGE_LEFT;
-	  if (dga->width - dga->xoffset == layout_width) 
+	  if (dga->width - dga->xoffset == layout_width)
 	    edges |= EDGE_RIGHT;
-	  if (dga->yoffset >= 0) 
+	  if (dga->yoffset >= 0)
 	    edges |= EDGE_TOP;
 	  if (dga->height - dga->yoffset == layout_height)
 	    edges |= EDGE_BOTTOM;
-	  
+
 	  if (EQ (IMAGE_INSTANCE_LAYOUT_BORDER (p), Qetched_in))
 	    style = EDGE_ETCHED_IN;
 	  else if (EQ (IMAGE_INSTANCE_LAYOUT_BORDER (p), Qetched_out))
@@ -1650,7 +1651,7 @@ redisplay_output_pixmap (struct window *
 
 #ifdef DEBUG_REDISPLAY
   printf ("redisplay_output_pixmap(request) \
-[%dx%d@%d+%d] in [%dx%d@%d+%d]\n", 
+[%dx%d@%d+%d] in [%dx%d@%d+%d]\n",
 	  db->width, db->height, db->xpos, db->ypos,
 	  dga->width, dga->height, dga->xoffset, dga->yoffset);
 #endif
@@ -1832,7 +1833,7 @@ redisplay_clear_clipped_region (Lisp_Obj
       int yoffset = (glyphsrc->yoffset > 0 ? glyphsrc->yoffset : 0);
 
       /* We need to make sure that subwindows are unmapped from the
-         whole area. */
+	 whole area. */
       redisplay_unmap_subwindows_except_us (f, clear_x, dest->ypos,
 					    glyphsrc->width, dest->height,
 					    ignored_subwindow);
@@ -1869,7 +1870,7 @@ redisplay_clear_clipped_region (Lisp_Obj
 
 	xpos - absolute horizontal position of area.
 
-  	ypos - absolute vertical position of area.
+	ypos - absolute vertical position of area.
 
   glyphsrc - display_glyph_area
 
@@ -1926,7 +1927,7 @@ redisplay_normalize_glyph_area (struct d
       /* glyphsrc offset is -ve we are trying to display hard up
 	 against the dest corner inset into the glyphsrc by
 	 xoffset.*/
-      else if (glyphsrc->xoffset < 0) 
+      else if (glyphsrc->xoffset < 0)
 	{
 	  glyphsrc->width += glyphsrc->xoffset;
 	  glyphsrc->width = min (glyphsrc->width, dest->width);
@@ -1935,7 +1936,7 @@ redisplay_normalize_glyph_area (struct d
 	glyphsrc->width = dest->width;
     }
 
-  else if (glyphsrc->xoffset < 0) 
+  else if (glyphsrc->xoffset < 0)
     glyphsrc->width += glyphsrc->xoffset;
 
   /* Vertical offsets. This works because yoffset can be -ve as well as +ve */
@@ -1943,7 +1944,7 @@ redisplay_normalize_glyph_area (struct d
     {
       if ((glyphsrc->yoffset > 0) && (dest->height > glyphsrc->yoffset))
 	glyphsrc->height = dest->height - glyphsrc->yoffset;
-      else if (glyphsrc->yoffset < 0) 
+      else if (glyphsrc->yoffset < 0)
 	{
 	  glyphsrc->height += glyphsrc->yoffset;
 	  glyphsrc->height = min (glyphsrc->height, dest->height);
@@ -2038,7 +2039,7 @@ redisplay_display_boxes_in_window_p (str
 int
 redisplay_calculate_display_boxes (struct display_line *dl, int xpos,
 				   int xoffset, int yoffset, int start_pixpos,
-                                   int width, struct display_box* dest,
+				   int width, struct display_box* dest,
 				   struct display_glyph_area* src)
 {
   dest->xpos = xpos;
@@ -2055,13 +2056,13 @@ redisplay_calculate_display_boxes (struc
   if (start_pixpos >=0 && start_pixpos > xpos)
     {
       /* Oops, we're asking for a start outside of the displayable
-         area. */
+	 area. */
       if (start_pixpos > xpos + width)
 	return 0;
       dest->xpos = start_pixpos;
       dest->width -= (start_pixpos - xpos);
       /* Offsets are -ve when we want to clip pixels off the displayed
-         glyph. */
+	 glyph. */
       src->xoffset -= (start_pixpos - xpos);
     }
 
@@ -2543,7 +2544,7 @@ redisplay_redraw_exposed_window (struct 
       end_y = min (WINDOW_BOTTOM (w), y + height);
 
       /* We do this to make sure that the 3D modelines get redrawn if
-         they are in the exposed region. */
+	 they are in the exposed region. */
       orig_windows_structure_changed = f->windows_structure_changed;
       f->windows_structure_changed = 1;
     }



1.102     +482 -483  XEmacs/xemacs/src/redisplay.c

Index: redisplay.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/redisplay.c,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -p -r1.101 -r1.102
--- redisplay.c	2006/11/05 22:31:45	1.101
+++ redisplay.c	2007/09/26 13:28:01	1.102
@@ -161,9 +161,9 @@ typedef struct position_redisplay_data_t
 			   to be skipped before anything is displayed. */
   Bytexpos byte_start_col_enabled;
   int start_col_xoffset;	/* Number of pixels that still need to
-                                   be skipped.  This is used for
-                                   horizontal scrolling of glyphs, where we want
-                                   to be able to scroll over part of the glyph. */
+				   be skipped.  This is used for
+				   horizontal scrolling of glyphs, where we want
+				   to be able to scroll over part of the glyph. */
 
   int hscroll_glyph_width_adjust;  /* how much the width of the hscroll
 				      glyph differs from space_width (w).
@@ -198,7 +198,7 @@ typedef struct position_redisplay_data_t
   Charcount modeline_charpos; /* Number of chars used in result_str so far;
 				 corresponds to bytepos. */
   Bytecount bytepos; /* Number of bytes used in result_str so far.
-		        We don't actually copy the bytes into result_str
+			We don't actually copy the bytes into result_str
 			until the end because we don't know how big the
 			string is going to be until then. */
 } pos_data;
@@ -258,7 +258,7 @@ struct prop_block
     struct
     {
       /* Not used as yet, but could be used to wrap rather than clip glyphs. */
-      int width;		
+      int width;
       Lisp_Object glyph;
     } p_glyph;
 
@@ -301,7 +301,7 @@ static void update_line_start_cache (str
 				     int no_regen);
 static int point_visible (struct window *w, Charbpos point, int type);
 static void calculate_yoffset (struct display_line *dl,
-                               struct display_block *fixup);
+			       struct display_block *fixup);
 static void calculate_baseline (pos_data *data);
 
 #ifdef ERROR_CHECK_DISPLAY
@@ -320,7 +320,7 @@ static Fixnum max_preempts;
  (preempted =								\
   (!disable_preemption &&						\
    ((preemption_count < max_preempts) || !NILP (Vexecuting_macro)) &&	\
-   (!INTERACTIVE || 							\
+   (!INTERACTIVE ||							\
     detect_input_pending (QUEUED_EVENTS_REQUIRED_FOR_PREEMPTION)))))
 
 /*
@@ -713,7 +713,7 @@ get_display_block_from_line (struct disp
 	}
 
       /* There isn't an active block of the desired type, but there
-         might still be allocated blocks we need to reuse. */
+	 might still be allocated blocks we need to reuse. */
       if (elt < Dynarr_largest (dl->display_blocks))
 	{
 	  struct display_block *dbp = Dynarr_atp (dl->display_blocks, elt);
@@ -729,7 +729,7 @@ get_display_block_from_line (struct disp
   else
     {
       /* This line doesn't have any display blocks, so initialize the display
-         bock array. */
+	 bock array. */
       dl->display_blocks = Dynarr_new (display_block);
     }
 
@@ -847,11 +847,11 @@ calculate_yoffset (struct display_line *
     {
       struct rune *r = Dynarr_atp (fixup->runes,i);
       if (r->type == RUNE_DGLYPH)
-        {
-          if (r->object.dglyph.ascent < dl->ascent)
-            r->object.dglyph.yoffset = dl->ascent - r->object.dglyph.ascent +
+	{
+	  if (r->object.dglyph.ascent < dl->ascent)
+	    r->object.dglyph.yoffset = dl->ascent - r->object.dglyph.ascent +
 	      r->object.dglyph.descent;
-        }
+	}
     }
 }
 
@@ -897,11 +897,11 @@ calculate_baseline (pos_data *data)
   if (!data->new_ascent && !data->new_descent)
     {
       /* We've got a blank line so initialize these values from the default
-         face. */
+	 face. */
       default_face_font_info (data->window, &data->new_ascent,
 			      &data->new_descent, 0, 0, 0);
     }
-  
+
   /* No automatically positioned glyphs? Return at once. */
   if (!data->need_baseline_computation)
     return;
@@ -913,7 +913,7 @@ calculate_baseline (pos_data *data)
     {
       int default_font_ascent, default_font_descent, default_font_height;
       int scaled_default_font_ascent, scaled_default_font_descent;
-      
+
       default_face_font_info (data->window, &default_font_ascent,
 			      &default_font_descent, &default_font_height,
 			      0, 0);
@@ -924,16 +924,16 @@ calculate_baseline (pos_data *data)
       data->new_ascent = max (data->new_ascent, scaled_default_font_ascent);
 
       /* The ascent may have expanded now. Do we still need to grow the descent,
-         or are things big enough?
+	 or are things big enough?
 
-         The +1 caters for the baseline row itself. */
+	 The +1 caters for the baseline row itself. */
       if (data->max_pixmap_height > data->new_ascent + data->new_descent)
-        {
-          scaled_default_font_descent = (data->max_pixmap_height *
+	{
+	  scaled_default_font_descent = (data->max_pixmap_height *
 					 default_font_descent / default_font_height) + 1;
 
-          data->new_descent = max (data->new_descent, scaled_default_font_descent);
-        }
+	  data->new_descent = max (data->new_descent, scaled_default_font_descent);
+	}
     }
 }
 
@@ -1127,7 +1127,7 @@ add_ichar_rune_1 (pos_data *data, int no
 	      Ichar ch = data->font_is_bogus ? '~' : data->ch;
 
 	      data->last_char_width =
-		redisplay_text_width_ichar_string (XWINDOW (data->window), 
+		redisplay_text_width_ichar_string (XWINDOW (data->window),
 						    data->findex, &ch, 1);
 	    }
 	  else
@@ -1302,7 +1302,7 @@ add_blank_rune (pos_data *data, struct w
       prop_block_dynarr *retval;
 
       /* If we have still not fully scrolled horizontally, subtract
-         the width of this tab and return. */
+	 the width of this tab and return. */
       if (char_tab_width < data->start_col)
 	{
 	  data->start_col -= char_tab_width;
@@ -1630,7 +1630,7 @@ add_disp_table_entry_runes (pos_data *da
 	     comment sounds familiar. */
 
 	  /* #### Still need to add any remaining elements to the
-             propagation information. */
+	     propagation information. */
 	  if (prop)
 	    return prop;
 	}
@@ -1722,11 +1722,11 @@ add_propagation_runes (prop_block_dynarr
 		XBUFFER (WINDOW_BUFFER (XWINDOW (data->window)));
 	      /* #### Chuck fix this shit or I'm gonna scream! */
 	      if (byte_old_charpos > BYTE_BUF_BEGV (buf))
-	        data->byte_charpos = prev_bytebpos (buf, byte_old_charpos);
-              else
+		data->byte_charpos = prev_bytebpos (buf, byte_old_charpos);
+	      else
 		/* #### is this correct?  Does anyone know?
 		   Does anyone care? Is this a cheesy hack or what? */
-	        data->byte_charpos = BYTE_BUF_BEGV (buf) - 1;
+		data->byte_charpos = BYTE_BUF_BEGV (buf) - 1;
 	    }
 	  }
 	  break;
@@ -1747,12 +1747,12 @@ add_propagation_runes (prop_block_dynarr
 	      data->blank_width = data->max_pixpos - data->pixpos;
 
 	    /* We pass a bogus value of char_tab_width.  It shouldn't
-               matter because unless something is really screwed up
-               this call won't cause that arg to be used. */
+	       matter because unless something is really screwed up
+	       this call won't cause that arg to be used. */
 	    add_failed = add_blank_rune (data, XWINDOW (data->window), 0);
 
 	    /* This can happen in the case where we have a tab which
-               is wider than the window. */
+	       is wider than the window. */
 	    if (data->blank_width != pb->data.p_blank.width)
 	      {
 		pb->data.p_blank.width -= data->blank_width;
@@ -1841,8 +1841,8 @@ add_glyph_rune (pos_data *data, struct g
 	  int glyph_char_width = width / space_width (w);
 
 	  /* If we still have not fully scrolled horizontally after
-             taking into account the width of the glyph, subtract its
-             width and return. */
+	     taking into account the width of the glyph, subtract its
+	     width and return. */
 	  if (glyph_char_width < data->start_col)
 	    {
 	      data->start_col -= glyph_char_width;
@@ -1879,7 +1879,7 @@ add_glyph_rune (pos_data *data, struct g
 	     than the window.  We could alternatively just completely
 	     ignore the glyph and proceed from there but I think that
 	     this is a better solution.
-	     
+
 	     This does, however, create a different problem in that we
 	     can end up adding the object to every single line, never
 	     getting any further - for instance an extent with a long
@@ -1901,7 +1901,7 @@ add_glyph_rune (pos_data *data, struct g
 	    width = data->max_pixpos - data->pixpos;
 	    /* Add the glyph we are displaying, but clipping, to the
 	       propagation data so that we don't try and do it
-	       again. */ 
+	       again. */
 	    retval = Dynarr_new (prop_block);
 	    pb.type = PROP_GLYPH;
 	    pb.data.p_glyph.glyph = gb->glyph;
@@ -1956,7 +1956,7 @@ add_glyph_rune (pos_data *data, struct g
 	      data->new_ascent = max (data->new_ascent, pix_ascent);
 	      data->new_descent = max (data->new_descent, pix_descent);
 	      data->max_pixmap_height = max (data->max_pixmap_height, height);
-	      
+
 	      rb.object.dglyph.descent = pix_descent;
 	    }
 
@@ -2001,7 +2001,7 @@ add_glyph_rune (pos_data *data, struct g
 	rb.endpos = bytebpos_to_charbpos (XBUFFER (WINDOW_BUFFER (w)),
 					  data->byte_endpos);
       else
-        rb.endpos = 0;
+	rb.endpos = 0;
       rb.type = RUNE_DGLYPH;
       rb.object.dglyph.glyph = gb->glyph;
       rb.object.dglyph.extent = gb->extent;
@@ -2274,8 +2274,8 @@ create_text_block (struct window *w, str
 	}
 
       /* If selective display was an integer and we aren't working on
-         a continuation line then find the next line we are actually
-         supposed to display. */
+	 a continuation line then find the next line we are actually
+	 supposed to display. */
       if (selective > 0
 	  && (data.byte_charpos == BYTE_BUF_BEGV (b)
 	      || BUF_FETCH_CHAR (b, prev_bytebpos (b, data.byte_charpos)) == '\n'))
@@ -2304,7 +2304,7 @@ create_text_block (struct window *w, str
 	     works because we always recalculate the extent-fragments
 	     for propagated data, we never actually propagate the
 	     fragments that still need to be displayed. */
-	  if (*prop && Dynarr_atp (*prop, 0)->type == PROP_GLYPH) 
+	  if (*prop && Dynarr_atp (*prop, 0)->type == PROP_GLYPH)
 	    {
 	      last_glyph = Dynarr_atp (*prop, 0)->data.p_glyph.glyph;
 	      Dynarr_free (*prop);
@@ -2323,12 +2323,12 @@ create_text_block (struct window *w, str
       initial = 0;
 
       /* Determine what is next to be displayed.  We first handle any
-         glyphs returned by glyphs_at_charbpos.  If there are no glyphs to
-         display then we determine what to do based on the character at the
-         current buffer position. */
+	 glyphs returned by glyphs_at_charbpos.  If there are no glyphs to
+	 display then we determine what to do based on the character at the
+	 current buffer position. */
 
       /* If the current position is covered by an invisible extent, do
-         nothing (except maybe add some ellipses).
+	 nothing (except maybe add some ellipses).
 
 	 #### The behavior of begin and end-glyphs at the edge of an
 	 invisible extent should be investigated further.  This is
@@ -2365,7 +2365,7 @@ create_text_block (struct window *w, str
 	    }
 
 	  /* If point is in an invisible region we place it on the
-             next visible character. */
+	     next visible character. */
 	  if (data.cursor_type == CURSOR_ON
 	      && data.byte_charpos == data.byte_cursor_charpos)
 	    {
@@ -2414,31 +2414,31 @@ create_text_block (struct window *w, str
 	  /* #### I think this is safe, but could be wrong. */
 	  data.ch = BYTE_BUF_FETCH_CHAR (b, data.byte_charpos);
 
-	  if (Dynarr_length (data.ef->end_glyphs) > 0) 
+	  if (Dynarr_length (data.ef->end_glyphs) > 0)
 	    {
 	      *prop = add_glyph_runes (&data, END_GLYPHS);
 	      tmpglyphs = data.ef->end_glyphs;
 	    }
 
 	  /* If there are begin glyphs, add them to the line. */
-	  if (!*prop && Dynarr_length (data.ef->begin_glyphs) > 0) 
+	  if (!*prop && Dynarr_length (data.ef->begin_glyphs) > 0)
 	    {
 	      *prop = add_glyph_runes (&data, BEGIN_GLYPHS);
 	      tmpglyphs = data.ef->begin_glyphs;
 	    }
 
-	  if (*prop) 
+	  if (*prop)
 	    {
 	      /* If we just clipped a glyph and we are at the end of a
 		 line and there are more glyphs to display then do
 		 appropriate processing to not get a continuation
 		 glyph. */
-	      if (*prop != ADD_FAILED 
+	      if (*prop != ADD_FAILED
 		  && Dynarr_atp (*prop, 0)->type == PROP_GLYPH
 		  && data.ch == '\n')
-		{ 
+		{
 		  /* If there are no more glyphs then do the normal
-		     processing. 
+		     processing.
 
 		     #### This doesn't actually work if the same glyph is
 		     present more than once in the block. To solve
@@ -2477,7 +2477,7 @@ create_text_block (struct window *w, str
 	    entry = display_table_entry (data.ch, face_dt, window_dt);
 
 	  /* If there is a display table entry for it, hand it off to
-             add_disp_table_entry_runes and let it worry about it. */
+	     add_disp_table_entry_runes and let it worry about it. */
 	  if (!NILP (entry) && !EQ (entry, make_char (data.ch)))
 	    {
 	      *prop = add_disp_table_entry_runes (&data, entry);
@@ -2487,12 +2487,12 @@ create_text_block (struct window *w, str
 	    }
 
 	  /* Check if we have hit a newline character.  If so, add a marker
-             to the line and end this loop. */
+	     to the line and end this loop. */
 	  else if (data.ch == '\n')
 	    {
 	      /* We aren't going to be adding an end glyph so give its
-                 space back in order to make sure that the cursor can
-                 fit. */
+		 space back in order to make sure that the cursor can
+		 fit. */
 	      data.max_pixpos += data.end_glyph_width;
 
 	      if (selective > 0
@@ -2520,10 +2520,10 @@ create_text_block (struct window *w, str
 		    }
 
 		  /* We need to set data.byte_charpos to the start of the
-                     next visible region in order to make this line
-                     appear to contain all of the invisible area.
-                     Otherwise, the line cache won't work
-                     correctly. */
+		     next visible region in order to make this line
+		     appear to contain all of the invisible area.
+		     Otherwise, the line cache won't work
+		     correctly. */
 		  INC_BYTEBPOS (b, data.byte_charpos);
 		  while (byte_spaces_at_point (b, data.byte_charpos) >= selective)
 		    {
@@ -2549,9 +2549,9 @@ create_text_block (struct window *w, str
 	    }
 
 	  /* If the current character is ^M, and selective display is
-             enabled, then add the invisible-text-glyph if
-             selective-display-ellipses is set.  In any case, this
-             line is done. */
+	     enabled, then add the invisible-text-glyph if
+	     selective-display-ellipses is set.  In any case, this
+	     line is done. */
 	  else if (data.ch == (('M' & 037)) && selective == -1)
 	    {
 	      Bytebpos byte_next_charpos;
@@ -2564,7 +2564,7 @@ create_text_block (struct window *w, str
 		DEC_BYTEBPOS (b, byte_next_charpos);
 
 	      /* If the cursor is somewhere in the elided text make
-                 sure that the cursor gets drawn appropriately. */
+		 sure that the cursor gets drawn appropriately. */
 	      if (data.cursor_type == CURSOR_ON
 		  && (data.byte_cursor_charpos >= data.byte_charpos &&
 		      data.byte_cursor_charpos < byte_next_charpos))
@@ -2573,14 +2573,14 @@ create_text_block (struct window *w, str
 		}
 
 	      /* We won't be adding a truncation or continuation glyph
-                 so give up the room allocated for them. */
+		 so give up the room allocated for them. */
 	      data.max_pixpos += data.end_glyph_width;
 
 	      if (!NILP (b->selective_display_ellipses))
 		{
 		  /* We don't propagate anything from the invisible
-                     text glyph if it fails to fit.  This is
-                     intentional. */
+		     text glyph if it fails to fit.  This is
+		     intentional. */
 		  struct glyph_block gb;
 
 		  gb.extent = Qnil;
@@ -2590,16 +2590,16 @@ create_text_block (struct window *w, str
 		}
 
 	      /* Set the buffer position to the end of the line.  We
-                 need to do this before potentially adding a newline
-                 so that the cursor flag will get set correctly (if
-                 needed). */
+		 need to do this before potentially adding a newline
+		 so that the cursor flag will get set correctly (if
+		 needed). */
 	      data.byte_charpos = byte_next_charpos;
 
 	      if (NILP (b->selective_display_ellipses)
 		  || data.byte_cursor_charpos == byte_next_charpos)
 		{
 		  /* We have to at least add a newline character so
-                     that the cursor shows up properly. */
+		     that the cursor shows up properly. */
 		  data.ch = '\n';
 		  data.blank_width = DEVMETH (d, eol_cursor_width, ());
 		  data.findex = DEFAULT_INDEX;
@@ -2611,15 +2611,15 @@ create_text_block (struct window *w, str
 		}
 
 	      /* This had better be a newline but doing it this way
-                 we'll see obvious incorrect results if it isn't.  No
-                 need to abort here. */
+		 we'll see obvious incorrect results if it isn't.  No
+		 need to abort here. */
 	      data.ch = BYTE_BUF_FETCH_CHAR (b, data.byte_charpos);
 
 	      goto done;
 	    }
 
 	  /* If the current character is considered to be printable, then
-             just add it. */
+	     just add it. */
 	  else if (data.ch >= printable_min)
 	    {
 	      *prop = add_ichar_rune (&data);
@@ -2628,8 +2628,8 @@ create_text_block (struct window *w, str
 	    }
 
 	  /* If the current character is a tab, determine the next tab
-             starting position and add a blank rune which extends from the
-             current pixel position to that starting position. */
+	     starting position and add a blank rune which extends from the
+	     current pixel position to that starting position. */
 	  else if (data.ch == '\t')
 	    {
 	      int tab_start_pixpos = data.pixpos;
@@ -2657,7 +2657,7 @@ create_text_block (struct window *w, str
 	      *prop = add_blank_rune (&data, w, char_tab_width);
 
 	      /* add_blank_rune is only supposed to be called with
-                 sizes guaranteed to fit in the available space. */
+		 sizes guaranteed to fit in the available space. */
 	      assert (!(*prop));
 
 	      if (prop_width)
@@ -2675,7 +2675,7 @@ create_text_block (struct window *w, str
 	    }
 
 	  /* If character is a control character, pass it off to
-             add_control_char_runes.
+	     add_control_char_runes.
 
 	     The is_*() routines have undefined results on
 	     arguments outside of the range [-1, 255].  (This
@@ -2691,7 +2691,7 @@ create_text_block (struct window *w, str
 	    }
 
 	  /* If the character is above the ASCII range and we have not
-             already handled it, then print it as an octal number. */
+	     already handled it, then print it as an octal number. */
 	  else if (data.ch >= 0200)
 	    {
 	      *prop = add_octal_runes (&data);
@@ -2701,7 +2701,7 @@ create_text_block (struct window *w, str
 	    }
 
 	  /* Assume the current character is considered to be printable,
-             then just add it. */
+	     then just add it. */
 	  else
 	    {
 	      *prop = add_ichar_rune (&data);
@@ -2729,14 +2729,14 @@ done:
 	 check. */
 
       /* The common case is that the line ended because we hit a newline.
-         In that case, the next character is just the next buffer
-         position. */
+	 In that case, the next character is just the next buffer
+	 position. */
       if (data.ch == '\n')
 	{
 	  /* If data.start_col_enabled is still true, then the window is
-             scrolled far enough so that nothing on this line is visible.
-             We need to stick a truncation glyph at the beginning of the
-             line in that case unless the line is completely blank. */
+	     scrolled far enough so that nothing on this line is visible.
+	     We need to stick a truncation glyph at the beginning of the
+	     line in that case unless the line is completely blank. */
 	  if (data.byte_start_col_enabled)
 	    {
 	      if (data.cursor_type == CURSOR_ON)
@@ -2761,7 +2761,7 @@ done:
 	      else
 		{
 		  /* This duplicates code down below to add a newline to
-                     the end of an otherwise empty line.*/
+		     the end of an otherwise empty line.*/
 		  data.ch = '\n';
 		  data.blank_width = DEVMETH (d, eol_cursor_width, ());
 
@@ -2773,16 +2773,16 @@ done:
 	}
 
       /* Otherwise we have a buffer line which cannot fit on one display
-         line. */
+	 line. */
       else
 	{
 	  struct glyph_block gb;
 	  struct glyph_cachel *cachel;
 
 	  /* If the line is to be truncated then we actually have to look
-             for the next newline.  We also add the end-of-line glyph which
-             we know will fit because we adjusted the right border before
-             we starting laying out the line. */
+	     for the next newline.  We also add the end-of-line glyph which
+	     we know will fit because we adjusted the right border before
+	     we starting laying out the line. */
 	  data.max_pixpos += data.end_glyph_width;
 	  data.findex = DEFAULT_INDEX;
 	  gb.extent = Qnil;
@@ -2795,11 +2795,11 @@ done:
 	      byte_pos = byte_find_next_newline_no_quit (b, data.byte_charpos, 1);
 
 	      /* If the cursor is past the truncation line then we
-                 make it appear on the truncation glyph.  If we've hit
-                 the end of the buffer then we also make the cursor
-                 appear unless eob is immediately preceded by a
-                 newline.  In that case the cursor should actually
-                 appear on the next line. */
+		 make it appear on the truncation glyph.  If we've hit
+		 the end of the buffer then we also make the cursor
+		 appear unless eob is immediately preceded by a
+		 newline.  In that case the cursor should actually
+		 appear on the next line. */
 	      if (data.cursor_type == CURSOR_ON
 		  && data.byte_cursor_charpos >= data.byte_charpos
 		  && (data.byte_cursor_charpos < byte_pos ||
@@ -2839,9 +2839,9 @@ done:
 	   && (!echo_area_active (f) || data.byte_charpos == BYTE_BUF_ZV (b)))
     {
       /* We need to add a marker to the end of the line since there is no
-         newline character in order for the cursor to get drawn.  We label
-         it as a newline so that it gets handled correctly by the
-         whitespace routines below. */
+	 newline character in order for the cursor to get drawn.  We label
+	 it as a newline so that it gets handled correctly by the
+	 whitespace routines below. */
 
       data.ch = '\n';
       data.blank_width = DEVMETH (d, eol_cursor_width, ());
@@ -3026,12 +3026,12 @@ create_overlay_glyph_block (struct windo
       gb.extent = Qnil;
       add_glyph_rune (&data, &gb, BEGIN_GLYPHS, 0, 0);
     }
-  
+
   if (data.max_pixmap_height)
     {
       int height = data.new_ascent + data.new_descent;
       int pix_ascent, pix_descent;
-      
+
       pix_descent = data.max_pixmap_height * data.new_descent / height;
       pix_ascent = data.max_pixmap_height - pix_descent;
       calculate_baseline (&data);
@@ -3271,13 +3271,13 @@ create_left_glyph_block (struct window *
 	int width = Dynarr_atp (ib, marker)->width;
 
 	/* If everything now fits in the available inside margin
-           space, we're done. */
+	   space, we're done. */
 	if (used_in <= avail_in)
 	  done = 1;
 	else
 	  {
 	    /* Otherwise see if we have room to move a glyph to the
-               outside. */
+	       outside. */
 	    if (used_out + width <= avail_out)
 	      {
 		used_out += width;
@@ -3377,8 +3377,8 @@ create_left_glyph_block (struct window *
       odb = get_display_block_from_line (dl, LEFT_OUTSIDE_MARGIN);
       odb->start_pos = dl->bounds.left_out;
       /* #### We should stop adding a blank to account for the space
-         between the end of the glyphs and the margin and instead set
-         this accordingly. */
+	 between the end of the glyphs and the margin and instead set
+	 this accordingly. */
       odb->end_pos = dl->bounds.left_in;
       Dynarr_reset (odb->runes);
     }
@@ -3585,13 +3585,13 @@ create_right_glyph_block (struct window 
 	int width = Dynarr_atp (ib, marker)->width;
 
 	/* If everything now fits in the available inside margin
-           space, we're done. */
+	   space, we're done. */
 	if (used_in <= avail_in)
 	  done = 1;
 	else
 	  {
 	    /* Otherwise see if we have room to move a glyph to the
-               outside. */
+	       outside. */
 	    if (used_out + width <= avail_out)
 	      {
 		used_out += width;
@@ -3688,7 +3688,7 @@ create_right_glyph_block (struct window 
     {
       odb = get_display_block_from_line (dl, RIGHT_OUTSIDE_MARGIN);
       /* #### See comments before odb->start_pos init in
-         create_left_glyph_block */
+	 create_left_glyph_block */
       odb->start_pos = dl->bounds.right_in;
       odb->end_pos = dl->bounds.right_out;
       Dynarr_reset (odb->runes);
@@ -3701,7 +3701,7 @@ create_right_glyph_block (struct window 
       idb = get_display_block_from_line (dl, RIGHT_INSIDE_MARGIN);
       idb->start_pos = dl->bounds.right_white;
       /* #### See comments before odb->start_pos init in
-         create_left_glyph_block */
+	 create_left_glyph_block */
       idb->end_pos = dl->bounds.right_in;
       Dynarr_reset (idb->runes);
     }
@@ -3785,9 +3785,9 @@ create_right_glyph_block (struct window 
 /* This function is also used in frame.c by `generate_title_string' */
 void
 generate_formatted_string_db (Lisp_Object format_str, Lisp_Object result_str,
-                              struct window *w, struct display_line *dl,
-                              struct display_block *db, face_index findex,
-                              int min_pixpos, int max_pixpos, int type)
+			      struct window *w, struct display_line *dl,
+			      struct display_block *db, face_index findex,
+			      int min_pixpos, int max_pixpos, int type)
 {
   struct frame *f = XFRAME (w->frame);
   struct device *d = XDEVICE (f->device);
@@ -3821,13 +3821,13 @@ generate_formatted_string_db (Lisp_Objec
   if (! NILP (result_str))
     offset = w->modeline_hscroll;
   generate_fstring_runes (w, &data, 0, 0, -1, format_str, 0,
-                          max_pixpos - min_pixpos, findex, type, &offset,
+			  max_pixpos - min_pixpos, findex, type, &offset,
 			  Qnil);
 
   if (Dynarr_length (db->runes))
     {
       struct rune *rb =
-        Dynarr_atp (db->runes, Dynarr_length (db->runes) - 1);
+	Dynarr_atp (db->runes, Dynarr_length (db->runes) - 1);
       c_pixpos = rb->xpos + rb->width;
     }
   else
@@ -3859,44 +3859,44 @@ generate_formatted_string_db (Lisp_Objec
       sledgehammer_check_ascii_begin (result_str);
       detach_all_extents (result_str);
       resize_string (result_str, -1,
-                     data.bytepos - XSTRING_LENGTH (result_str));
+		     data.bytepos - XSTRING_LENGTH (result_str));
 
       strdata = XSTRING_DATA (result_str);
 
       for (elt = 0, len = 0; elt < Dynarr_length (db->runes); elt++)
-        {
-          if (Dynarr_atp (db->runes, elt)->type == RUNE_CHAR)
-            {
-              len += (set_itext_ichar
-                      (strdata + len, Dynarr_atp (db->runes,
-                                                  elt)->object.chr.ch));
-            }
-        }
+	{
+	  if (Dynarr_atp (db->runes, elt)->type == RUNE_CHAR)
+	    {
+	      len += (set_itext_ichar
+		      (strdata + len, Dynarr_atp (db->runes,
+						  elt)->object.chr.ch));
+	    }
+	}
 
       init_string_ascii_begin (result_str);
       bump_string_modiff (result_str);
       sledgehammer_check_ascii_begin (result_str);
 
       for (elt = 0; elt < Dynarr_length (formatted_string_extent_dynarr);
-           elt++)
-        {
-          Lisp_Object extent = Qnil;
-          Lisp_Object child;
-
-          extent = wrap_extent (Dynarr_at (formatted_string_extent_dynarr, elt));
-          child = Fgethash (extent, buf->modeline_extent_table, Qnil);
-          if (NILP (child))
-            {
-              child = Fmake_extent (Qnil, Qnil, result_str);
-              Fputhash (extent, child, buf->modeline_extent_table);
-            }
-          Fset_extent_parent (child, extent);
-          set_extent_endpoints
-            (XEXTENT (child),
-             Dynarr_at (formatted_string_extent_start_dynarr, elt),
-             Dynarr_at (formatted_string_extent_end_dynarr, elt),
-             result_str);
-        }
+	   elt++)
+	{
+	  Lisp_Object extent = Qnil;
+	  Lisp_Object child;
+
+	  extent = wrap_extent (Dynarr_at (formatted_string_extent_dynarr, elt));
+	  child = Fgethash (extent, buf->modeline_extent_table, Qnil);
+	  if (NILP (child))
+	    {
+	      child = Fmake_extent (Qnil, Qnil, result_str);
+	      Fputhash (extent, child, buf->modeline_extent_table);
+	    }
+	  Fset_extent_parent (child, extent);
+	  set_extent_endpoints
+	    (XEXTENT (child),
+	     Dynarr_at (formatted_string_extent_start_dynarr, elt),
+	     Dynarr_at (formatted_string_extent_end_dynarr, elt),
+	     result_str);
+	}
 
       in_modeline_generation = 0;
     }
@@ -3999,7 +3999,7 @@ generate_modeline (struct window *w, str
 
 static Charcount
 add_string_to_fstring_db_runes (pos_data *data, const Ibyte *str,
-                                Charcount pos, Charcount min_pos,
+				Charcount pos, Charcount min_pos,
 				Charcount max_pos)
 {
   /* This function has been Mule-ized. */
@@ -4012,7 +4012,7 @@ add_string_to_fstring_db_runes (pos_data
     add_blank_rune (data, NULL, 0);
 
   end = (Dynarr_length (db->runes) +
-         bytecount_to_charcount (str, strlen ((const char *) str)));
+	 bytecount_to_charcount (str, strlen ((const char *) str)));
   if (max_pos != -1)
     end = min (max_pos, end);
 
@@ -4025,15 +4025,15 @@ add_string_to_fstring_db_runes (pos_data
       succeeded = (add_ichar_rune (data) != ADD_FAILED);
       INC_IBYTEPTR (cur_pos);
       if (succeeded)
-        {
-          pos++;
-          data->modeline_charpos++;
-          data->bytepos += cur_pos - old_cur_pos;
-        }
+	{
+	  pos++;
+	  data->modeline_charpos++;
+	  data->bytepos += cur_pos - old_cur_pos;
+	}
     }
 
   while (Dynarr_length (db->runes) < min_pos &&
-         (data->pixpos + data->blank_width <= data->max_pixpos))
+	 (data->pixpos + data->blank_width <= data->max_pixpos))
     add_blank_rune (data, NULL, 0);
 
   return Dynarr_length (db->runes);
@@ -4043,7 +4043,7 @@ add_string_to_fstring_db_runes (pos_data
    modeline extents. */
 static Charcount
 add_glyph_to_fstring_db_runes (pos_data *data, Lisp_Object glyph,
-                               Charcount pos, Charcount UNUSED (min_pos),
+			       Charcount pos, Charcount UNUSED (min_pos),
 			       Charcount max_pos, Lisp_Object extent)
 {
   /* This function has been Mule-ized. */
@@ -4065,7 +4065,7 @@ add_glyph_to_fstring_db_runes (pos_data 
   pos++;
 
   while (Dynarr_length (db->runes) < pos &&
-         (data->pixpos + data->blank_width <= data->max_pixpos))
+	 (data->pixpos + data->blank_width <= data->max_pixpos))
     add_blank_rune (data, NULL, 0);
 
   return Dynarr_length (db->runes);
@@ -4085,9 +4085,9 @@ add_glyph_to_fstring_db_runes (pos_data 
    modeline. */
 static Charcount
 generate_fstring_runes (struct window *w, pos_data *data, Charcount pos,
-                        Charcount min_pos, Charcount max_pos,
-                        Lisp_Object elt, int depth, int max_pixsize,
-                        face_index findex, int type, Charcount *offset,
+			Charcount min_pos, Charcount max_pos,
+			Lisp_Object elt, int depth, int max_pixsize,
+			face_index findex, int type, Charcount *offset,
 			Lisp_Object cur_ext)
 {
   /* This function has been Mule-ized. */
@@ -4095,7 +4095,7 @@ generate_fstring_runes (struct window *w
 
      -- C zero-terminated-string lossage.
      -- Non-printable characters should be converted into something
-        appropriate (e.g. ^F) instead of blindly being printed anyway.
+	appropriate (e.g. ^F) instead of blindly being printed anyway.
    */
 
 tail_recurse:
@@ -4107,21 +4107,21 @@ tail_recurse:
   if (STRINGP (elt))
     {
       /* A string.  Add to the display line and check for %-constructs
-         within it. */
+	 within it. */
 
       Ibyte *this_str = XSTRING_DATA (elt);
 
       while ((pos < max_pos || max_pos == -1) && *this_str)
-        {
-          Ibyte *last = this_str;
+	{
+	  Ibyte *last = this_str;
 
-          while (*this_str && *this_str != '%')
-            this_str++;
+	  while (*this_str && *this_str != '%')
+	    this_str++;
 
-          if (this_str != last)
-            {
-              /* No %-construct */
-              Charcount size =
+	  if (this_str != last)
+	    {
+	      /* No %-construct */
+	      Charcount size =
 		bytecount_to_charcount (last, this_str - last);
 
 	      if (size <= *offset)
@@ -4135,73 +4135,73 @@ tail_recurse:
 		  pos = add_string_to_fstring_db_runes (data, tmp_last,
 							pos, pos, tmp_max);
 		  *offset = 0;
+		}
+	    }
+	  else /* *this_str == '%' */
+	    {
+	      Charcount spec_width = 0;
+
+	      this_str++; /* skip over '%' */
+
+	      /* We can't allow -ve args due to the "%-" construct.
+	       * Argument specifies minwidth but not maxwidth
+	       * (maxwidth can be specified by
+	       * (<negative-number> . <stuff>) modeline elements)
+	       */
+	      while (isdigit (*this_str))
+		{
+		  spec_width = spec_width * 10 + (*this_str - '0');
+		  this_str++;
+		}
+	      spec_width += pos;
+
+	      if (*this_str == 'M')
+		{
+		  pos = generate_fstring_runes (w, data, pos, spec_width,
+						max_pos, Vglobal_mode_string,
+						depth, max_pixsize, findex,
+						type, offset, cur_ext);
 		}
-            }
-          else /* *this_str == '%' */
-            {
-              Charcount spec_width = 0;
-
-              this_str++; /* skip over '%' */
-
-              /* We can't allow -ve args due to the "%-" construct.
-               * Argument specifies minwidth but not maxwidth
-               * (maxwidth can be specified by
-               * (<negative-number> . <stuff>) modeline elements)
-               */
-              while (isdigit (*this_str))
-                {
-                  spec_width = spec_width * 10 + (*this_str - '0');
-                  this_str++;
-                }
-              spec_width += pos;
-
-              if (*this_str == 'M')
-                {
-                  pos = generate_fstring_runes (w, data, pos, spec_width,
-                                                max_pos, Vglobal_mode_string,
-                                                depth, max_pixsize, findex,
-                                                type, offset, cur_ext);
-                }
-              else if (*this_str == '-')
-                {
-                  Charcount num_to_add;
-
-                  if (max_pixsize < 0)
-                    num_to_add = 0;
-                  else if (max_pos != -1)
-                    num_to_add = max_pos - pos;
-                  else
-                    {
-                      int cur_pixsize;
-                      int dash_pixsize;
-                      Ibyte ch = '-';
-                      SET_CURRENT_MODE_CHARS_PIXSIZE;
-
-                      dash_pixsize =
-                        redisplay_text_width_string (w, findex, &ch, Qnil, 0,
-                                                     1);
-		      
-		      if (dash_pixsize == 0) 
+	      else if (*this_str == '-')
+		{
+		  Charcount num_to_add;
+
+		  if (max_pixsize < 0)
+		    num_to_add = 0;
+		  else if (max_pos != -1)
+		    num_to_add = max_pos - pos;
+		  else
+		    {
+		      int cur_pixsize;
+		      int dash_pixsize;
+		      Ibyte ch = '-';
+		      SET_CURRENT_MODE_CHARS_PIXSIZE;
+
+		      dash_pixsize =
+			redisplay_text_width_string (w, findex, &ch, Qnil, 0,
+						     1);
+
+		      if (dash_pixsize == 0)
 			num_to_add = 0;
 		      else {
 			num_to_add = (max_pixsize - cur_pixsize) / dash_pixsize;
 			num_to_add++;
 		      }
-                    }
+		    }
 
-                  while (num_to_add--)
-                    pos = add_string_to_fstring_db_runes
-                      (data, (const Ibyte *) "-", pos, pos, max_pos);
-                }
-              else if (*this_str != 0)
-                {
-                  Ichar ch = itext_ichar (this_str);
-                  Ibyte *str;
+		  while (num_to_add--)
+		    pos = add_string_to_fstring_db_runes
+		      (data, (const Ibyte *) "-", pos, pos, max_pos);
+		}
+	      else if (*this_str != 0)
+		{
+		  Ichar ch = itext_ichar (this_str);
+		  Ibyte *str;
 		  Charcount size;
 
-                  decode_mode_spec (w, ch, type);
+		  decode_mode_spec (w, ch, type);
 
-                  str = Dynarr_atp (mode_spec_ibyte_string, 0);
+		  str = Dynarr_atp (mode_spec_ibyte_string, 0);
 		  size = bytecount_to_charcount
 		    /* Skip the null character added by `decode_mode_spec' */
 		    (str, Dynarr_length (mode_spec_ibyte_string)) - 1;
@@ -4220,35 +4220,35 @@ tail_recurse:
 							    max_pos);
 		      *offset = 0;
 		    }
-                }
+		}
 
-              /* NOT this_str++.  There could be any sort of character at
-                 the current position. */
-              INC_IBYTEPTR (this_str);
-            }
-
-          if (max_pixsize > 0)
-            {
-              int cur_pixsize;
-              SET_CURRENT_MODE_CHARS_PIXSIZE;
-
-              if (cur_pixsize >= max_pixsize)
-                break;
-            }
-        }
+	      /* NOT this_str++.  There could be any sort of character at
+		 the current position. */
+	      INC_IBYTEPTR (this_str);
+	    }
+
+	  if (max_pixsize > 0)
+	    {
+	      int cur_pixsize;
+	      SET_CURRENT_MODE_CHARS_PIXSIZE;
+
+	      if (cur_pixsize >= max_pixsize)
+		break;
+	    }
+	}
     }
   else if (SYMBOLP (elt))
     {
       /* A symbol: process the value of the symbol recursively
-         as if it appeared here directly. */
+	 as if it appeared here directly. */
       Lisp_Object tem = symbol_value_in_buffer (elt, w->buffer);
 
       if (!UNBOUNDP (tem))
-        {
+	{
 	  /* If value is a string, output that string literally:
-             don't check for % within it.  */
-          if (STRINGP (tem))
-            {
+	     don't check for % within it.  */
+	  if (STRINGP (tem))
+	    {
 	      Ibyte *str = XSTRING_DATA (tem);
 	      Charcount size = string_char_length (tem);
 
@@ -4265,14 +4265,14 @@ tail_recurse:
 							min_pos, max_pos);
 		  *offset = 0;
 		}
-            }
-          /* Give up right away for nil or t.  */
-          else if (!EQ (tem, elt))
-            {
-              elt = tem;
-              goto tail_recurse;
-            }
-        }
+	    }
+	  /* Give up right away for nil or t.  */
+	  else if (!EQ (tem, elt))
+	    {
+	      elt = tem;
+	      goto tail_recurse;
+	    }
+	}
     }
   else if (GENERIC_SPECIFIERP (elt))
     {
@@ -4341,97 +4341,97 @@ tail_recurse:
 	    }
 	}
       else if (INTP (car))
-        {
-          Charcount lim = XINT (car);
+	{
+	  Charcount lim = XINT (car);
 
-          elt = XCDR (elt);
+	  elt = XCDR (elt);
 
-          if (lim < 0)
-            {
-              /* Negative int means reduce maximum width.
-               * DO NOT change MIN_PIXPOS here!
-               * (20 -10 . foo) should truncate foo to 10 col
-               * and then pad to 20.
-               */
-              if (max_pos == -1)
-                max_pos = pos - lim;
-              else
-                max_pos = min (max_pos, pos - lim);
-            }
-          else if (lim > 0)
-            {
-              /* Padding specified.  Don't let it be more than
-               * current maximum.
-               */
-              lim += pos;
-              if (max_pos != -1 && lim > max_pos)
-                lim = max_pos;
-              /* If that's more padding than already wanted, queue it.
-               * But don't reduce padding already specified even if
-               * that is beyond the current truncation point.
-               */
-              if (lim > min_pos)
-                min_pos = lim;
-            }
-          goto tail_recurse;
-        }
+	  if (lim < 0)
+	    {
+	      /* Negative int means reduce maximum width.
+	       * DO NOT change MIN_PIXPOS here!
+	       * (20 -10 . foo) should truncate foo to 10 col
+	       * and then pad to 20.
+	       */
+	      if (max_pos == -1)
+		max_pos = pos - lim;
+	      else
+		max_pos = min (max_pos, pos - lim);
+	    }
+	  else if (lim > 0)
+	    {
+	      /* Padding specified.  Don't let it be more than
+	       * current maximum.
+	       */
+	      lim += pos;
+	      if (max_pos != -1 && lim > max_pos)
+		lim = max_pos;
+	      /* If that's more padding than already wanted, queue it.
+	       * But don't reduce padding already specified even if
+	       * that is beyond the current truncation point.
+	       */
+	      if (lim > min_pos)
+		min_pos = lim;
+	    }
+	  goto tail_recurse;
+	}
       else if (STRINGP (car) || CONSP (car))
-        {
-          int limit = 50;
+	{
+	  int limit = 50;
 
-          /* LIMIT is to protect against circular lists.  */
-          while (CONSP (elt) && --limit > 0
-                 && (pos < max_pos || max_pos == -1))
-            {
-              pos = generate_fstring_runes (w, data, pos, pos, max_pos,
-                                            XCAR (elt), depth, max_pixsize,
+	  /* LIMIT is to protect against circular lists.  */
+	  while (CONSP (elt) && --limit > 0
+		 && (pos < max_pos || max_pos == -1))
+	    {
+	      pos = generate_fstring_runes (w, data, pos, pos, max_pos,
+					    XCAR (elt), depth, max_pixsize,
 					    findex, type, offset, cur_ext);
-              elt = XCDR (elt);
-            }
-        }
+	      elt = XCDR (elt);
+	    }
+	}
       else if (EXTENTP (car))
-        {
-          struct extent *ext = XEXTENT (car);
+	{
+	  struct extent *ext = XEXTENT (car);
+
+	  if (EXTENT_LIVE_P (ext))
+	    {
+	      face_index old_findex = data->findex;
+	      Lisp_Object face;
+	      Lisp_Object font_inst;
+	      face_index new_findex;
+	      Bytecount start = data->bytepos;
 
-          if (EXTENT_LIVE_P (ext))
-            {
-              face_index old_findex = data->findex;
-              Lisp_Object face;
-              Lisp_Object font_inst;
-              face_index new_findex;
-              Bytecount start = data->bytepos;
-
-              face = extent_face (ext);
-              if (FACEP (face))
-                {
-                  /* #### needs to merge faces, sigh */
-                  /* #### needs to handle list of faces */
-                  new_findex = get_builtin_face_cache_index (w, face);
-                  /* !!#### not right; needs to compute the max height of
-                     all the charsets */
-                  font_inst = WINDOW_FACE_CACHEL_FONT (w, new_findex,
-                                                       Vcharset_ascii);
-
-                  data->dl->ascent = max (data->dl->ascent,
-                                          XFONT_INSTANCE (font_inst)->ascent);
-                  data->dl->descent = max (data->dl->descent,
-                                           XFONT_INSTANCE (font_inst)->
-                                           descent);
-                }
-              else
-                new_findex = old_findex;
-
-              data->findex = new_findex;
-              pos = generate_fstring_runes (w, data, pos, pos, max_pos,
-                                            XCDR (elt), depth - 1,
+	      face = extent_face (ext);
+	      if (FACEP (face))
+		{
+		  /* #### needs to merge faces, sigh */
+		  /* #### needs to handle list of faces */
+		  new_findex = get_builtin_face_cache_index (w, face);
+		  /* !!#### not right; needs to compute the max height of
+		     all the charsets */
+		  font_inst = WINDOW_FACE_CACHEL_FONT (w, new_findex,
+						       Vcharset_ascii);
+
+		  data->dl->ascent = max (data->dl->ascent,
+					  XFONT_INSTANCE (font_inst)->ascent);
+		  data->dl->descent = max (data->dl->descent,
+					   XFONT_INSTANCE (font_inst)->
+					   descent);
+		}
+	      else
+		new_findex = old_findex;
+
+	      data->findex = new_findex;
+	      pos = generate_fstring_runes (w, data, pos, pos, max_pos,
+					    XCDR (elt), depth - 1,
 					    max_pixsize, new_findex, type,
 					    offset, car);
-              data->findex = old_findex;
-              Dynarr_add (formatted_string_extent_dynarr, ext);
-              Dynarr_add (formatted_string_extent_start_dynarr, start);
-              Dynarr_add (formatted_string_extent_end_dynarr, data->bytepos);
-            }
-        }
+	      data->findex = old_findex;
+	      Dynarr_add (formatted_string_extent_dynarr, ext);
+	      Dynarr_add (formatted_string_extent_start_dynarr, start);
+	      Dynarr_add (formatted_string_extent_end_dynarr, data->bytepos);
+	    }
+	}
     }
   else if (GLYPHP (elt))
     {
@@ -4520,8 +4520,8 @@ ensure_modeline_generated (struct window
       dla = window_display_lines (w, type);
 
       /* We don't care if there is a display line which is not
-         currently a modeline because it is definitely going to become
-         one if we have gotten to this point. */
+	 currently a modeline because it is definitely going to become
+	 one if we have gotten to this point. */
       if (Dynarr_length (dla) == 0)
 	{
 	  if (Dynarr_largest (dla) > 0)
@@ -4535,8 +4535,8 @@ ensure_modeline_generated (struct window
 	}
 
       /* If we're adding a new place marker go ahead and generate the
-         modeline so that it is available for use by
-         window_modeline_height. */
+	 modeline so that it is available for use by
+	 window_modeline_height. */
       generate_modeline (w, Dynarr_atp (dla, 0), type);
     }
 
@@ -4653,7 +4653,7 @@ create_string_text_block (struct window 
      extended characters show up as hex with a display table like
      this:
 
-         #s(range-table data ((256 524288) (format "%x")))
+	 #s(range-table data ((256 524288) (format "%x")))
 
      Since more than one display table is possible, you have
      great flexibility in mapping ranges of characters.  */
@@ -4680,10 +4680,9 @@ create_string_text_block (struct window 
   dl->num_chars = 0;
   dl->line_continuation = 0;
 
-  /* set up faces to use for clearing areas, used by
-     output_display_line */
+  /* Set up faces to use for clearing areas, used by output_display_line. */
   dl->default_findex = default_face;
-  if (default_face)
+  if (default_face > DEFAULT_INDEX)
     {
       dl->left_margin_findex = default_face;
       dl->right_margin_findex = default_face;
@@ -4774,7 +4773,7 @@ create_string_text_block (struct window 
 	{
 	  Lisp_Object last_glyph = Qnil;
 	  /* Deal with clipped glyphs that we have already displayed. */
-	  if (*prop && Dynarr_atp (*prop, 0)->type == PROP_GLYPH) 
+	  if (*prop && Dynarr_atp (*prop, 0)->type == PROP_GLYPH)
 	    {
 	      last_glyph = Dynarr_atp (*prop, 0)->data.p_glyph.glyph;
 	      Dynarr_free (*prop);
@@ -4783,10 +4782,10 @@ create_string_text_block (struct window 
 	  /* Now compute the face and begin/end-glyph information. */
 	  data.findex =
 	    /* Remember that the extent-fragment routines deal in
-               Bytexpos's. */
+	       Bytexpos's. */
 	    extent_fragment_update (w, data.ef, data.byte_charpos, last_glyph);
 	  /* This is somewhat cheesy but the alternative is to
-             propagate default_face into extent_fragment_update. */
+	     propagate default_face into extent_fragment_update. */
 	  if (data.findex == DEFAULT_INDEX)
 	    data.findex = default_face;
 
@@ -4798,12 +4797,12 @@ create_string_text_block (struct window 
       initial = 0;
 
       /* Determine what is next to be displayed.  We first handle any
-         glyphs returned by glyphs_at_charbpos.  If there are no glyphs to
-         display then we determine what to do based on the character at the
-         current buffer position. */
+	 glyphs returned by glyphs_at_charbpos.  If there are no glyphs to
+	 display then we determine what to do based on the character at the
+	 current buffer position. */
 
       /* If the current position is covered by an invisible extent, do
-         nothing (except maybe add some ellipses).
+	 nothing (except maybe add some ellipses).
 
 	 #### The behavior of begin and end-glyphs at the edge of an
 	 invisible extent should be investigated further.  This is
@@ -4850,9 +4849,9 @@ create_string_text_block (struct window 
 	}
 
       /* If there is propagation data, then it represents the current
-         buffer position being displayed.  Add them and advance the
-         position counter.  This might also add the minibuffer
-         prompt. */
+	 buffer position being displayed.  Add them and advance the
+	 position counter.  This might also add the minibuffer
+	 prompt. */
       else if (*prop)
 	{
 	  dl->used_prop_data = 1;
@@ -4910,7 +4909,7 @@ create_string_text_block (struct window 
 	    entry = display_table_entry (data.ch, face_dt, window_dt);
 
 	  /* If there is a display table entry for it, hand it off to
-             add_disp_table_entry_runes and let it worry about it. */
+	     add_disp_table_entry_runes and let it worry about it. */
 	  if (!NILP (entry) && !EQ (entry, make_char (data.ch)))
 	    {
 	      *prop = add_disp_table_entry_runes (&data, entry);
@@ -4920,18 +4919,18 @@ create_string_text_block (struct window 
 	    }
 
 	  /* Check if we have hit a newline character.  If so, add a marker
-             to the line and end this loop. */
+	     to the line and end this loop. */
 	  else if (data.ch == '\n')
 	    {
 	      /* We aren't going to be adding an end glyph so give its
-                 space back in order to make sure that the cursor can
-                 fit. */
+		 space back in order to make sure that the cursor can
+		 fit. */
 	      data.max_pixpos += data.end_glyph_width;
 	      goto done;
 	    }
 
 	  /* If the current character is considered to be printable, then
-             just add it. */
+	     just add it. */
 	  else if (data.ch >= printable_min)
 	    {
 	      *prop = add_ichar_rune (&data);
@@ -4940,8 +4939,8 @@ create_string_text_block (struct window 
 	    }
 
 	  /* If the current character is a tab, determine the next tab
-             starting position and add a blank rune which extends from the
-             current pixel position to that starting position. */
+	     starting position and add a blank rune which extends from the
+	     current pixel position to that starting position. */
 	  else if (data.ch == '\t')
 	    {
 	      int tab_start_pixpos = data.pixpos;
@@ -4986,7 +4985,7 @@ create_string_text_block (struct window 
 	    }
 
 	  /* If character is a control character, pass it off to
-             add_control_char_runes.
+	     add_control_char_runes.
 
 	     The is_*() routines have undefined results on
 	     arguments outside of the range [-1, 255].  (This
@@ -5002,7 +5001,7 @@ create_string_text_block (struct window 
 	    }
 
 	  /* If the character is above the ASCII range and we have not
-             already handled it, then print it as an octal number. */
+	     already handled it, then print it as an octal number. */
 	  else if (data.ch >= 0200)
 	    {
 	      *prop = add_octal_runes (&data);
@@ -5012,7 +5011,7 @@ create_string_text_block (struct window 
 	    }
 
 	  /* Assume the current character is considered to be printable,
-             then just add it. */
+	     then just add it. */
 	  else
 	    {
 	      *prop = add_ichar_rune (&data);
@@ -5039,24 +5038,24 @@ create_string_text_block (struct window 
 	 check. */
 
       /* The common case is that the line ended because we hit a newline.
-         In that case, the next character is just the next buffer
-         position. */
+	 In that case, the next character is just the next buffer
+	 position. */
       if (data.ch == '\n')
 	{
 	  INC_BYTECOUNT (XSTRING_DATA (disp_string), data.byte_charpos);
 	}
 
       /* Otherwise we have a buffer line which cannot fit on one display
-         line. */
+	 line. */
       else
 	{
 	  struct glyph_block gb;
 	  struct glyph_cachel *cachel;
 
 	  /* If the line is to be truncated then we actually have to look
-             for the next newline.  We also add the end-of-line glyph which
-             we know will fit because we adjusted the right border before
-             we starting laying out the line. */
+	     for the next newline.  We also add the end-of-line glyph which
+	     we know will fit because we adjusted the right border before
+	     we starting laying out the line. */
 	  data.max_pixpos += data.end_glyph_width;
 	  data.findex = default_face;
 	  gb.extent = Qnil;
@@ -5369,8 +5368,8 @@ generate_displayable_area (struct window
 					       &prop, default_face);
       Dynarr_unlock (dla);
       /* we need to make sure that we continue along the line if there
-         is more left to display otherwise we just end up redisplaying
-         the same chunk over and over again. */
+	 is more left to display otherwise we just end up redisplaying
+	 the same chunk over and over again. */
       if (next_pos == start_pos && next_pos < s_zv)
 	start_pos++;
       else
@@ -5547,7 +5546,7 @@ Info on Re-entrancy crashes, with backtr
       ypos = dlp->ypos + dlp->descent;
 
       /* See if we've been asked to start midway through a line, for
-         partial display line scrolling. */
+	 partial display line scrolling. */
       if (yclip)
 	{
 	  dlp->top_clip = yclip;
@@ -5579,8 +5578,8 @@ Info on Re-entrancy crashes, with backtr
       if (dlp->cursor_elt != -1)
 	{
 	  /* #### This check is steaming crap.  Have to get things
-             fixed so when create_text_block hits EOB, we're done,
-             period. */
+	     fixed so when create_text_block hits EOB, we're done,
+	     period. */
 	  if (w->last_point_x[type] == -1)
 	    {
 	      w->last_point_x[type] = dlp->cursor_elt;
@@ -5589,7 +5588,7 @@ Info on Re-entrancy crashes, with backtr
 	  else
 	    {
 	      /* #### This means that we've added a cursor at EOB
-                 twice.  Yuck oh yuck. */
+		 twice.  Yuck oh yuck. */
 	      struct display_block *db;
 
 	      Dynarr_lock (dla);
@@ -5635,7 +5634,7 @@ Info on Re-entrancy crashes, with backtr
   if (need_modeline)
     {
       /* We know that this is the right thing to use because we put it
-         there when we first started working in this function. */
+	 there when we first started working in this function. */
       generate_modeline (w, Dynarr_atp (dla, 0), type);
     }
 
@@ -5729,7 +5728,7 @@ regenerate_window_extents_only_changed (
 	  if (redisplay_move_cursor (w, pointm, WINDOW_TTY_P (w)))
 	    {
 	      /* Always regenerate the modeline in case it is
-                 displaying the current line or column. */
+		 displaying the current line or column. */
 	      regenerate_modeline (w);
 	      success = 1;
 	    }
@@ -5814,8 +5813,8 @@ regenerate_window_extents_only_changed (
       old_end = ddl->end_charpos + ddl->offset;
 
       /* If this is the first line being updated and it used
-         propagation data, fail.  Otherwise we'll be okay because
-         we'll have the necessary propagation data. */
+	 propagation data, fail.  Otherwise we'll be okay because
+	 we'll have the necessary propagation data. */
       if (line == first_line && ddl->used_prop_data)
 	return 0;
 
@@ -5824,9 +5823,9 @@ regenerate_window_extents_only_changed (
       ddl->offset = 0;
 
       /* #### If there is propagated stuff the fail.  We could
-         probably actually deal with this if the line had propagated
-         information when originally created by a full
-         regeneration. */
+	 probably actually deal with this if the line had propagated
+	 information when originally created by a full
+	 regeneration. */
       if (prop)
 	{
 	  Dynarr_free (prop);
@@ -5834,7 +5833,7 @@ regenerate_window_extents_only_changed (
 	}
 
       /* If any line position parameters have changed or a
-         cursor has disappeared or disappeared, fail.  */
+	 cursor has disappeared or disappeared, fail.  */
       db = get_display_block_from_line (ddl, TEXT);
       if (cdl->ypos != ddl->ypos
 	  || cdl->ascent != ddl->ascent
@@ -5858,7 +5857,7 @@ regenerate_window_extents_only_changed (
       last_line = line;
 
       /* If the extent changes end on the line we just updated then
-         we're done.  Otherwise go on to the next line. */
+	 we're done.  Otherwise go on to the next line. */
       if (end_unchanged <= ddl->end_charpos)
 	break;
       else
@@ -5975,7 +5974,7 @@ regenerate_window_incrementally (struct 
       ddl->offset = 0;
 
       /* If there is propagated stuff then it is pretty much a
-         guarantee that more than just the one line is affected. */
+	 guarantee that more than just the one line is affected. */
       if (prop)
 	{
 	  Dynarr_free (prop);
@@ -5987,7 +5986,7 @@ regenerate_window_incrementally (struct 
 	return 0;
 
       /* If any line position parameters have changed or a
-         cursor has disappeared or disappeared, fail. */
+	 cursor has disappeared or disappeared, fail. */
       if (cdl->ypos != ddl->ypos
 	  || cdl->ascent != ddl->ascent
 	  || cdl->descent != ddl->descent
@@ -5999,7 +5998,7 @@ regenerate_window_incrementally (struct 
 	}
 
       /* If the changed area also ends on this line, then we may be in
-         business.  Update everything and return success. */
+	 business.  Update everything and return success. */
       if (end_unchanged >= ddl->charpos && end_unchanged <= ddl->end_charpos)
 	{
 	  w->last_modified[DESIRED_DISP] = make_int (BUF_MODIFF (b));
@@ -6019,13 +6018,13 @@ regenerate_window_incrementally (struct 
 	  regenerate_modeline (w);
 
 	  /* #### For now we just flush the cache until this has been
-             tested.  After that is done, this should correct the
-             cache directly. */
+	     tested.  After that is done, this should correct the
+	     cache directly. */
 	  Dynarr_reset (w->line_start_cache);
 
 	  /* Adjust the extent changed boundaries to remove any
-             overlap with the buffer changes since we've just
-             successfully updated that area. */
+	     overlap with the buffer changes since we've just
+	     successfully updated that area. */
 	  if (extent_beg_unchanged != -1
 	      && extent_beg_unchanged >= beg_unchanged
 	      && extent_beg_unchanged < end_unchanged)
@@ -6040,9 +6039,9 @@ regenerate_window_incrementally (struct 
 	    extent_beg_unchanged = extent_end_unchanged = -1;
 
 	  /* This could lead to odd results if it fails, but since the
-             buffer changes update succeeded this probably will to.
-             We already know that the extent changes start at or after
-             the line because we checked before entering the loop. */
+	     buffer changes update succeeded this probably will to.
+	     We already know that the extent changes start at or after
+	     the line because we checked before entering the loop. */
 	  if (extent_beg_unchanged != -1
 	      && extent_end_unchanged != -1
 	      && ((extent_beg_unchanged < ddl->charpos)
@@ -6253,8 +6252,8 @@ redisplay_window (Lisp_Object window, in
   if (echo_active)
     {
       old_pointm = selected_globally
-                   ? BUF_PT (b)
-: marker_position (w->pointm[CURRENT_DISP]);
+		   ? BUF_PT (b)
+		   : marker_position (w->pointm[CURRENT_DISP]);
       pointm = 1;
     }
   else
@@ -6343,7 +6342,7 @@ redisplay_window (Lisp_Object window, in
 		       the_buffer);
 
 	  /* #### BUFU amounts of overkill just to get the cursor
-             location marked properly.  FIX ME FIX ME FIX ME */
+	     location marked properly.  FIX ME FIX ME FIX ME */
 	  regenerate_window (w, startp, pointm, DESIRED_DISP);
 	}
 
@@ -6356,7 +6355,7 @@ redisplay_window (Lisp_Object window, in
       && XINT (w->last_facechange[CURRENT_DISP]) >= BUF_FACECHANGE (b)
       && pointm >= startp
       /* This check is to make sure we restore the minibuffer after a
-         temporary change to the echo area. */
+	 temporary change to the echo area. */
       && !(MINI_WINDOW_P (w) && f->buffers_changed)
       && !f->frame_changed
       && !truncation_changed
@@ -6388,8 +6387,8 @@ redisplay_window (Lisp_Object window, in
       else
 	{
 	  /* If the new point is visible in the redisplay structures,
-             then let the output update routines handle it, otherwise
-             do things the hard way. */
+	     then let the output update routines handle it, otherwise
+	     do things the hard way. */
 	  if (!w->windows_changed
 	      && !f->clip_changed
 	      && !f->extents_changed
@@ -6406,7 +6405,7 @@ redisplay_window (Lisp_Object window, in
 		  if (redisplay_move_cursor (w, pointm, FRAME_TTY_P (f)))
 		    {
 		      /* Always regenerate in case it is displaying
-                         the current line or column. */
+			 the current line or column. */
 		      regenerate_modeline (w);
 
 		      skip_output = 1;
@@ -6424,7 +6423,7 @@ redisplay_window (Lisp_Object window, in
 	    }
 
 	  /* If we weren't able to take the shortcut method, then use
-             the brute force method. */
+	     the brute force method. */
 	  regenerate_window (w, startp, pointm, DESIRED_DISP);
 
 	  if (point_visible (w, pointm, DESIRED_DISP))
@@ -6713,11 +6712,11 @@ end_hold_frame_size_changes (Lisp_Object
 	 it was typical to call it at the end of a critical section
 	 (which occurs once per frame); but what then happens if multiple
 	 frames have frame changes held up?
-	 
+
 	 This means we are O(N^2) over frames.  I seriously doubt it matters.
 	 --ben */
       Lisp_Object frmcons, devcons, concons;
-  
+
       FRAME_LOOP_NO_BREAK (frmcons, devcons, concons)
 	{
 	  struct frame *f = XFRAME (XCAR (frmcons));
@@ -7031,11 +7030,11 @@ redisplay_device (struct device *d, int 
 	}
 
       /* If the frame redisplay did not get preempted, then this flag
-         should have gotten set to 0.  It might be possible for that
-         not to happen if a size change event were to occur at an odd
-         time.  To make sure we don't miss anything we simply don't
-         reset the top level flags until the condition ends up being
-         in the right state. */
+	 should have gotten set to 0.  It might be possible for that
+	 not to happen if a size change event were to occur at an odd
+	 time.  To make sure we don't miss anything we simply don't
+	 reset the top level flags until the condition ends up being
+	 in the right state. */
       if (f->size_changed)
 	size_change_failed = 1;
     }
@@ -7163,7 +7162,7 @@ redisplay_no_pre_idle_hook (void)
       !inhibit_warning_display)
     {
       /* If an error occurs during this function, oh well.
-         If we report another warning, we could get stuck in an
+	 If we report another warning, we could get stuck in an
 	 infinite loop reporting warnings. */
       call0_trapping_problems
 	(0, Qdisplay_warning_buffer,
@@ -7253,9 +7252,9 @@ decode_mode_spec (struct window *w, Icha
       /* print the current column */
     case 'c':
       {
-        Charbpos pt = (w == XWINDOW (Fselected_window (Qnil)))
-                    ? BUF_PT (b)
-: marker_position (w->pointm[type]);
+	Charbpos pt = (w == XWINDOW (Fselected_window (Qnil)))
+		    ? BUF_PT (b)
+		    : marker_position (w->pointm[type]);
 	int col = column_at_point (b, pt, 1) + !!column_number_start_at_one;
 	char buf[DECIMAL_PRINT_SIZE (long)];
 
@@ -7269,14 +7268,14 @@ decode_mode_spec (struct window *w, Icha
       /* print the file coding system */
     case 'C':
       {
-        Lisp_Object codesys = b->buffer_file_coding_system;
-        /* Be very careful here not to get an error. */
+	Lisp_Object codesys = b->buffer_file_coding_system;
+	/* Be very careful here not to get an error. */
 	if (NILP (codesys) || SYMBOLP (codesys) || CODING_SYSTEMP (codesys))
-          {
-            codesys = find_coding_system_for_text_file (codesys, 0);
+	  {
+	    codesys = find_coding_system_for_text_file (codesys, 0);
 	    if (CODING_SYSTEMP (codesys))
-              obj = XCODING_SYSTEM_MNEMONIC (codesys);
-          }
+	      obj = XCODING_SYSTEM_MNEMONIC (codesys);
+	  }
       }
       break;
 
@@ -7323,7 +7322,7 @@ decode_mode_spec (struct window *w, Icha
       break;
 
       /* print * or hyphen -- XEmacs change to allow a buffer to be
-         read-only but still indicate whether it is modified. */
+	 read-only but still indicate whether it is modified. */
     case '+':
       str = ((BUF_MODIFF (b) > BUF_SAVE_MODIFF (b))
 	     ? "*"
@@ -7333,7 +7332,7 @@ decode_mode_spec (struct window *w, Icha
       break;
 
       /* #### defined in 19.29 decode_mode_spec, but not in
-         modeline-format doc string. */
+	 modeline-format doc string. */
       /* This differs from %* in that it ignores read-only-ness. */
     case '&':
       str = ((BUF_MODIFF (b) > BUF_SAVE_MODIFF (b))
@@ -7379,7 +7378,7 @@ decode_mode_spec (struct window *w, Icha
       else
 	{
 	  /* This hard limit is ok since the string it will hold has a
-             fixed maximum length of 3.  But just to be safe... */
+	     fixed maximum length of 3.  But just to be safe... */
 	  char buf[10];
 	  Charcount chars = pos - BUF_BEGV (b);
 	  Charcount total = BUF_ZV (b) - BUF_BEGV (b);
@@ -7390,7 +7389,7 @@ decode_mode_spec (struct window *w, Icha
 	    (chars * 100 + total/2) / total;
 
 	  /* We can't normally display a 3-digit number, so get us a
-             2-digit number that is close. */
+	     2-digit number that is close. */
 	  if (percent == 100)
 	    percent = 99;
 
@@ -7411,8 +7410,8 @@ decode_mode_spec (struct window *w, Icha
       Charbpos botpos = BUF_Z (b) - w->window_end_pos[type];
 
       /* botpos is only accurate as of the last redisplay, so we can
-         only treat it as a hint.  In particular, after erase-buffer,
-         botpos may be negative. */
+	 only treat it as a hint.  In particular, after erase-buffer,
+	 botpos may be negative. */
       if (botpos < toppos)
 	botpos = toppos;
 
@@ -7426,7 +7425,7 @@ decode_mode_spec (struct window *w, Icha
       else
 	{
 	  /* This hard limit is ok since the string it will hold has a
-             fixed maximum length of around 6.  But just to be safe... */
+	     fixed maximum length of around 6.  But just to be safe... */
 	  char buf[10];
 	  Charcount chars = botpos - BUF_BEGV (b);
 	  Charcount total = BUF_ZV (b) - BUF_BEGV (b);
@@ -7437,7 +7436,7 @@ decode_mode_spec (struct window *w, Icha
 	    (chars * 100 + total/2) / max (total, 1);
 
 	  /* We can't normally display a 3-digit number, so get us a
-             2-digit number that is close. */
+	     2-digit number that is close. */
 	  if (percent == 100)
 	    percent = 99;
 
@@ -7520,7 +7519,7 @@ free_display_line (struct display_line *
   if (dl->display_blocks)
     {
       for (block = 0; block < Dynarr_largest (dl->display_blocks); block++)
-  	{
+	{
 	  struct display_block *db = Dynarr_atp (dl->display_blocks, block);
 
 	  Dynarr_free (db->runes);
@@ -7688,16 +7687,16 @@ validate_line_start_cache (struct window
   if (!w->line_cache_validation_override)
     {
       /* f->extents_changed used to be in here because extent face and
-         size changes can cause text shifting.  However, the extent
-         covering the region is constantly having its face set and
-         priority altered by the mouse code.  This means that the line
-         start cache is constantly being invalidated.  This is bad
-         since the mouse code also triggers heavy usage of the cache.
-         Since it is an unlikely that f->extents being changed
-         indicates that the cache really needs to be updated and if it
-         does redisplay will catch it pretty quickly we no longer
-         invalidate the cache if it is set.  This greatly speeds up
-         dragging out regions with the mouse. */
+	 size changes can cause text shifting.  However, the extent
+	 covering the region is constantly having its face set and
+	 priority altered by the mouse code.  This means that the line
+	 start cache is constantly being invalidated.  This is bad
+	 since the mouse code also triggers heavy usage of the cache.
+	 Since it is an unlikely that f->extents being changed
+	 indicates that the cache really needs to be updated and if it
+	 does redisplay will catch it pretty quickly we no longer
+	 invalidate the cache if it is set.  This greatly speeds up
+	 dragging out regions with the mouse. */
       if (XINT (w->line_cache_last_updated) < BUF_MODIFF (b)
 	  || f->faces_changed
 	  || f->clip_changed)
@@ -7769,8 +7768,8 @@ point_in_line_start_cache (struct window
       int win_char_height = window_char_height (w, 1);
 
       /* Occasionally we get here with a 0 height
-         window. find_next_newline_no_quit will abort if we pass it a
-         count of 0 so handle that case. */
+	 window. find_next_newline_no_quit will abort if we pass it a
+	 count of 0 so handle that case. */
       if (!win_char_height)
 	win_char_height = 1;
 
@@ -7983,7 +7982,7 @@ point_would_be_visible (struct window *w
 						 window_char_height (w, 0));
 
 	  /* We've already actually processed old_startp, so increment
-             immediately. */
+	     immediately. */
 	  start_elt++;
 
 	  /* If this happens we didn't add any extra elements.  Bummer. */
@@ -8032,7 +8031,7 @@ point_would_be_visible (struct window *w
 
 static Charbpos
 start_end_of_last_line (struct window *w, Charbpos startp, int end,
-                        int may_error)
+			int may_error)
 {
   struct buffer *b = XBUFFER (w->buffer);
   line_start_cache_dynarr *cache = w->line_start_cache;
@@ -8168,7 +8167,7 @@ start_with_line_at_pixpos (struct window
       pixheight -= Dynarr_atp (w->line_start_cache, cur_elt)->height;
 
       /* Do not take into account the value of vertical_clip here.
-         That is the responsibility of the calling functions. */
+	 That is the responsibility of the calling functions. */
       if (pixheight < 0)
 	{
 	  w->line_cache_validation_override--;
@@ -8248,18 +8247,18 @@ start_with_point_on_display_line (struct
   else
     {
       /* The calculated value of pixpos is correct for the bottom line
-         or what we want when line is -1.  Therefore we subtract one
-         because we have already handled one line. */
+	 or what we want when line is -1.  Therefore we subtract one
+	 because we have already handled one line. */
       int new_line = -line - 1;
       int cur_elt = point_in_line_start_cache (w, point, new_line);
       int pixpos = WINDOW_TEXT_BOTTOM (w);
       Charbpos retval, search_point;
 
       /* If scroll_on_clipped_lines is false, the last "visible" line of
- 	 the window covers the pixel at WINDOW_TEXT_BOTTOM (w) - 1.
- 	 If s_o_c_l is true, then we don't want to count a clipped
- 	 line, so back up from the bottom by the height of the line
- 	 containing point. */
+	 the window covers the pixel at WINDOW_TEXT_BOTTOM (w) - 1.
+	 If s_o_c_l is true, then we don't want to count a clipped
+	 line, so back up from the bottom by the height of the line
+	 containing point. */
       if (scroll_on_clipped_lines)
 	pixpos -= Dynarr_atp (w->line_start_cache, cur_elt)->height;
       else
@@ -8376,15 +8375,15 @@ update_line_start_cache (struct window *
 	Dynarr_atp (internal_cache, Dynarr_length (internal_cache) - 1)->end;
 
       /* We aren't allowed to generate additional information to fill in
-         gaps, so if the DESIRED structs don't overlap the cache, reset the
-         cache. */
+	 gaps, so if the DESIRED structs don't overlap the cache, reset the
+	 cache. */
       if (Dynarr_length (cache))
 	{
 	  if (end < low_bound || start > high_bound)
 	    Dynarr_reset (cache);
 
 	  /* #### What should really happen if what we are doing is
-             extending a line (the last line)? */
+	     extending a line (the last line)? */
 	  if (Dynarr_length (cache) == 1
 	      && Dynarr_length (internal_cache) == 1)
 	    Dynarr_reset (cache);
@@ -8399,7 +8398,7 @@ update_line_start_cache (struct window *
 	}
 
       /* An extra check just in case the calling function didn't pass in
-         the bounds of the DESIRED structs in the first place. */
+	 the bounds of the DESIRED structs in the first place. */
       if (start >= low_bound && end <= high_bound)
 	{
 	  w->line_cache_validation_override--;
@@ -8407,7 +8406,7 @@ update_line_start_cache (struct window *
 	}
 
       /* At this point we know that the internal cache partially overlaps
-         the main cache. */
+	 the main cache. */
       if (start < low_bound)
 	{
 	  int ic_elt = Dynarr_length (internal_cache) - 1;
@@ -8470,13 +8469,13 @@ update_line_start_cache (struct window *
       while (startp < old_lb || low_bound == -1)
 	{
 	  int ic_elt;
-          Charbpos new_startp;
+	  Charbpos new_startp;
 
 	  regenerate_window (w, startp, point, CMOTION_DISP);
 	  update_internal_cache_list (w, CMOTION_DISP);
 
 	  /* If this assert is triggered then regenerate_window failed
-             to layout a single line. This is not possible since we
+	     to layout a single line. This is not possible since we
 	     force at least a single line to be layout for CMOTION_DISP */
 	  assert (Dynarr_length (internal_cache));
 	  assert (startp == Dynarr_atp (internal_cache, 0)->start);
@@ -8496,28 +8495,28 @@ update_line_start_cache (struct window *
 
 	  new_startp = Dynarr_atp (internal_cache, ic_elt)->end + 1;
 
-          /*
-           * Handle invisible text properly:
-           * If the last line we're inserting has the same end as the
-           * line before which it will be added, merge the two lines.
-           */
-          if (Dynarr_length (cache)  &&
-              Dynarr_atp (internal_cache, ic_elt)->end ==
-              Dynarr_atp (cache, marker)->end)
-            {
-              Dynarr_atp (cache, marker)->start
-                = Dynarr_atp (internal_cache, ic_elt)->start;
-              Dynarr_atp (cache, marker)->height
-                = Dynarr_atp (internal_cache, ic_elt)->height;
-              ic_elt--;
-            }
-
-          if (ic_elt >= 0)       /* we still have lines to add.. */
-            {
-              Dynarr_insert_many (cache, Dynarr_atp (internal_cache, 0),
-                                  ic_elt + 1, marker);
-              marker += (ic_elt + 1);
-            }
+	  /*
+	   * Handle invisible text properly:
+	   * If the last line we're inserting has the same end as the
+	   * line before which it will be added, merge the two lines.
+	   */
+	  if (Dynarr_length (cache)  &&
+	      Dynarr_atp (internal_cache, ic_elt)->end ==
+	      Dynarr_atp (cache, marker)->end)
+	    {
+	      Dynarr_atp (cache, marker)->start
+		= Dynarr_atp (internal_cache, ic_elt)->start;
+	      Dynarr_atp (cache, marker)->height
+		= Dynarr_atp (internal_cache, ic_elt)->height;
+	      ic_elt--;
+	    }
+
+	  if (ic_elt >= 0)       /* we still have lines to add.. */
+	    {
+	      Dynarr_insert_many (cache, Dynarr_atp (internal_cache, 0),
+				  ic_elt + 1, marker);
+	      marker += (ic_elt + 1);
+	    }
 
 	  if (startp < low_bound || low_bound == -1)
 	    low_bound = startp;
@@ -8983,7 +8982,7 @@ pixel_to_glyph_translation (struct frame
   if (MINI_WINDOW_P (*w) && !minibuf_level)
     {
       /* Must reset the window value since some callers will ignore
-         the return value if it is set. */
+	 the return value if it is set. */
       *w = 0;
       UPDATE_CACHE_RETURN;
     }
@@ -9087,10 +9086,10 @@ pixel_to_glyph_translation (struct frame
 		      || x_coord >= dl->bounds.right_in)
 		    {
 		      /* If we are over the outside margins then we
-                         know the loop over the text block isn't going
-                         to accomplish anything.  So we go ahead and
-                         set what information we can right here and
-                         return. */
+			 know the loop over the text block isn't going
+			 to accomplish anything.  So we go ahead and
+			 set what information we can right here and
+			 return. */
 		      (*row)--;
 		      *obj_y = y_coord - (dl->ypos - dl->ascent);
 		      get_position_object (dl, obj1, obj2, x_coord,
@@ -9147,8 +9146,8 @@ pixel_to_glyph_translation (struct frame
 			}
 
 		      /* In this case we failed to find a non-glyph
-                         character so we return the last position
-                         displayed on the line. */
+			 character so we return the last position
+			 displayed on the line. */
 		      if (elt == Dynarr_length (db->runes))
 			{
 			  if (dl->modeline)
@@ -9197,7 +9196,7 @@ pixel_to_glyph_translation (struct frame
 		    {
 		      (*row)--;
 		      /* At this point we may have glyphs in the right
-                         inside margin. */
+			 inside margin. */
 		      if (check_margin_glyphs)
 			get_position_object (dl, obj1, obj2, x_coord,
 					     &low_x_coord, &high_x_coord);
@@ -9226,7 +9225,7 @@ pixel_to_glyph_translation (struct frame
 		      *obj_y = y_coord - (dl->ypos - dl->ascent);
 
 		      /* At this point we may have glyphs in the left
-                         inside margin. */
+			 inside margin. */
 		      if (check_margin_glyphs)
 			get_position_object (dl, obj1, obj2, x_coord, 0, 0);
 
@@ -9687,7 +9686,7 @@ sledgehammer_check_redisplay_structs_1 (
   display_line_dynarr *dl;
 
   dl = window_display_lines (w, CURRENT_DISP);
-  
+
   for (i = 0; i < Dynarr_largest (dl); i++)
     for (j = i + 1; j < Dynarr_largest (dl); j++)
       assert (Dynarr_atp (dl, i)->display_blocks !=



1.24      +15 -13    XEmacs/xemacs/src/redisplay.h

Index: redisplay.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/redisplay.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -p -r1.23 -r1.24
--- redisplay.h	2005/03/09 19:47:41	1.23
+++ redisplay.h	2007/09/26 13:28:01	1.24
@@ -81,6 +81,8 @@ typedef struct
 #define NEXT_CURSOR	3
 #define IGNORE_CURSOR	4
 
+/* #### NOTE: these indexes depend on the order in which the faces are added
+   to the cache in the function reset_face_cachels. */
 #define DEFAULT_INDEX	(face_index) 0
 #define MODELINE_INDEX	(face_index) 1
 
@@ -134,7 +136,7 @@ struct rune
 				   Charcount, but who's looking? */
   Charxpos endpos;		/* if set this rune covers a range of pos;
 				   used in redisplay_move_cursor(). */
- 				/* #### Chuck, what does it mean for a rune
+				/* #### Chuck, what does it mean for a rune
 				   to cover a range of pos?  I don't get
 				   this. */
 
@@ -145,11 +147,11 @@ struct rune
 
   unsigned char cursor_type;	/* is this rune covered by the cursor? */
   unsigned int type;		/* type of rune object */
-                                /* We used to do bitfields here, but if I
-                                   (JV) count correctly that doesn't matter
-                                   for the size of the structure. All the bit
-                                   fiddling _does_ slow down redisplay by
-                                   about 10%. So don't do that */
+				/* We used to do bitfields here, but if I
+				   (JV) count correctly that doesn't matter
+				   for the size of the structure. All the bit
+				   fiddling _does_ slow down redisplay by
+				   about 10%. So don't do that */
 
   union				/* Information specific to the type of rune */
   {
@@ -313,7 +315,7 @@ struct display_line
   char modeline;			/* t if this line is a modeline */
 
   char line_continuation;		/* t if this line continues to
-                                           next display line. */
+					   next display line. */
 
   /* Dynamic array of display blocks */
   display_block_dynarr *display_blocks;
@@ -510,15 +512,15 @@ extern int windows_structure_changed;
     Lisp_Object MTC_devcons, MTC_concons;			\
     DEVICE_LOOP_NO_BREAK (MTC_devcons, MTC_concons)		\
       {								\
-        Lisp_Object MTC_frmcons;				\
-        struct device *MTC_d = XDEVICE (XCAR (MTC_devcons));	\
-        DEVICE_FRAME_LOOP (MTC_frmcons, MTC_d)			\
+	Lisp_Object MTC_frmcons;				\
+	struct device *MTC_d = XDEVICE (XCAR (MTC_devcons));	\
+	DEVICE_FRAME_LOOP (MTC_frmcons, MTC_d)			\
 	  {							\
 	    struct frame *MTC_f = XFRAME (XCAR (MTC_frmcons));	\
-            MTC_f->object##_changed = 1;			\
+	    MTC_f->object##_changed = 1;			\
 	    MTC_f->modiff++;					\
 	  }							\
-        MTC_d->object##_changed = 1;				\
+	MTC_d->object##_changed = 1;				\
       }								\
     object##_changed = 1;					\
     object##_changed_set = 1; }					\
@@ -807,7 +809,7 @@ void redisplay_output_pixmap (struct win
 			      int cursor_height, int offset_bitmap);
 int redisplay_calculate_display_boxes (struct display_line *dl, int xpos,
 				       int xoffset, int yoffset, int start_pixpos,
-                                       int width, struct display_box* dest,
+				       int width, struct display_box* dest,
 				       struct display_glyph_area* src);
 int redisplay_normalize_glyph_area (struct display_box* dest,
 				    struct display_glyph_area* glyphsrc);





More information about the XEmacs-CVS mailing list