aboutsummaryrefslogtreecommitdiffstats
path: root/src/xfaces.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xfaces.c')
-rw-r--r--src/xfaces.c288
1 files changed, 160 insertions, 128 deletions
diff --git a/src/xfaces.c b/src/xfaces.c
index 91f4b133466..476fb1e0366 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -1,6 +1,6 @@
1/* xfaces.c -- "Face" primitives. 1/* xfaces.c -- "Face" primitives.
2 2
3Copyright (C) 1993-1994, 1998-2011 Free Software Foundation, Inc. 3Copyright (C) 1993-1994, 1998-2012 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
6 6
@@ -27,7 +27,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
27 27
28 1. Font family name. 28 1. Font family name.
29 29
30 2. Font foundary name. 30 2. Font foundry name.
31 31
32 3. Relative proportionate width, aka character set width or set 32 3. Relative proportionate width, aka character set width or set
33 width (swidth), e.g. `semi-compressed'. 33 width (swidth), e.g. `semi-compressed'.
@@ -66,7 +66,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
66 attributes (1st thru 5th) are updated from the spec. 66 attributes (1st thru 5th) are updated from the spec.
67 67
68 On the other hand, if one of the other font-related attributes are 68 On the other hand, if one of the other font-related attributes are
69 specified, the correspoinding specs in this attribute is set to nil. 69 specified, the corresponding specs in this attribute is set to nil.
70 70
71 15. A face name or list of face names from which to inherit attributes. 71 15. A face name or list of face names from which to inherit attributes.
72 72
@@ -293,7 +293,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
293 293
294/* Non-zero if face attribute ATTR is `ignore-defface'. */ 294/* Non-zero if face attribute ATTR is `ignore-defface'. */
295 295
296#define IGNORE_DEFFACE_P(ATTR) EQ ((ATTR), Qignore_defface) 296#define IGNORE_DEFFACE_P(ATTR) EQ ((ATTR), QCignore_defface)
297 297
298/* Value is the number of elements of VECTOR. */ 298/* Value is the number of elements of VECTOR. */
299 299
@@ -332,14 +332,14 @@ static Lisp_Object Qultra_expanded;
332static Lisp_Object Qreleased_button, Qpressed_button; 332static Lisp_Object Qreleased_button, Qpressed_button;
333static Lisp_Object QCstyle, QCcolor, QCline_width; 333static Lisp_Object QCstyle, QCcolor, QCline_width;
334Lisp_Object Qunspecified; /* used in dosfns.c */ 334Lisp_Object Qunspecified; /* used in dosfns.c */
335static Lisp_Object Qignore_defface; 335static Lisp_Object QCignore_defface;
336 336
337char unspecified_fg[] = "unspecified-fg", unspecified_bg[] = "unspecified-bg"; 337char unspecified_fg[] = "unspecified-fg", unspecified_bg[] = "unspecified-bg";
338 338
339/* The name of the function to call when the background of the frame 339/* The name of the function to call when the background of the frame
340 has changed, frame_set_background_mode. */ 340 has changed, frame_set_background_mode. */
341 341
342Lisp_Object Qframe_set_background_mode; 342static Lisp_Object Qframe_set_background_mode;
343 343
344/* Names of basic faces. */ 344/* Names of basic faces. */
345 345
@@ -403,7 +403,7 @@ static int next_lface_id;
403/* A vector mapping Lisp face Id's to face names. */ 403/* A vector mapping Lisp face Id's to face names. */
404 404
405static Lisp_Object *lface_id_to_name; 405static Lisp_Object *lface_id_to_name;
406static int lface_id_to_name_size; 406static ptrdiff_t lface_id_to_name_size;
407 407
408/* TTY color-related functions (defined in tty-colors.el). */ 408/* TTY color-related functions (defined in tty-colors.el). */
409 409
@@ -458,11 +458,11 @@ struct table_entry;
458struct named_merge_point; 458struct named_merge_point;
459 459
460static void map_tty_color (struct frame *, struct face *, 460static void map_tty_color (struct frame *, struct face *,
461 enum lface_attribute_index, int *); 461 enum lface_attribute_index, int *);
462static Lisp_Object resolve_face_name (Lisp_Object, int); 462static Lisp_Object resolve_face_name (Lisp_Object, int);
463static void set_font_frame_param (Lisp_Object, Lisp_Object); 463static void set_font_frame_param (Lisp_Object, Lisp_Object);
464static int get_lface_attributes (struct frame *, Lisp_Object, Lisp_Object *, 464static int get_lface_attributes (struct frame *, Lisp_Object, Lisp_Object *,
465 int, struct named_merge_point *); 465 int, struct named_merge_point *);
466static ptrdiff_t load_pixmap (struct frame *, Lisp_Object, 466static ptrdiff_t load_pixmap (struct frame *, Lisp_Object,
467 unsigned *, unsigned *); 467 unsigned *, unsigned *);
468static struct frame *frame_or_selected_frame (Lisp_Object, int); 468static struct frame *frame_or_selected_frame (Lisp_Object, int);
@@ -470,9 +470,9 @@ static void load_face_colors (struct frame *, struct face *, Lisp_Object *);
470static void free_face_colors (struct frame *, struct face *); 470static void free_face_colors (struct frame *, struct face *);
471static int face_color_gray_p (struct frame *, const char *); 471static int face_color_gray_p (struct frame *, const char *);
472static struct face *realize_face (struct face_cache *, Lisp_Object *, 472static struct face *realize_face (struct face_cache *, Lisp_Object *,
473 int); 473 int);
474static struct face *realize_non_ascii_face (struct frame *, Lisp_Object, 474static struct face *realize_non_ascii_face (struct frame *, Lisp_Object,
475 struct face *); 475 struct face *);
476static struct face *realize_x_face (struct face_cache *, Lisp_Object *); 476static struct face *realize_x_face (struct face_cache *, Lisp_Object *);
477static struct face *realize_tty_face (struct face_cache *, Lisp_Object *); 477static struct face *realize_tty_face (struct face_cache *, Lisp_Object *);
478static int realize_basic_faces (struct frame *); 478static int realize_basic_faces (struct frame *);
@@ -488,11 +488,11 @@ static void clear_face_gcs (struct face_cache *);
488static void free_face_cache (struct face_cache *); 488static void free_face_cache (struct face_cache *);
489static int face_fontset (Lisp_Object *); 489static int face_fontset (Lisp_Object *);
490static void merge_face_vectors (struct frame *, Lisp_Object *, Lisp_Object*, 490static void merge_face_vectors (struct frame *, Lisp_Object *, Lisp_Object*,
491 struct named_merge_point *); 491 struct named_merge_point *);
492static int merge_face_ref (struct frame *, Lisp_Object, Lisp_Object *, 492static int merge_face_ref (struct frame *, Lisp_Object, Lisp_Object *,
493 int, struct named_merge_point *); 493 int, struct named_merge_point *);
494static int set_lface_from_font (struct frame *, Lisp_Object, Lisp_Object, 494static int set_lface_from_font (struct frame *, Lisp_Object, Lisp_Object,
495 int); 495 int);
496static Lisp_Object lface_from_face_name (struct frame *, Lisp_Object, int); 496static Lisp_Object lface_from_face_name (struct frame *, Lisp_Object, int);
497static struct face *make_realized_face (Lisp_Object *); 497static struct face *make_realized_face (Lisp_Object *);
498static void cache_face (struct face_cache *, struct face *, unsigned); 498static void cache_face (struct face_cache *, struct face *, unsigned);
@@ -536,8 +536,7 @@ int color_count[256];
536/* Register color PIXEL as allocated. */ 536/* Register color PIXEL as allocated. */
537 537
538void 538void
539register_color (pixel) 539register_color (unsigned long pixel)
540 unsigned long pixel;
541{ 540{
542 xassert (pixel < 256); 541 xassert (pixel < 256);
543 ++color_count[pixel]; 542 ++color_count[pixel];
@@ -547,8 +546,7 @@ register_color (pixel)
547/* Register color PIXEL as deallocated. */ 546/* Register color PIXEL as deallocated. */
548 547
549void 548void
550unregister_color (pixel) 549unregister_color (unsigned long pixel)
551 unsigned long pixel;
552{ 550{
553 xassert (pixel < 256); 551 xassert (pixel < 256);
554 if (color_count[pixel] > 0) 552 if (color_count[pixel] > 0)
@@ -561,9 +559,7 @@ unregister_color (pixel)
561/* Register N colors from PIXELS as deallocated. */ 559/* Register N colors from PIXELS as deallocated. */
562 560
563void 561void
564unregister_colors (pixels, n) 562unregister_colors (unsigned long *pixels, int n)
565 unsigned long *pixels;
566 int n;
567{ 563{
568 int i; 564 int i;
569 for (i = 0; i < n; ++i) 565 for (i = 0; i < n; ++i)
@@ -627,7 +623,8 @@ x_free_colors (struct frame *f, long unsigned int *pixels, int npixels)
627 is called. */ 623 is called. */
628 624
629void 625void
630x_free_dpy_colors (Display *dpy, Screen *screen, Colormap cmap, long unsigned int *pixels, int npixels) 626x_free_dpy_colors (Display *dpy, Screen *screen, Colormap cmap,
627 long unsigned int *pixels, int npixels)
631{ 628{
632 struct x_display_info *dpyinfo = x_display_info_for_display (dpy); 629 struct x_display_info *dpyinfo = x_display_info_for_display (dpy);
633 int class = dpyinfo->visual->class; 630 int class = dpyinfo->visual->class;
@@ -702,8 +699,8 @@ x_free_gc (struct frame *f, GC gc)
702 699
703static inline GC 700static inline GC
704x_create_gc (struct frame *f, 701x_create_gc (struct frame *f,
705 unsigned long mask, 702 unsigned long mask,
706 XGCValues *xgcv) 703 XGCValues *xgcv)
707{ 704{
708 GC gc = xmalloc (sizeof (*gc)); 705 GC gc = xmalloc (sizeof (*gc));
709 if (gc) 706 if (gc)
@@ -796,7 +793,7 @@ init_frame_faces (struct frame *f)
796 if (!FRAME_NS_P (f) || FRAME_NS_WINDOW (f)) 793 if (!FRAME_NS_P (f) || FRAME_NS_WINDOW (f))
797#endif 794#endif
798 if (!realize_basic_faces (f)) 795 if (!realize_basic_faces (f))
799 abort (); 796 abort ();
800} 797}
801 798
802 799
@@ -944,11 +941,13 @@ the pixmap. Bits are stored row by row, each row occupies
944 } 941 }
945 } 942 }
946 943
947 if (NATNUMP (width) && NATNUMP (height) && STRINGP (data)) 944 if (STRINGP (data)
945 && INTEGERP (width) && 0 < XINT (width)
946 && INTEGERP (height) && 0 < XINT (height))
948 { 947 {
949 int bytes_per_row = ((XFASTINT (width) + BITS_PER_CHAR - 1) 948 EMACS_INT bytes_per_row = ((XINT (width) + BITS_PER_CHAR - 1)
950 / BITS_PER_CHAR); 949 / BITS_PER_CHAR);
951 if (SBYTES (data) >= bytes_per_row * XINT (height)) 950 if (XINT (height) <= SBYTES (data) / bytes_per_row)
952 pixmap_p = 1; 951 pixmap_p = 1;
953 } 952 }
954 } 953 }
@@ -965,7 +964,8 @@ the pixmap. Bits are stored row by row, each row occupies
965 if these pointers are not null. */ 964 if these pointers are not null. */
966 965
967static ptrdiff_t 966static ptrdiff_t
968load_pixmap (FRAME_PTR f, Lisp_Object name, unsigned int *w_ptr, unsigned int *h_ptr) 967load_pixmap (FRAME_PTR f, Lisp_Object name, unsigned int *w_ptr,
968 unsigned int *h_ptr)
969{ 969{
970 ptrdiff_t bitmap_id; 970 ptrdiff_t bitmap_id;
971 971
@@ -1059,7 +1059,8 @@ parse_rgb_list (Lisp_Object rgb_list, XColor *color)
1059 returned in it. */ 1059 returned in it. */
1060 1060
1061static int 1061static int
1062tty_lookup_color (struct frame *f, Lisp_Object color, XColor *tty_color, XColor *std_color) 1062tty_lookup_color (struct frame *f, Lisp_Object color, XColor *tty_color,
1063 XColor *std_color)
1063{ 1064{
1064 Lisp_Object frame, color_desc; 1065 Lisp_Object frame, color_desc;
1065 1066
@@ -1155,7 +1156,8 @@ tty_defined_color (struct frame *f, const char *color_name,
1155 This does the right thing for any type of frame. */ 1156 This does the right thing for any type of frame. */
1156 1157
1157static int 1158static int
1158defined_color (struct frame *f, const char *color_name, XColor *color_def, int alloc) 1159defined_color (struct frame *f, const char *color_name, XColor *color_def,
1160 int alloc)
1159{ 1161{
1160 if (!FRAME_WINDOW_P (f)) 1162 if (!FRAME_WINDOW_P (f))
1161 return tty_defined_color (f, color_name, color_def, alloc); 1163 return tty_defined_color (f, color_name, color_def, alloc);
@@ -1221,7 +1223,7 @@ face_color_gray_p (struct frame *f, const char *color_name)
1221 int gray_p; 1223 int gray_p;
1222 1224
1223 if (defined_color (f, color_name, &color, 0)) 1225 if (defined_color (f, color_name, &color, 0))
1224 gray_p = (/* Any color sufficiently close to black counts as grey. */ 1226 gray_p = (/* Any color sufficiently close to black counts as gray. */
1225 (color.red < 5000 && color.green < 5000 && color.blue < 5000) 1227 (color.red < 5000 && color.green < 5000 && color.blue < 5000)
1226 || 1228 ||
1227 ((eabs (color.red - color.green) 1229 ((eabs (color.red - color.green)
@@ -1242,7 +1244,8 @@ face_color_gray_p (struct frame *f, const char *color_name)
1242 color. */ 1244 color. */
1243 1245
1244static int 1246static int
1245face_color_supported_p (struct frame *f, const char *color_name, int background_p) 1247face_color_supported_p (struct frame *f, const char *color_name,
1248 int background_p)
1246{ 1249{
1247 Lisp_Object frame; 1250 Lisp_Object frame;
1248 XColor not_used; 1251 XColor not_used;
@@ -1315,7 +1318,8 @@ COLOR must be a valid color name. */)
1315 these colors. */ 1318 these colors. */
1316 1319
1317unsigned long 1320unsigned long
1318load_color (struct frame *f, struct face *face, Lisp_Object name, enum lface_attribute_index target_index) 1321load_color (struct frame *f, struct face *face, Lisp_Object name,
1322 enum lface_attribute_index target_index)
1319{ 1323{
1320 XColor color; 1324 XColor color;
1321 1325
@@ -1723,7 +1727,8 @@ fonts to match. The first MAXIMUM fonts are reported.
1723The optional fifth argument WIDTH, if specified, is a number of columns 1727The optional fifth argument WIDTH, if specified, is a number of columns
1724occupied by a character of a font. In that case, return only fonts 1728occupied by a character of a font. In that case, return only fonts
1725the WIDTH times as wide as FACE on FRAME. */) 1729the WIDTH times as wide as FACE on FRAME. */)
1726 (Lisp_Object pattern, Lisp_Object face, Lisp_Object frame, Lisp_Object maximum, Lisp_Object width) 1730 (Lisp_Object pattern, Lisp_Object face, Lisp_Object frame,
1731 Lisp_Object maximum, Lisp_Object width)
1727{ 1732{
1728 struct frame *f; 1733 struct frame *f;
1729 int size, avgwidth IF_LINT (= 0); 1734 int size, avgwidth IF_LINT (= 0);
@@ -1922,7 +1927,8 @@ check_lface_attrs (Lisp_Object *attrs)
1922 || IGNORE_DEFFACE_P (attrs[LFACE_FONT_INDEX]) 1927 || IGNORE_DEFFACE_P (attrs[LFACE_FONT_INDEX])
1923 || FONTP (attrs[LFACE_FONT_INDEX])); 1928 || FONTP (attrs[LFACE_FONT_INDEX]));
1924 xassert (UNSPECIFIEDP (attrs[LFACE_FONTSET_INDEX]) 1929 xassert (UNSPECIFIEDP (attrs[LFACE_FONTSET_INDEX])
1925 || STRINGP (attrs[LFACE_FONTSET_INDEX])); 1930 || STRINGP (attrs[LFACE_FONTSET_INDEX])
1931 || NILP (attrs[LFACE_FONTSET_INDEX]));
1926#endif 1932#endif
1927} 1933}
1928 1934
@@ -2060,7 +2066,8 @@ resolve_face_name (Lisp_Object face_name, int signal_p)
2060 signal an error if FACE_NAME is not a valid face name. If SIGNAL_P 2066 signal an error if FACE_NAME is not a valid face name. If SIGNAL_P
2061 is zero, value is nil if FACE_NAME is not a valid face name. */ 2067 is zero, value is nil if FACE_NAME is not a valid face name. */
2062static inline Lisp_Object 2068static inline Lisp_Object
2063lface_from_face_name_no_resolve (struct frame *f, Lisp_Object face_name, int signal_p) 2069lface_from_face_name_no_resolve (struct frame *f, Lisp_Object face_name,
2070 int signal_p)
2064{ 2071{
2065 Lisp_Object lface; 2072 Lisp_Object lface;
2066 2073
@@ -2102,7 +2109,8 @@ lface_from_face_name (struct frame *f, Lisp_Object face_name, int signal_p)
2102 Otherwise, value is zero if FACE_NAME is not a face. */ 2109 Otherwise, value is zero if FACE_NAME is not a face. */
2103 2110
2104static inline int 2111static inline int
2105get_lface_attributes_no_remap (struct frame *f, Lisp_Object face_name, Lisp_Object *attrs, int signal_p) 2112get_lface_attributes_no_remap (struct frame *f, Lisp_Object face_name,
2113 Lisp_Object *attrs, int signal_p)
2106{ 2114{
2107 Lisp_Object lface; 2115 Lisp_Object lface;
2108 2116
@@ -2123,7 +2131,9 @@ get_lface_attributes_no_remap (struct frame *f, Lisp_Object face_name, Lisp_Obje
2123 Otherwise, value is zero if FACE_NAME is not a face. */ 2131 Otherwise, value is zero if FACE_NAME is not a face. */
2124 2132
2125static inline int 2133static inline int
2126get_lface_attributes (struct frame *f, Lisp_Object face_name, Lisp_Object *attrs, int signal_p, struct named_merge_point *named_merge_points) 2134get_lface_attributes (struct frame *f, Lisp_Object face_name,
2135 Lisp_Object *attrs, int signal_p,
2136 struct named_merge_point *named_merge_points)
2127{ 2137{
2128 Lisp_Object face_remapping; 2138 Lisp_Object face_remapping;
2129 2139
@@ -2166,7 +2176,7 @@ lface_fully_specified_p (Lisp_Object *attrs)
2166 for (i = 1; i < LFACE_VECTOR_SIZE; ++i) 2176 for (i = 1; i < LFACE_VECTOR_SIZE; ++i)
2167 if (i != LFACE_FONT_INDEX && i != LFACE_INHERIT_INDEX) 2177 if (i != LFACE_FONT_INDEX && i != LFACE_INHERIT_INDEX)
2168 if ((UNSPECIFIEDP (attrs[i]) || IGNORE_DEFFACE_P (attrs[i]))) 2178 if ((UNSPECIFIEDP (attrs[i]) || IGNORE_DEFFACE_P (attrs[i])))
2169 break; 2179 break;
2170 2180
2171 return i == LFACE_VECTOR_SIZE; 2181 return i == LFACE_VECTOR_SIZE;
2172} 2182}
@@ -2179,7 +2189,8 @@ lface_fully_specified_p (Lisp_Object *attrs)
2179 of FORCE_P. */ 2189 of FORCE_P. */
2180 2190
2181static int 2191static int
2182set_lface_from_font (struct frame *f, Lisp_Object lface, Lisp_Object font_object, int force_p) 2192set_lface_from_font (struct frame *f, Lisp_Object lface,
2193 Lisp_Object font_object, int force_p)
2183{ 2194{
2184 Lisp_Object val; 2195 Lisp_Object val;
2185 struct font *font = XFONT_OBJECT (font_object); 2196 struct font *font = XFONT_OBJECT (font_object);
@@ -2289,7 +2300,8 @@ merge_face_heights (Lisp_Object from, Lisp_Object to, Lisp_Object invalid)
2289 other places. */ 2300 other places. */
2290 2301
2291static inline void 2302static inline void
2292merge_face_vectors (struct frame *f, Lisp_Object *from, Lisp_Object *to, struct named_merge_point *named_merge_points) 2303merge_face_vectors (struct frame *f, Lisp_Object *from, Lisp_Object *to,
2304 struct named_merge_point *named_merge_points)
2293{ 2305{
2294 int i; 2306 int i;
2295 2307
@@ -2356,7 +2368,8 @@ merge_face_vectors (struct frame *f, Lisp_Object *from, Lisp_Object *to, struct
2356 merging succeeded. */ 2368 merging succeeded. */
2357 2369
2358static int 2370static int
2359merge_named_face (struct frame *f, Lisp_Object face_name, Lisp_Object *to, struct named_merge_point *named_merge_points) 2371merge_named_face (struct frame *f, Lisp_Object face_name, Lisp_Object *to,
2372 struct named_merge_point *named_merge_points)
2360{ 2373{
2361 struct named_merge_point named_merge_point; 2374 struct named_merge_point named_merge_point;
2362 2375
@@ -2406,7 +2419,8 @@ merge_named_face (struct frame *f, Lisp_Object face_name, Lisp_Object *to, struc
2406 specifications. */ 2419 specifications. */
2407 2420
2408static int 2421static int
2409merge_face_ref (struct frame *f, Lisp_Object face_ref, Lisp_Object *to, int err_msgs, struct named_merge_point *named_merge_points) 2422merge_face_ref (struct frame *f, Lisp_Object face_ref, Lisp_Object *to,
2423 int err_msgs, struct named_merge_point *named_merge_points)
2410{ 2424{
2411 int ok = 1; /* Succeed without an error? */ 2425 int ok = 1; /* Succeed without an error? */
2412 2426
@@ -2565,7 +2579,7 @@ merge_face_ref (struct frame *f, Lisp_Object face_ref, Lisp_Object *to, int err_
2565 } 2579 }
2566 else if (EQ (keyword, QCstipple)) 2580 else if (EQ (keyword, QCstipple))
2567 { 2581 {
2568#if defined(HAVE_X_WINDOWS) || defined(HAVE_NS) 2582#if defined (HAVE_X_WINDOWS) || defined (HAVE_NS)
2569 Lisp_Object pixmap_p = Fbitmap_spec_p (value); 2583 Lisp_Object pixmap_p = Fbitmap_spec_p (value);
2570 if (!NILP (pixmap_p)) 2584 if (!NILP (pixmap_p))
2571 to[LFACE_STIPPLE_INDEX] = value; 2585 to[LFACE_STIPPLE_INDEX] = value;
@@ -2668,12 +2682,10 @@ Value is a vector of face attributes. */)
2668 The mapping from Lisp face to Lisp face id is given by the 2682 The mapping from Lisp face to Lisp face id is given by the
2669 property `face' of the Lisp face name. */ 2683 property `face' of the Lisp face name. */
2670 if (next_lface_id == lface_id_to_name_size) 2684 if (next_lface_id == lface_id_to_name_size)
2671 { 2685 lface_id_to_name =
2672 int new_size = max (50, 2 * lface_id_to_name_size); 2686 xpalloc (lface_id_to_name, &lface_id_to_name_size, 1,
2673 int sz = new_size * sizeof *lface_id_to_name; 2687 min (INT_MAX, MOST_POSITIVE_FIXNUM),
2674 lface_id_to_name = (Lisp_Object *) xrealloc (lface_id_to_name, sz); 2688 sizeof *lface_id_to_name);
2675 lface_id_to_name_size = new_size;
2676 }
2677 2689
2678 lface_id_to_name[next_lface_id] = face; 2690 lface_id_to_name[next_lface_id] = face;
2679 Fput (face, Qface, make_number (next_lface_id)); 2691 Fput (face, Qface, make_number (next_lface_id));
@@ -2839,7 +2851,7 @@ FRAME 0 means change the face on all frames, and change the default
2839 The value of that attribute will be inherited from some other 2851 The value of that attribute will be inherited from some other
2840 face during face merging. See internal_merge_in_global_face. */ 2852 face during face merging. See internal_merge_in_global_face. */
2841 if (UNSPECIFIEDP (value)) 2853 if (UNSPECIFIEDP (value))
2842 value = Qignore_defface; 2854 value = QCignore_defface;
2843 } 2855 }
2844 else 2856 else
2845 { 2857 {
@@ -2886,7 +2898,8 @@ FRAME 0 means change the face on all frames, and change the default
2886 { 2898 {
2887 /* The default face must have an absolute size. */ 2899 /* The default face must have an absolute size. */
2888 if (!INTEGERP (value) || XINT (value) <= 0) 2900 if (!INTEGERP (value) || XINT (value) <= 0)
2889 signal_error ("Default face height not absolute and positive", value); 2901 signal_error ("Default face height not absolute and positive",
2902 value);
2890 } 2903 }
2891 else 2904 else
2892 { 2905 {
@@ -2896,7 +2909,8 @@ FRAME 0 means change the face on all frames, and change the default
2896 make_number (10), 2909 make_number (10),
2897 Qnil); 2910 Qnil);
2898 if (!INTEGERP (test) || XINT (test) <= 0) 2911 if (!INTEGERP (test) || XINT (test) <= 0)
2899 signal_error ("Face height does not produce a positive integer", value); 2912 signal_error ("Face height does not produce a positive integer",
2913 value);
2900 } 2914 }
2901 } 2915 }
2902 2916
@@ -2975,7 +2989,7 @@ FRAME 0 means change the face on all frames, and change the default
2975 int valid_p; 2989 int valid_p;
2976 2990
2977 /* Allow t meaning a simple box of width 1 in foreground color 2991 /* Allow t meaning a simple box of width 1 in foreground color
2978 of the face. */ 2992 of the face. */
2979 if (EQ (value, Qt)) 2993 if (EQ (value, Qt))
2980 value = make_number (1); 2994 value = make_number (1);
2981 2995
@@ -3081,7 +3095,7 @@ FRAME 0 means change the face on all frames, and change the default
3081 } 3095 }
3082 else if (EQ (attr, QCstipple)) 3096 else if (EQ (attr, QCstipple))
3083 { 3097 {
3084#if defined(HAVE_X_WINDOWS) || defined(HAVE_NS) 3098#if defined (HAVE_X_WINDOWS) || defined (HAVE_NS)
3085 if (!UNSPECIFIEDP (value) && !IGNORE_DEFFACE_P (value) 3099 if (!UNSPECIFIEDP (value) && !IGNORE_DEFFACE_P (value)
3086 && !NILP (value) 3100 && !NILP (value)
3087 && NILP (Fbitmap_spec_p (value))) 3101 && NILP (Fbitmap_spec_p (value)))
@@ -3320,7 +3334,8 @@ FRAME 0 means change the face on all frames, and change the default
3320 has been assigned the value NEW_VALUE. */ 3334 has been assigned the value NEW_VALUE. */
3321 3335
3322void 3336void
3323update_face_from_frame_parameter (struct frame *f, Lisp_Object param, Lisp_Object new_value) 3337update_face_from_frame_parameter (struct frame *f, Lisp_Object param,
3338 Lisp_Object new_value)
3324{ 3339{
3325 Lisp_Object face = Qnil; 3340 Lisp_Object face = Qnil;
3326 Lisp_Object lface; 3341 Lisp_Object lface;
@@ -3345,7 +3360,7 @@ update_face_from_frame_parameter (struct frame *f, Lisp_Object param, Lisp_Objec
3345 3360
3346 /* Changing the background color might change the background 3361 /* Changing the background color might change the background
3347 mode, so that we have to load new defface specs. 3362 mode, so that we have to load new defface specs.
3348 Call frame-update-face-colors to do that. */ 3363 Call frame-set-background-mode to do that. */
3349 XSETFRAME (frame, f); 3364 XSETFRAME (frame, f);
3350 call1 (Qframe_set_background_mode, frame); 3365 call1 (Qframe_set_background_mode, frame);
3351 3366
@@ -3534,6 +3549,8 @@ x_update_menu_appearance (struct frame *f)
3534 rdb != NULL)) 3549 rdb != NULL))
3535 { 3550 {
3536 char line[512]; 3551 char line[512];
3552 char *buf = line;
3553 ptrdiff_t bufsize = sizeof line;
3537 Lisp_Object lface = lface_from_face_name (f, Qmenu, 1); 3554 Lisp_Object lface = lface_from_face_name (f, Qmenu, 1);
3538 struct face *face = FACE_FROM_ID (f, MENU_FACE_ID); 3555 struct face *face = FACE_FROM_ID (f, MENU_FACE_ID);
3539 const char *myname = SSDATA (Vx_resource_name); 3556 const char *myname = SSDATA (Vx_resource_name);
@@ -3546,24 +3563,25 @@ x_update_menu_appearance (struct frame *f)
3546 3563
3547 if (STRINGP (LFACE_FOREGROUND (lface))) 3564 if (STRINGP (LFACE_FOREGROUND (lface)))
3548 { 3565 {
3549 sprintf (line, "%s.%s*foreground: %s", 3566 exprintf (&buf, &bufsize, line, -1, "%s.%s*foreground: %s",
3550 myname, popup_path, 3567 myname, popup_path,
3551 SDATA (LFACE_FOREGROUND (lface))); 3568 SDATA (LFACE_FOREGROUND (lface)));
3552 XrmPutLineResource (&rdb, line); 3569 XrmPutLineResource (&rdb, line);
3553 sprintf (line, "%s.pane.menubar*foreground: %s", 3570 exprintf (&buf, &bufsize, line, -1, "%s.pane.menubar*foreground: %s",
3554 myname, SDATA (LFACE_FOREGROUND (lface))); 3571 myname, SDATA (LFACE_FOREGROUND (lface)));
3555 XrmPutLineResource (&rdb, line); 3572 XrmPutLineResource (&rdb, line);
3556 changed_p = 1; 3573 changed_p = 1;
3557 } 3574 }
3558 3575
3559 if (STRINGP (LFACE_BACKGROUND (lface))) 3576 if (STRINGP (LFACE_BACKGROUND (lface)))
3560 { 3577 {
3561 sprintf (line, "%s.%s*background: %s", 3578 exprintf (&buf, &bufsize, line, -1, "%s.%s*background: %s",
3562 myname, popup_path, 3579 myname, popup_path,
3563 SDATA (LFACE_BACKGROUND (lface))); 3580 SDATA (LFACE_BACKGROUND (lface)));
3564 XrmPutLineResource (&rdb, line); 3581 XrmPutLineResource (&rdb, line);
3565 sprintf (line, "%s.pane.menubar*background: %s", 3582
3566 myname, SDATA (LFACE_BACKGROUND (lface))); 3583 exprintf (&buf, &bufsize, line, -1, "%s.pane.menubar*background: %s",
3584 myname, SDATA (LFACE_BACKGROUND (lface)));
3567 XrmPutLineResource (&rdb, line); 3585 XrmPutLineResource (&rdb, line);
3568 changed_p = 1; 3586 changed_p = 1;
3569 } 3587 }
@@ -3601,11 +3619,12 @@ x_update_menu_appearance (struct frame *f)
3601#else 3619#else
3602 char *fontsetname = SSDATA (xlfd); 3620 char *fontsetname = SSDATA (xlfd);
3603#endif 3621#endif
3604 sprintf (line, "%s.pane.menubar*font%s: %s", 3622 exprintf (&buf, &bufsize, line, -1, "%s.pane.menubar*font%s: %s",
3605 myname, suffix, fontsetname); 3623 myname, suffix, fontsetname);
3606 XrmPutLineResource (&rdb, line); 3624 XrmPutLineResource (&rdb, line);
3607 sprintf (line, "%s.%s*font%s: %s", 3625
3608 myname, popup_path, suffix, fontsetname); 3626 exprintf (&buf, &bufsize, line, -1, "%s.%s*font%s: %s",
3627 myname, popup_path, suffix, fontsetname);
3609 XrmPutLineResource (&rdb, line); 3628 XrmPutLineResource (&rdb, line);
3610 changed_p = 1; 3629 changed_p = 1;
3611 if (fontsetname != SSDATA (xlfd)) 3630 if (fontsetname != SSDATA (xlfd))
@@ -3615,6 +3634,9 @@ x_update_menu_appearance (struct frame *f)
3615 3634
3616 if (changed_p && f->output_data.x->menubar_widget) 3635 if (changed_p && f->output_data.x->menubar_widget)
3617 free_frame_menubar (f); 3636 free_frame_menubar (f);
3637
3638 if (buf != line)
3639 xfree (buf);
3618 } 3640 }
3619} 3641}
3620 3642
@@ -3634,7 +3656,7 @@ the only relative value that users see is `unspecified'.
3634However, for :height, floating point values are also relative. */) 3656However, for :height, floating point values are also relative. */)
3635 (Lisp_Object attribute, Lisp_Object value) 3657 (Lisp_Object attribute, Lisp_Object value)
3636{ 3658{
3637 if (EQ (value, Qunspecified) || (EQ (value, Qignore_defface))) 3659 if (EQ (value, Qunspecified) || (EQ (value, QCignore_defface)))
3638 return Qt; 3660 return Qt;
3639 else if (EQ (attribute, QCheight)) 3661 else if (EQ (attribute, QCheight))
3640 return INTEGERP (value) ? Qnil : Qt; 3662 return INTEGERP (value) ? Qnil : Qt;
@@ -3649,7 +3671,7 @@ If VALUE1 or VALUE2 are absolute (see `face-attribute-relative-p'), then
3649the result will be absolute, otherwise it will be relative. */) 3671the result will be absolute, otherwise it will be relative. */)
3650 (Lisp_Object attribute, Lisp_Object value1, Lisp_Object value2) 3672 (Lisp_Object attribute, Lisp_Object value1, Lisp_Object value2)
3651{ 3673{
3652 if (EQ (value1, Qunspecified) || EQ (value1, Qignore_defface)) 3674 if (EQ (value1, Qunspecified) || EQ (value1, QCignore_defface))
3653 return value2; 3675 return value2;
3654 else if (EQ (attribute, QCheight)) 3676 else if (EQ (attribute, QCheight))
3655 return merge_face_heights (value1, value2, value1); 3677 return merge_face_heights (value1, value2, value1);
@@ -4053,7 +4075,7 @@ lface_same_font_attributes_p (Lisp_Object *lface1, Lisp_Object *lface2)
4053 xassert (lface_fully_specified_p (lface1) 4075 xassert (lface_fully_specified_p (lface1)
4054 && lface_fully_specified_p (lface2)); 4076 && lface_fully_specified_p (lface2));
4055 return (xstrcasecmp (SSDATA (lface1[LFACE_FAMILY_INDEX]), 4077 return (xstrcasecmp (SSDATA (lface1[LFACE_FAMILY_INDEX]),
4056 SSDATA (lface2[LFACE_FAMILY_INDEX])) == 0 4078 SSDATA (lface2[LFACE_FAMILY_INDEX])) == 0
4057 && xstrcasecmp (SSDATA (lface1[LFACE_FOUNDRY_INDEX]), 4079 && xstrcasecmp (SSDATA (lface1[LFACE_FOUNDRY_INDEX]),
4058 SSDATA (lface2[LFACE_FOUNDRY_INDEX])) == 0 4080 SSDATA (lface2[LFACE_FOUNDRY_INDEX])) == 0
4059 && EQ (lface1[LFACE_HEIGHT_INDEX], lface2[LFACE_HEIGHT_INDEX]) 4081 && EQ (lface1[LFACE_HEIGHT_INDEX], lface2[LFACE_HEIGHT_INDEX])
@@ -4065,7 +4087,7 @@ lface_same_font_attributes_p (Lisp_Object *lface1, Lisp_Object *lface2)
4065 || (STRINGP (lface1[LFACE_FONTSET_INDEX]) 4087 || (STRINGP (lface1[LFACE_FONTSET_INDEX])
4066 && STRINGP (lface2[LFACE_FONTSET_INDEX]) 4088 && STRINGP (lface2[LFACE_FONTSET_INDEX])
4067 && ! xstrcasecmp (SSDATA (lface1[LFACE_FONTSET_INDEX]), 4089 && ! xstrcasecmp (SSDATA (lface1[LFACE_FONTSET_INDEX]),
4068 SSDATA (lface2[LFACE_FONTSET_INDEX])))) 4090 SSDATA (lface2[LFACE_FONTSET_INDEX]))))
4069 ); 4091 );
4070} 4092}
4071 4093
@@ -4167,13 +4189,13 @@ prepare_face_for_display (struct frame *f, struct face *face)
4167static int 4189static int
4168color_distance (XColor *x, XColor *y) 4190color_distance (XColor *x, XColor *y)
4169{ 4191{
4170 /* This formula is from a paper title `Colour metric' by Thiadmer Riemersma. 4192 /* This formula is from a paper titled `Colour metric' by Thiadmer Riemersma.
4171 Quoting from that paper: 4193 Quoting from that paper:
4172 4194
4173 This formula has results that are very close to L*u*v* (with the 4195 This formula has results that are very close to L*u*v* (with the
4174 modified lightness curve) and, more importantly, it is a more even 4196 modified lightness curve) and, more importantly, it is a more even
4175 algorithm: it does not have a range of colours where it suddenly 4197 algorithm: it does not have a range of colors where it suddenly
4176 gives far from optimal results. 4198 gives far from optimal results.
4177 4199
4178 See <http://www.compuphase.com/cmetric.htm> for more info. */ 4200 See <http://www.compuphase.com/cmetric.htm> for more info. */
4179 4201
@@ -4411,15 +4433,8 @@ cache_face (struct face_cache *c, struct face *face, unsigned int hash)
4411 if (i == c->used) 4433 if (i == c->used)
4412 { 4434 {
4413 if (c->used == c->size) 4435 if (c->used == c->size)
4414 { 4436 c->faces_by_id = xpalloc (c->faces_by_id, &c->size, 1, MAX_FACE_ID,
4415 int new_size, sz; 4437 sizeof *c->faces_by_id);
4416 new_size = min (2 * c->size, MAX_FACE_ID);
4417 if (new_size == c->size)
4418 abort (); /* Alternatives? ++kfs */
4419 sz = new_size * sizeof *c->faces_by_id;
4420 c->faces_by_id = (struct face **) xrealloc (c->faces_by_id, sz);
4421 c->size = new_size;
4422 }
4423 c->used++; 4438 c->used++;
4424 } 4439 }
4425 4440
@@ -4703,7 +4718,8 @@ face_with_height (struct frame *f, int face_id, int height)
4703 default face. FACE_ID is assumed to be already realized. */ 4718 default face. FACE_ID is assumed to be already realized. */
4704 4719
4705int 4720int
4706lookup_derived_face (struct frame *f, Lisp_Object symbol, int face_id, int signal_p) 4721lookup_derived_face (struct frame *f, Lisp_Object symbol, int face_id,
4722 int signal_p)
4707{ 4723{
4708 Lisp_Object attrs[LFACE_VECTOR_SIZE]; 4724 Lisp_Object attrs[LFACE_VECTOR_SIZE];
4709 Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE]; 4725 Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE];
@@ -4759,7 +4775,8 @@ DEFUN ("face-attributes-as-vector", Fface_attributes_as_vector,
4759 \(2) `close in spirit' to what the attributes specify, if not exact. */ 4775 \(2) `close in spirit' to what the attributes specify, if not exact. */
4760 4776
4761static int 4777static int
4762x_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs, struct face *def_face) 4778x_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs,
4779 struct face *def_face)
4763{ 4780{
4764 Lisp_Object *def_attrs = def_face->lface; 4781 Lisp_Object *def_attrs = def_face->lface;
4765 4782
@@ -4860,7 +4877,8 @@ x_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs, struct face *
4860 substitution of a `dim' face for italic. */ 4877 substitution of a `dim' face for italic. */
4861 4878
4862static int 4879static int
4863tty_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs, struct face *def_face) 4880tty_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs,
4881 struct face *def_face)
4864{ 4882{
4865 int weight; 4883 int weight;
4866 Lisp_Object val, fg, bg; 4884 Lisp_Object val, fg, bg;
@@ -5012,7 +5030,8 @@ tty_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs, struct face
5012 /* See if the capabilities we selected above are supported, with the 5030 /* See if the capabilities we selected above are supported, with the
5013 given colors. */ 5031 given colors. */
5014 if (test_caps != 0 && 5032 if (test_caps != 0 &&
5015 ! tty_capable_p (FRAME_TTY (f), test_caps, fg_tty_color.pixel, bg_tty_color.pixel)) 5033 ! tty_capable_p (FRAME_TTY (f), test_caps, fg_tty_color.pixel,
5034 bg_tty_color.pixel))
5016 return 0; 5035 return 0;
5017 5036
5018 5037
@@ -5284,8 +5303,8 @@ realize_basic_faces (struct frame *f)
5284 { 5303 {
5285 FRAME_FACE_CACHE (f)->menu_face_changed_p = 0; 5304 FRAME_FACE_CACHE (f)->menu_face_changed_p = 0;
5286#ifdef USE_X_TOOLKIT 5305#ifdef USE_X_TOOLKIT
5287 if (FRAME_WINDOW_P (f)) 5306 if (FRAME_WINDOW_P (f))
5288 x_update_menu_appearance (f); 5307 x_update_menu_appearance (f);
5289#endif 5308#endif
5290 } 5309 }
5291 5310
@@ -5405,14 +5424,14 @@ realize_default_face (struct frame *f)
5405 if (FRAME_X_P (f) && face->font != FRAME_FONT (f)) 5424 if (FRAME_X_P (f) && face->font != FRAME_FONT (f))
5406 { 5425 {
5407 /* This can happen when making a frame on a display that does 5426 /* This can happen when making a frame on a display that does
5408 not support the default font. */ 5427 not support the default font. */
5409 if (!face->font) 5428 if (!face->font)
5410 return 0; 5429 return 0;
5411 5430
5412 /* Otherwise, the font specified for the frame was not 5431 /* Otherwise, the font specified for the frame was not
5413 acceptable as a font for the default face (perhaps because 5432 acceptable as a font for the default face (perhaps because
5414 auto-scaled fonts are rejected), so we must adjust the frame 5433 auto-scaled fonts are rejected), so we must adjust the frame
5415 font. */ 5434 font. */
5416 x_set_font (f, LFACE_FONT (lface), Qnil); 5435 x_set_font (f, LFACE_FONT (lface), Qnil);
5417 } 5436 }
5418#endif /* HAVE_X_WINDOWS */ 5437#endif /* HAVE_X_WINDOWS */
@@ -5503,7 +5522,8 @@ realize_face (struct face_cache *cache, Lisp_Object *attrs, int former_face_id)
5503 no-font. */ 5522 no-font. */
5504 5523
5505static struct face * 5524static struct face *
5506realize_non_ascii_face (struct frame *f, Lisp_Object font_object, struct face *base_face) 5525realize_non_ascii_face (struct frame *f, Lisp_Object font_object,
5526 struct face *base_face)
5507{ 5527{
5508 struct face_cache *cache = FRAME_FACE_CACHE (f); 5528 struct face_cache *cache = FRAME_FACE_CACHE (f);
5509 struct face *face; 5529 struct face *face;
@@ -5622,7 +5642,7 @@ realize_x_face (struct face_cache *cache, Lisp_Object *attrs)
5622 else if (INTEGERP (box)) 5642 else if (INTEGERP (box))
5623 { 5643 {
5624 /* Simple box of specified line width in foreground color of the 5644 /* Simple box of specified line width in foreground color of the
5625 face. */ 5645 face. */
5626 xassert (XINT (box) != 0); 5646 xassert (XINT (box) != 0);
5627 face->box = FACE_SIMPLE_BOX; 5647 face->box = FACE_SIMPLE_BOX;
5628 face->box_line_width = XINT (box); 5648 face->box_line_width = XINT (box);
@@ -5744,7 +5764,8 @@ realize_x_face (struct face_cache *cache, Lisp_Object *attrs)
5744 default foreground/background colors. */ 5764 default foreground/background colors. */
5745 5765
5746static void 5766static void
5747map_tty_color (struct frame *f, struct face *face, enum lface_attribute_index idx, int *defaulted) 5767map_tty_color (struct frame *f, struct face *face,
5768 enum lface_attribute_index idx, int *defaulted)
5748{ 5769{
5749 Lisp_Object frame, color, def; 5770 Lisp_Object frame, color, def;
5750 int foreground_p = idx == LFACE_FOREGROUND_INDEX; 5771 int foreground_p = idx == LFACE_FOREGROUND_INDEX;
@@ -5800,7 +5821,7 @@ map_tty_color (struct frame *f, struct face *face, enum lface_attribute_index id
5800 face->lface[idx] = tty_color_name (f, pixel); 5821 face->lface[idx] = tty_color_name (f, pixel);
5801 *defaulted = 1; 5822 *defaulted = 1;
5802 } 5823 }
5803 } 5824 }
5804#endif /* MSDOS */ 5825#endif /* MSDOS */
5805 } 5826 }
5806 5827
@@ -5985,9 +6006,18 @@ face_at_buffer_position (struct window *w, EMACS_INT pos,
5985 6006
5986 *endptr = endpos; 6007 *endptr = endpos;
5987 6008
5988 default_face = FACE_FROM_ID (f, base_face_id >= 0 ? base_face_id 6009 {
5989 : NILP (Vface_remapping_alist) ? DEFAULT_FACE_ID 6010 int face_id;
5990 : lookup_basic_face (f, DEFAULT_FACE_ID)); 6011
6012 if (base_face_id >= 0)
6013 face_id = base_face_id;
6014 else if (NILP (Vface_remapping_alist))
6015 face_id = DEFAULT_FACE_ID;
6016 else
6017 face_id = lookup_basic_face (f, DEFAULT_FACE_ID);
6018
6019 default_face = FACE_FROM_ID (f, face_id);
6020 }
5991 6021
5992 /* Optimize common cases where we can use the default face. */ 6022 /* Optimize common cases where we can use the default face. */
5993 if (noverlays == 0 6023 if (noverlays == 0
@@ -6461,7 +6491,7 @@ syms_of_xfaces (void)
6461 DEFSYM (Qbackground_color, "background-color"); 6491 DEFSYM (Qbackground_color, "background-color");
6462 DEFSYM (Qforeground_color, "foreground-color"); 6492 DEFSYM (Qforeground_color, "foreground-color");
6463 DEFSYM (Qunspecified, "unspecified"); 6493 DEFSYM (Qunspecified, "unspecified");
6464 DEFSYM (Qignore_defface, ":ignore-defface"); 6494 DEFSYM (QCignore_defface, ":ignore-defface");
6465 6495
6466 DEFSYM (Qface_alias, "face-alias"); 6496 DEFSYM (Qface_alias, "face-alias");
6467 DEFSYM (Qdefault, "default"); 6497 DEFSYM (Qdefault, "default");
@@ -6569,20 +6599,22 @@ ignore. */);
6569 doc: /* Alist of face remappings. 6599 doc: /* Alist of face remappings.
6570Each element is of the form: 6600Each element is of the form:
6571 6601
6572 (FACE REPLACEMENT...), 6602 (FACE . REPLACEMENT),
6603
6604which causes display of the face FACE to use REPLACEMENT instead.
6605REPLACEMENT is a face specification, i.e. one of the following:
6573 6606
6574which causes display of the face FACE to use REPLACEMENT... instead. 6607 (1) a face name
6575REPLACEMENT... is interpreted the same way as the value of a `face' 6608 (2) a property list of attribute/value pairs, or
6576text property: it may be (1) A face name, (2) A list of face names, 6609 (3) a list in which each element has the form of (1) or (2).
6577(3) A property-list of face attribute/value pairs, or (4) A list of
6578face names or lists containing face attribute/value pairs.
6579 6610
6580Multiple entries in REPLACEMENT... are merged together to form the final 6611List values for REPLACEMENT are merged to form the final face
6581result, with faces or attributes earlier in the list taking precedence 6612specification, with earlier entries taking precedence, in the same as
6582over those that are later. 6613as in the `face' text property.
6583 6614
6584Face-name remapping cycles are suppressed; recursive references use the 6615Face-name remapping cycles are suppressed; recursive references use
6585underlying face instead of the remapped face. So a remapping of the form: 6616the underlying face instead of the remapped face. So a remapping of
6617the form:
6586 6618
6587 (FACE EXTRA-FACE... FACE) 6619 (FACE EXTRA-FACE... FACE)
6588 6620
@@ -6590,16 +6622,16 @@ or:
6590 6622
6591 (FACE (FACE-ATTR VAL ...) FACE) 6623 (FACE (FACE-ATTR VAL ...) FACE)
6592 6624
6593will cause EXTRA-FACE... or (FACE-ATTR VAL ...) to be _merged_ with the 6625causes EXTRA-FACE... or (FACE-ATTR VAL ...) to be _merged_ with the
6594existing definition of FACE. Note that for the default face, this isn't 6626existing definition of FACE. Note that this isn't necessary for the
6595necessary, as every face inherits from the default face. 6627default face, since every face inherits from the default face.
6596 6628
6597Making this variable buffer-local is a good way to allow buffer-specific 6629If this variable is made buffer-local, the face remapping takes effect
6598face definitions. For instance, the mode my-mode could define a face 6630only in that buffer. For instance, the mode my-mode could define a
6599`my-mode-default', and then in the mode setup function, do: 6631face `my-mode-default', and then in the mode setup function, do:
6600 6632
6601 (set (make-local-variable 'face-remapping-alist) 6633 (set (make-local-variable 'face-remapping-alist)
6602 '((default my-mode-default)))). 6634 '((default my-mode-default)))).
6603 6635
6604Because Emacs normally only redraws screen areas when the underlying 6636Because Emacs normally only redraws screen areas when the underlying
6605buffer contents change, you may need to call `redraw-display' after 6637buffer contents change, you may need to call `redraw-display' after