diff src/xdisp.c @ 90066:fb79180b618d

Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-78 Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-719 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-732 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-733 Update from CVS: man/calc.texi: Fix some TeX definitions. * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-734 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-75 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-76 - miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-77 Update from CVS
author Miles Bader <miles@gnu.org>
date Tue, 14 Dec 2004 07:34:55 +0000
parents f2ebccfa87d4 877029420a0c
children eac554634bfa
line wrap: on
line diff
--- a/src/xdisp.c	Sat Dec 11 02:29:07 2004 +0000
+++ b/src/xdisp.c	Tue Dec 14 07:34:55 2004 +0000
@@ -343,6 +343,11 @@
 
 Lisp_Object Qtrailing_whitespace;
 
+/* Name and number of the face used to highlight escape glyphs.  */
+
+Lisp_Object Qescape_glyph;
+int escape_glyph_face;
+
 /* The symbol `image' which is the car of the lists used to represent
    images in Lisp.  */
 
@@ -5014,6 +5019,21 @@
 		 display.  Then, set IT->dpvec to these glyphs.  */
 	      GLYPH g;
 	      int ctl_len;
+	      int face_id = escape_glyph_face;
+
+	      /* Find the face id if `escape-glyph' unless we recently did.  */
+	      if (face_id < 0)
+		{
+		  Lisp_Object tem = Fget (Qescape_glyph, Qface);
+		  if (INTEGERP (tem))
+		    face_id = XINT (tem);
+		  else
+		    face_id = 0;
+		  /* If there's overflow, use 0 instead.  */
+		  if (FAST_GLYPH_FACE (FAST_MAKE_GLYPH (0, face_id)) != face_id)
+		    face_id = 0;
+		  escape_glyph_face = face_id;
+		}
 
 	      if (it->c < 128 && it->ctl_arrow_p)
 		{
@@ -5023,10 +5043,10 @@
 		      && GLYPH_CHAR_VALID_P (XINT (DISP_CTRL_GLYPH (it->dp))))
 		    g = XINT (DISP_CTRL_GLYPH (it->dp));
 		  else
-		    g = FAST_MAKE_GLYPH ('^', 0);
+		    g = FAST_MAKE_GLYPH ('^', face_id);
 		  XSETINT (it->ctl_chars[0], g);
 
-		  g = FAST_MAKE_GLYPH (it->c ^ 0100, 0);
+		  g = FAST_MAKE_GLYPH (it->c ^ 0100, face_id);
 		  XSETINT (it->ctl_chars[1], g);
 		  ctl_len = 2;
 		}
@@ -5043,7 +5063,7 @@
 		      && GLYPH_CHAR_VALID_P (XFASTINT (DISP_ESCAPE_GLYPH (it->dp))))
 		    escape_glyph = XFASTINT (DISP_ESCAPE_GLYPH (it->dp));
 		  else
-		    escape_glyph = FAST_MAKE_GLYPH ('\\', 0);
+		    escape_glyph = FAST_MAKE_GLYPH ('\\', face_id);
 
 		  if (CHAR_BYTE8_P (it->c))
 		    {
@@ -5074,11 +5094,14 @@
 		      XSETINT (it->ctl_chars[i * 4], escape_glyph);
 		      /* Insert three more glyphs into IT->ctl_chars for
 			 the octal display of the character.  */
-		      g = FAST_MAKE_GLYPH (((str[i] >> 6) & 7) + '0', 0);
+		      g = FAST_MAKE_GLYPH (((str[i] >> 6) & 7) + '0',
+					   face_id);
 		      XSETINT (it->ctl_chars[i * 4 + 1], g);
-		      g = FAST_MAKE_GLYPH (((str[i] >> 3) & 7) + '0', 0);
+		      g = FAST_MAKE_GLYPH (((str[i] >> 3) & 7) + '0',
+					   face_id);
 		      XSETINT (it->ctl_chars[i * 4 + 2], g);
-		      g = FAST_MAKE_GLYPH ((str[i] & 7) + '0', 0);
+		      g = FAST_MAKE_GLYPH ((str[i] & 7) + '0',
+					   face_id);
 		      XSETINT (it->ctl_chars[i * 4 + 3], g);
 		    }
 		  ctl_len = len * 4;
@@ -5217,6 +5240,9 @@
 	  it->dpvec = NULL;
 	  it->current.dpvec_index = -1;
 
+	  /* Recheck faces after display vector */
+	  it->stop_charpos = 0;
+
 	  /* Skip over characters which were displayed via IT->dpvec.  */
 	  if (it->dpvec_char_len < 0)
 	    reseat_at_next_visible_line_start (it, 1);
@@ -11679,6 +11705,9 @@
   *w->desired_matrix->method = 0;
 #endif
 
+  /* Force this to be looked up again for each redisp of each window.  */
+  escape_glyph_face = -1;
+
   specbind (Qinhibit_point_motion_hooks, Qt);
 
   reconsider_clip_changes (w, buffer);
@@ -22292,6 +22321,8 @@
   staticpro (&Qfontification_functions);
   Qtrailing_whitespace = intern ("trailing-whitespace");
   staticpro (&Qtrailing_whitespace);
+  Qescape_glyph = intern ("escape-glyph");
+  staticpro (&Qescape_glyph);
   Qimage = intern ("image");
   staticpro (&Qimage);
   QCmap = intern (":map");