aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii1999-12-15 13:14:38 +0000
committerEli Zaretskii1999-12-15 13:14:38 +0000
commitf9d2fdc464f130fbde700cecc00c031ef7e8e4f2 (patch)
tree2102159b730a603bb26d4e7d5162211d958058d7
parente19539f184768f9411860daf9ef9d983e48e2650 (diff)
downloademacs-f9d2fdc464f130fbde700cecc00c031ef7e8e4f2.tar.gz
emacs-f9d2fdc464f130fbde700cecc00c031ef7e8e4f2.zip
Changes for separate unspecified foreground and background colors
on character terminals: * dispextern.h (FACE_TTY_DEFAULT_FG_COLOR) (FACE_TTY_DEFAULT_BG_COLOR): New macros. * xfaces.c (Qunspecified_fg, Qunspecified_bg): New variables. (syms_of_xfaces): Initialize and staticpro them. (tty_defined_color): If the color name is unspecified-fg or unspecified-bg, return FACE_TTY_DEFAULT_FG_COLOR and FACE_TTY_DEFAULT_BG_COLOR, respectively, as the pixel value. (tty_color_name): If the color pixel value is either FACE_TTY_DEFAULT_FG_COLOR or FACE_TTY_DEFAULT_BG_COLOR, return Qunspecified_fg or Qunspecified_bg, respectively. (Finternal_set_lisp_face_attribute): Allow values Qunspecified_fg and Qunspecified_bg for foreground and background colors. (realize_default_face): If the foreground and background colors are not specified, default to Qunspecified_fg and Qunspecified_bg. (realize_tty_face): By default, set the face colors to FACE_TTY_DEFAULT_FG_COLOR and FACE_TTY_DEFAULT_BG_COLOR. [MSDOS]: Handle FACE_TTY_DEFAULT_FG_COLOR and FACE_TTY_DEFAULT_BG_COLOR when face colors are not defined. Reverse the colors if the default colors were reversed. * dispnew.c (init_display): Initialize the frame pixels of the initial frame to FACE_TTY_DEFAULT_FG_COLOR and FACE_TTY_DEFAULT_BG_COLOR. * term.c (turn_on_face): If the default fore- and background colors are reversed, enter inverse video mode. Don't send color escape sequences for unspecified foreground and background colors. (turn_off_face): Handle unspecified-fg and unspecified-bg colors. * dosfns.c (unspecified_colors): New variable. (msdos_stdcolor_idx): Handle unspecified-fg and unspecified-bg color names, return FACE_TTY_DEFAULT_FG_COLOR and FACE_TTY_DEFAULT_BG_COLOR, respectively. (msdos_stdcolor_name): Handle FACE_TTY_DEFAULT_FG_COLOR and FACE_TTY_DEFAULT_BG_COLOR, return Qunspecified_fg and Qunspecified_bg, respectively. * msdos.c (IT_set_face): Support FACE_TTY_DEFAULT_FG_COLOR and FACE_TTY_DEFAULT_BG_COLOR as pixel values. * faces.el (face-read-integer, read-face-attribute) (color-defined-p, color-values): Allow color values unspecified-fg and unspecified-bg, handle them as unspecified.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/faces.el21
-rw-r--r--src/ChangeLog43
-rw-r--r--src/dispextern.h8
-rw-r--r--src/dispnew.c4
-rw-r--r--src/dosfns.c18
-rw-r--r--src/msdos.c8
-rw-r--r--src/term.c14
-rw-r--r--src/xfaces.c82
9 files changed, 167 insertions, 37 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 40e6d0ccb80..799ed3b55b9 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
11999-12-15 Eli Zaretskii <eliz@is.elta.co.il>
2
3 * faces.el (face-read-integer, read-face-attribute)
4 (color-defined-p, color-values): Allow color values unspecified-fg
5 and unspecified-bg, handle them as unspecified.
6
11999-12-15 Kenichi Handa <handa@etl.go.jp> 71999-12-15 Kenichi Handa <handa@etl.go.jp>
2 8
3 The following changes are for the new composition mechanism. We 9 The following changes are for the new composition mechanism. We
diff --git a/lisp/faces.el b/lisp/faces.el
index 80ed7fc12a7..f4e071222d3 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -827,12 +827,14 @@ value to return if no new value is entered. NAME is a descriptive
827name of the attribute for prompting. Value is the new attribute value." 827name of the attribute for prompting. Value is the new attribute value."
828 (let ((new-value 828 (let ((new-value
829 (face-read-string face 829 (face-read-string face
830 (if (eq default 'unspecified) 830 (if (memq
831 'unspecified 831 default
832 '(unspecified unspecified-fg unspecified-bg))
833 default
832 (int-to-string default)) 834 (int-to-string default))
833 name 835 name
834 (list (cons "unspecified" 'unspecified))))) 836 (list (cons "unspecified" 'unspecified)))))
835 (if (eq new-value 'unspecified) 837 (if (memq new-value '(unspecified unspecified-fg unspecified-bg))
836 new-value 838 new-value
837 (string-to-int new-value)))) 839 (string-to-int new-value))))
838 840
@@ -862,7 +864,8 @@ of a global face. Value is the new attribute value."
862 ;; in tty-colors.el. 864 ;; in tty-colors.el.
863 (if (and (memq attribute '(:foreground :background)) 865 (if (and (memq attribute '(:foreground :background))
864 (not (memq window-system '(x w32 mac))) 866 (not (memq window-system '(x w32 mac)))
865 (not (eq new-value 'unspecified))) 867 (not (memq new-value
868 '(unspecified unspecified-fg unspecified-bg))))
866 (setq new-value (car (tty-color-desc new-value)))) 869 (setq new-value (car (tty-color-desc new-value))))
867 (unless (eq new-value 'unspecified) 870 (unless (eq new-value 'unspecified)
868 (setq new-value (cdr (assoc new-value valid))))) 871 (setq new-value (cdr (assoc new-value valid)))))
@@ -1164,8 +1167,9 @@ If FRAME doesn't support colors, the value is nil."
1164(defun color-defined-p (color &optional frame) 1167(defun color-defined-p (color &optional frame)
1165 "Return non-nil if color COLOR is supported on frame FRAME. 1168 "Return non-nil if color COLOR is supported on frame FRAME.
1166If FRAME is omitted or nil, use the selected frame. 1169If FRAME is omitted or nil, use the selected frame.
1167If COLOR is the symbol `unspecified', the value is nil." 1170If COLOR is one of the symbols `unspecified', `unspecified-fg', or
1168 (if (eq color 'unspecified) 1171`unspecified-bg', the value is nil."
1172 (if (memq color '(unspecified unspecified-bg unspecified-fg))
1169 nil 1173 nil
1170 (if (memq (framep (or frame (selected-frame))) '(x w32)) 1174 (if (memq (framep (or frame (selected-frame))) '(x w32))
1171 (xw-color-defined-p color frame) 1175 (xw-color-defined-p color frame)
@@ -1179,8 +1183,9 @@ These values appear to range from 0 to 65280 or 65535, depending
1179on the system; white is \(65280 65280 65280\) or \(65535 65535 65535\). 1183on the system; white is \(65280 65280 65280\) or \(65535 65535 65535\).
1180If FRAME is omitted or nil, use the selected frame. 1184If FRAME is omitted or nil, use the selected frame.
1181If FRAME cannot display COLOR, the value is nil. 1185If FRAME cannot display COLOR, the value is nil.
1182If COLOR is the symbol `unspecified', the value is nil." 1186If COLOR is one of the symbols `unspecified', `unspecified-fg', or
1183 (if (eq color 'unspecified) 1187`unspecified-bg', the value is nil."
1188 (if (memq color '(unspecified unspecified-fg unspecified-bg))
1184 nil 1189 nil
1185 (if (memq (framep (or frame (selected-frame))) '(x w32)) 1190 (if (memq (framep (or frame (selected-frame))) '(x w32))
1186 (xw-color-values color frame) 1191 (xw-color-values color frame)
diff --git a/src/ChangeLog b/src/ChangeLog
index df9ad9937c5..97ffe12775e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,46 @@
11999-12-15 Eli Zaretskii <eliz@is.elta.co.il>
2
3 * dispextern.h (FACE_TTY_DEFAULT_FG_COLOR)
4 (FACE_TTY_DEFAULT_BG_COLOR): New macros.
5
6 * xfaces.c (Qunspecified_fg, Qunspecified_bg): New variables.
7 (syms_of_xfaces): Initialize and staticpro them.
8 (tty_defined_color): If the color name is unspecified-fg or
9 unspecified-bg, return FACE_TTY_DEFAULT_FG_COLOR and
10 FACE_TTY_DEFAULT_BG_COLOR, respectively, as the pixel value.
11 (tty_color_name): If the color pixel value is either
12 FACE_TTY_DEFAULT_FG_COLOR or FACE_TTY_DEFAULT_BG_COLOR, return
13 Qunspecified_fg or Qunspecified_bg, respectively.
14 (Finternal_set_lisp_face_attribute): Allow values Qunspecified_fg
15 and Qunspecified_bg for foreground and background colors.
16 (realize_default_face): If the foreground and background colors
17 are not specified, default to Qunspecified_fg and Qunspecified_bg.
18 (realize_tty_face): By default, set the face colors to
19 FACE_TTY_DEFAULT_FG_COLOR and FACE_TTY_DEFAULT_BG_COLOR.
20 [MSDOS]: Handle FACE_TTY_DEFAULT_FG_COLOR and
21 FACE_TTY_DEFAULT_BG_COLOR when face colors are not defined.
22 Reverse the colors if the default colors were reversed.
23
24 * dispnew.c (init_display): Initialize the frame pixels of the
25 initial frame to FACE_TTY_DEFAULT_FG_COLOR and
26 FACE_TTY_DEFAULT_BG_COLOR.
27
28 * term.c (turn_on_face): If the default fore- and background
29 colors are reversed, enter inverse video mode. Don't send color
30 escape sequences for unspecified foreground and background colors.
31 (turn_off_face): Handle unspecified-fg and unspecified-bg colors.
32
33 * dosfns.c (unspecified_colors): New variable.
34 (msdos_stdcolor_idx): Handle unspecified-fg and unspecified-bg
35 color names, return FACE_TTY_DEFAULT_FG_COLOR and
36 FACE_TTY_DEFAULT_BG_COLOR, respectively.
37 (msdos_stdcolor_name): Handle FACE_TTY_DEFAULT_FG_COLOR and
38 FACE_TTY_DEFAULT_BG_COLOR, return Qunspecified_fg and
39 Qunspecified_bg, respectively.
40
41 * msdos.c (IT_set_face): Support FACE_TTY_DEFAULT_FG_COLOR and
42 FACE_TTY_DEFAULT_BG_COLOR as pixel values.
43
11999-12-15 Kenichi Handa <handa@etl.go.jp> 441999-12-15 Kenichi Handa <handa@etl.go.jp>
2 45
3 * coding.c (code_convert_region): Fix the secoding arg to 46 * coding.c (code_convert_region): Fix the secoding arg to
diff --git a/src/dispextern.h b/src/dispextern.h
index edd9a7c97be..eadf745d400 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1268,6 +1268,14 @@ struct face
1268 1268
1269#define FACE_TTY_DEFAULT_COLOR ((unsigned long) -1) 1269#define FACE_TTY_DEFAULT_COLOR ((unsigned long) -1)
1270 1270
1271/* Color index indicating that face uses an unknown foreground color. */
1272
1273#define FACE_TTY_DEFAULT_FG_COLOR ((unsigned long) -2)
1274
1275/* Color index indicating that face uses an unsigned background color. */
1276
1277#define FACE_TTY_DEFAULT_BG_COLOR ((unsigned long) -3)
1278
1271/* Non-zero if FACE was realized for unibyte use. */ 1279/* Non-zero if FACE was realized for unibyte use. */
1272 1280
1273#define FACE_UNIBYTE_P(FACE) ((FACE)->charset < 0) 1281#define FACE_UNIBYTE_P(FACE) ((FACE)->charset < 0)
diff --git a/src/dispnew.c b/src/dispnew.c
index 8ce4e419565..930e7a793d4 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -5925,8 +5925,8 @@ For types not defined in VMS, use define emacs_term \"TYPE\".\n\
5925 are the foreground and background colors of the terminal. */ 5925 are the foreground and background colors of the terminal. */
5926 struct frame *sf = SELECTED_FRAME(); 5926 struct frame *sf = SELECTED_FRAME();
5927 5927
5928 FRAME_FOREGROUND_PIXEL (sf) = -1; 5928 FRAME_FOREGROUND_PIXEL (sf) = FACE_TTY_DEFAULT_FG_COLOR;
5929 FRAME_BACKGROUND_PIXEL (sf) = -1; 5929 FRAME_BACKGROUND_PIXEL (sf) = FACE_TTY_DEFAULT_BG_COLOR;
5930 call0 (intern ("tty-set-up-initial-frame-faces")); 5930 call0 (intern ("tty-set-up-initial-frame-faces"));
5931 } 5931 }
5932} 5932}
diff --git a/src/dosfns.c b/src/dosfns.c
index 857d16bd9b2..feb9080b7c7 100644
--- a/src/dosfns.c
+++ b/src/dosfns.c
@@ -409,6 +409,10 @@ static char *vga_colors[16] = {
409 "lightred", "lightmagenta", "yellow", "white" 409 "lightred", "lightmagenta", "yellow", "white"
410}; 410};
411 411
412static char *unspecified_colors[] = {
413 "unspecified-fg", "unspecified-bg", "unspecified"
414};
415
412/* Given a color name, return its index, or -1 if not found. Note 416/* Given a color name, return its index, or -1 if not found. Note
413 that this only performs case-insensitive comparison against the 417 that this only performs case-insensitive comparison against the
414 standard names. For anything more sophisticated, like matching 418 standard names. For anything more sophisticated, like matching
@@ -424,17 +428,25 @@ msdos_stdcolor_idx (const char *name)
424 if (strcasecmp (name, vga_colors[i]) == 0) 428 if (strcasecmp (name, vga_colors[i]) == 0)
425 return i; 429 return i;
426 430
427 return FACE_TTY_DEFAULT_COLOR; 431 return
432 strcmp (name, unspecified_colors[0]) == 0 ? FACE_TTY_DEFAULT_FG_COLOR
433 : strcmp (name, unspecified_colors[1]) == 0 ? FACE_TTY_DEFAULT_BG_COLOR
434 : FACE_TTY_DEFAULT_COLOR;
428} 435}
429 436
430/* Given a color index, return its standard name. */ 437/* Given a color index, return its standard name. */
431Lisp_Object 438Lisp_Object
432msdos_stdcolor_name (int idx) 439msdos_stdcolor_name (int idx)
433{ 440{
434 extern Lisp_Object Qunspecified; 441 extern Lisp_Object Qunspecified, Qunspecified_fg, Qunspecified_bg;
435 442
436 if (idx < 0 || idx >= sizeof (vga_colors) / sizeof (vga_colors[0])) 443 if (idx < 0 || idx >= sizeof (vga_colors) / sizeof (vga_colors[0]))
437 return Qunspecified; /* meaning the default */ 444 {
445 return
446 idx == FACE_TTY_DEFAULT_FG_COLOR ? Qunspecified_fg
447 : idx == FACE_TTY_DEFAULT_BG_COLOR ? Qunspecified_bg
448 : Qunspecified; /* meaning the default */
449 }
438 return build_string (vga_colors[idx]); 450 return build_string (vga_colors[idx]);
439} 451}
440 452
diff --git a/src/msdos.c b/src/msdos.c
index 450d1273c02..1856b6ed656 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -685,12 +685,16 @@ IT_set_face (int face)
685 all 16 colors to be available for the background, since Emacs 685 all 16 colors to be available for the background, since Emacs
686 switches on this mode (and loses the blinking attribute) at 686 switches on this mode (and loses the blinking attribute) at
687 startup. */ 687 startup. */
688 if (fg == (unsigned long)-1) 688 if (fg == FACE_TTY_DEFAULT_COLOR || fg == FACE_TTY_DEFAULT_FG_COLOR)
689 fg = highlight || fp->tty_reverse_p ? FRAME_BACKGROUND_PIXEL (sf) 689 fg = highlight || fp->tty_reverse_p ? FRAME_BACKGROUND_PIXEL (sf)
690 : FRAME_FOREGROUND_PIXEL (sf); 690 : FRAME_FOREGROUND_PIXEL (sf);
691 if (bg == (unsigned long)-1) 691 else if (fg == FACE_TTY_DEFAULT_BG_COLOR)
692 fg = highlight ? FRAME_FOREGROUND_PIXEL (sf) : FRAME_BACKGROUND_PIXEL (sf);
693 if (bg == FACE_TTY_DEFAULT_COLOR || fg == FACE_TTY_DEFAULT_BG_COLOR)
692 bg = highlight || fp->tty_reverse_p ? FRAME_FOREGROUND_PIXEL (sf) 694 bg = highlight || fp->tty_reverse_p ? FRAME_FOREGROUND_PIXEL (sf)
693 : FRAME_BACKGROUND_PIXEL (sf); 695 : FRAME_BACKGROUND_PIXEL (sf);
696 else if (bg == FACE_TTY_DEFAULT_FG_COLOR)
697 fg = highlight ? FRAME_BACKGROUND_PIXEL (sf) : FRAME_FOREGROUND_PIXEL (sf);
694 if (termscript) 698 if (termscript)
695 fprintf (termscript, "<FACE %d%s: %d/%d>", 699 fprintf (termscript, "<FACE %d%s: %d/%d>",
696 face, highlight ? "H" : "", fp->foreground, fp->background); 700 face, highlight ? "H" : "", fp->foreground, fp->background);
diff --git a/src/term.c b/src/term.c
index 7900643dfdc..04f7a64866d 100644
--- a/src/term.c
+++ b/src/term.c
@@ -1959,7 +1959,9 @@ turn_on_face (f, face_id)
1959 && TN_magic_cookie_glitch_ul <= 0) 1959 && TN_magic_cookie_glitch_ul <= 0)
1960 OUTPUT1_IF (TS_enter_underline_mode); 1960 OUTPUT1_IF (TS_enter_underline_mode);
1961 1961
1962 if (face->tty_reverse_p) 1962 if (face->tty_reverse_p
1963 || face->foreground == FACE_TTY_DEFAULT_BG_COLOR
1964 || face->background == FACE_TTY_DEFAULT_FG_COLOR)
1963 OUTPUT1_IF (TS_enter_reverse_mode); 1965 OUTPUT1_IF (TS_enter_reverse_mode);
1964 1966
1965 if (TN_max_colors > 0) 1967 if (TN_max_colors > 0)
@@ -1967,6 +1969,8 @@ turn_on_face (f, face_id)
1967 char *p; 1969 char *p;
1968 1970
1969 if (face->foreground != FACE_TTY_DEFAULT_COLOR 1971 if (face->foreground != FACE_TTY_DEFAULT_COLOR
1972 && face->foreground != FACE_TTY_DEFAULT_FG_COLOR
1973 && face->foreground != FACE_TTY_DEFAULT_BG_COLOR
1970 && TS_set_foreground) 1974 && TS_set_foreground)
1971 { 1975 {
1972 p = tparam (TS_set_foreground, NULL, 0, (int) face->foreground); 1976 p = tparam (TS_set_foreground, NULL, 0, (int) face->foreground);
@@ -1975,6 +1979,8 @@ turn_on_face (f, face_id)
1975 } 1979 }
1976 1980
1977 if (face->background != FACE_TTY_DEFAULT_COLOR 1981 if (face->background != FACE_TTY_DEFAULT_COLOR
1982 && face->background != FACE_TTY_DEFAULT_BG_COLOR
1983 && face->background != FACE_TTY_DEFAULT_FG_COLOR
1978 && TS_set_background) 1984 && TS_set_background)
1979 { 1985 {
1980 p = tparam (TS_set_background, NULL, 0, (int) face->background); 1986 p = tparam (TS_set_background, NULL, 0, (int) face->background);
@@ -2027,8 +2033,10 @@ turn_off_face (f, face_id)
2027 2033
2028 /* Switch back to default colors. */ 2034 /* Switch back to default colors. */
2029 if (TN_max_colors > 0 2035 if (TN_max_colors > 0
2030 && (face->foreground != FACE_TTY_DEFAULT_COLOR 2036 && ((face->foreground != FACE_TTY_DEFAULT_COLOR
2031 || face->background != FACE_TTY_DEFAULT_COLOR)) 2037 && face->foreground != FACE_TTY_DEFAULT_FG_COLOR)
2038 || (face->background != FACE_TTY_DEFAULT_COLOR
2039 && face->background != FACE_TTY_DEFAULT_BG_COLOR)))
2032 OUTPUT1_IF (TS_orig_pair); 2040 OUTPUT1_IF (TS_orig_pair);
2033} 2041}
2034 2042
diff --git a/src/xfaces.c b/src/xfaces.c
index 5fdb881bfc0..dd51df034ac 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -282,7 +282,7 @@ Lisp_Object Qsemi_condensed, Qsemi_expanded, Qexpanded, Qextra_expanded;
282Lisp_Object Qultra_expanded; 282Lisp_Object Qultra_expanded;
283Lisp_Object Qreleased_button, Qpressed_button; 283Lisp_Object Qreleased_button, Qpressed_button;
284Lisp_Object QCstyle, QCcolor, QCline_width; 284Lisp_Object QCstyle, QCcolor, QCline_width;
285Lisp_Object Qunspecified; 285Lisp_Object Qunspecified, Qunspecified_fg, Qunspecified_bg;
286 286
287/* The symbol `x-charset-registry'. This property of charsets defines 287/* The symbol `x-charset-registry'. This property of charsets defines
288 the X registry and encoding that fonts should have that are used to 288 the X registry and encoding that fonts should have that are used to
@@ -1108,6 +1108,14 @@ tty_defined_color (f, color_name, color_def, alloc)
1108 load color" messages in the *Messages* buffer. */ 1108 load color" messages in the *Messages* buffer. */
1109 status = 1; 1109 status = 1;
1110 } 1110 }
1111 if (color_idx == FACE_TTY_DEFAULT_COLOR && *color_name)
1112 {
1113 if (strcmp (color_name, "unspecified-fg") == 0)
1114 color_idx = FACE_TTY_DEFAULT_FG_COLOR;
1115 else if (strcmp (color_name, "unspecified-bg") == 0)
1116 color_idx = FACE_TTY_DEFAULT_BG_COLOR;
1117 }
1118
1111 color_def->pixel = (unsigned long) color_idx; 1119 color_def->pixel = (unsigned long) color_idx;
1112 color_def->red = red; 1120 color_def->red = red;
1113 color_def->green = green; 1121 color_def->green = green;
@@ -1179,7 +1187,10 @@ tty_color_name (f, idx)
1179 by index using the default color mapping on a Windows console. */ 1187 by index using the default color mapping on a Windows console. */
1180#endif 1188#endif
1181 1189
1182 return Qunspecified; 1190 return
1191 idx == FACE_TTY_DEFAULT_FG_COLOR ? Qunspecified_fg
1192 : idx == FACE_TTY_DEFAULT_BG_COLOR ? Qunspecified_bg
1193 : Qunspecified;
1183} 1194}
1184 1195
1185/* Return non-zero if COLOR_NAME is a shade of gray (or white or 1196/* Return non-zero if COLOR_NAME is a shade of gray (or white or
@@ -3427,7 +3438,8 @@ frame.")
3427 } 3438 }
3428 else if (EQ (attr, QCforeground)) 3439 else if (EQ (attr, QCforeground))
3429 { 3440 {
3430 if (!UNSPECIFIEDP (value)) 3441 if (!UNSPECIFIEDP (value)
3442 && !EQ (value, Qunspecified_fg) && !EQ (value, Qunspecified_bg))
3431 { 3443 {
3432 /* Don't check for valid color names here because it depends 3444 /* Don't check for valid color names here because it depends
3433 on the frame (display) whether the color will be valid 3445 on the frame (display) whether the color will be valid
@@ -3441,7 +3453,8 @@ frame.")
3441 } 3453 }
3442 else if (EQ (attr, QCbackground)) 3454 else if (EQ (attr, QCbackground))
3443 { 3455 {
3444 if (!UNSPECIFIEDP (value)) 3456 if (!UNSPECIFIEDP (value)
3457 && !EQ (value, Qunspecified_bg) && !EQ (value, Qunspecified_fg))
3445 { 3458 {
3446 /* Don't check for valid color names here because it depends 3459 /* Don't check for valid color names here because it depends
3447 on the frame (display) whether the color will be valid 3460 on the frame (display) whether the color will be valid
@@ -5686,7 +5699,9 @@ realize_default_face (f)
5686 LFACE_FOREGROUND (lface) = XCDR (color); 5699 LFACE_FOREGROUND (lface) = XCDR (color);
5687 else if (FRAME_X_P (f)) 5700 else if (FRAME_X_P (f))
5688 return 0; 5701 return 0;
5689 else if (!FRAME_TERMCAP_P (f) && !FRAME_MSDOS_P (f)) 5702 else if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))
5703 LFACE_FOREGROUND (lface) = Qunspecified_fg;
5704 else
5690 abort (); 5705 abort ();
5691 } 5706 }
5692 5707
@@ -5699,7 +5714,9 @@ realize_default_face (f)
5699 LFACE_BACKGROUND (lface) = XCDR (color); 5714 LFACE_BACKGROUND (lface) = XCDR (color);
5700 else if (FRAME_X_P (f)) 5715 else if (FRAME_X_P (f))
5701 return 0; 5716 return 0;
5702 else if (!FRAME_TERMCAP_P (f) && !FRAME_MSDOS_P (f)) 5717 else if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))
5718 LFACE_BACKGROUND (lface) = Qunspecified_bg;
5719 else
5703 abort (); 5720 abort ();
5704 } 5721 }
5705 5722
@@ -6072,7 +6089,8 @@ realize_tty_face (c, attrs, charset)
6072 face->tty_reverse_p = 1; 6089 face->tty_reverse_p = 1;
6073 6090
6074 /* Map color names to color indices. */ 6091 /* Map color names to color indices. */
6075 face->foreground = face->background = FACE_TTY_DEFAULT_COLOR; 6092 face->foreground = FACE_TTY_DEFAULT_FG_COLOR;
6093 face->background = FACE_TTY_DEFAULT_BG_COLOR;
6076 6094
6077 color = attrs[LFACE_FOREGROUND_INDEX]; 6095 color = attrs[LFACE_FOREGROUND_INDEX];
6078 if (STRINGP (color) 6096 if (STRINGP (color)
@@ -6084,7 +6102,7 @@ realize_tty_face (c, attrs, charset)
6084 (NAME INDEX R G B). We need the INDEX part. */ 6102 (NAME INDEX R G B). We need the INDEX part. */
6085 face->foreground = XINT (XCAR (XCDR (color))); 6103 face->foreground = XINT (XCAR (XCDR (color)));
6086 6104
6087 if (face->foreground == FACE_TTY_DEFAULT_COLOR 6105 if (face->foreground == FACE_TTY_DEFAULT_FG_COLOR
6088 && STRINGP (attrs[LFACE_FOREGROUND_INDEX])) 6106 && STRINGP (attrs[LFACE_FOREGROUND_INDEX]))
6089 { 6107 {
6090 face->foreground = load_color (c->f, face, 6108 face->foreground = load_color (c->f, face,
@@ -6093,12 +6111,23 @@ realize_tty_face (c, attrs, charset)
6093#ifdef MSDOS 6111#ifdef MSDOS
6094 /* If the foreground of the default face is the default color, 6112 /* If the foreground of the default face is the default color,
6095 use the foreground color defined by the frame. */ 6113 use the foreground color defined by the frame. */
6096 if (FRAME_MSDOS_P (c->f) && face->foreground == FACE_TTY_DEFAULT_COLOR) 6114 if (FRAME_MSDOS_P (c->f))
6097 { 6115 {
6098 face->foreground = FRAME_FOREGROUND_PIXEL (f); 6116 if (face->foreground == FACE_TTY_DEFAULT_FG_COLOR
6099 attrs[LFACE_FOREGROUND_INDEX] = 6117 || face->foreground == FACE_TTY_DEFAULT_COLOR)
6100 msdos_stdcolor_name (face->foreground); 6118 {
6101 face_colors_defaulted = 1; 6119 face->foreground = FRAME_FOREGROUND_PIXEL (f);
6120 attrs[LFACE_FOREGROUND_INDEX] =
6121 msdos_stdcolor_name (face->foreground);
6122 face_colors_defaulted = 1;
6123 }
6124 else if (face->foreground == FACE_TTY_DEFAULT_BG_COLOR)
6125 {
6126 face->foreground = FRAME_BACKGROUND_PIXEL (f);
6127 attrs[LFACE_FOREGROUND_INDEX] =
6128 msdos_stdcolor_name (face->foreground);
6129 face_colors_defaulted = 1;
6130 }
6102 } 6131 }
6103#endif 6132#endif
6104 } 6133 }
@@ -6113,7 +6142,7 @@ realize_tty_face (c, attrs, charset)
6113 (NAME INDEX R G B). We need the INDEX part. */ 6142 (NAME INDEX R G B). We need the INDEX part. */
6114 face->background = XINT (XCAR (XCDR (color))); 6143 face->background = XINT (XCAR (XCDR (color)));
6115 6144
6116 if (face->background == FACE_TTY_DEFAULT_COLOR 6145 if (face->background == FACE_TTY_DEFAULT_BG_COLOR
6117 && STRINGP (attrs[LFACE_BACKGROUND_INDEX])) 6146 && STRINGP (attrs[LFACE_BACKGROUND_INDEX]))
6118 { 6147 {
6119 face->background = load_color (c->f, face, 6148 face->background = load_color (c->f, face,
@@ -6122,12 +6151,23 @@ realize_tty_face (c, attrs, charset)
6122#ifdef MSDOS 6151#ifdef MSDOS
6123 /* If the background of the default face is the default color, 6152 /* If the background of the default face is the default color,
6124 use the background color defined by the frame. */ 6153 use the background color defined by the frame. */
6125 if (FRAME_MSDOS_P (c->f) && face->background == FACE_TTY_DEFAULT_COLOR) 6154 if (FRAME_MSDOS_P (c->f))
6126 { 6155 {
6127 face->background = FRAME_BACKGROUND_PIXEL (f); 6156 if (face->background == FACE_TTY_DEFAULT_BG_COLOR
6128 attrs[LFACE_BACKGROUND_INDEX] = 6157 || face->background == FACE_TTY_DEFAULT_COLOR)
6129 msdos_stdcolor_name (face->background); 6158 {
6130 face_colors_defaulted = 1; 6159 face->background = FRAME_BACKGROUND_PIXEL (f);
6160 attrs[LFACE_BACKGROUND_INDEX] =
6161 msdos_stdcolor_name (face->background);
6162 face_colors_defaulted = 1;
6163 }
6164 else if (face->background == FACE_TTY_DEFAULT_FG_COLOR)
6165 {
6166 face->background = FRAME_FOREGROUND_PIXEL (f);
6167 attrs[LFACE_BACKGROUND_INDEX] =
6168 msdos_stdcolor_name (face->background);
6169 face_colors_defaulted = 1;
6170 }
6131 } 6171 }
6132#endif 6172#endif
6133 } 6173 }
@@ -6611,6 +6651,10 @@ syms_of_xfaces ()
6611 staticpro (&Qforeground_color); 6651 staticpro (&Qforeground_color);
6612 Qunspecified = intern ("unspecified"); 6652 Qunspecified = intern ("unspecified");
6613 staticpro (&Qunspecified); 6653 staticpro (&Qunspecified);
6654 Qunspecified_fg = intern ("unspecified-fg");
6655 staticpro (&Qunspecified_fg);
6656 Qunspecified_bg = intern ("unspecified-bg");
6657 staticpro (&Qunspecified_bg);
6614 6658
6615 Qx_charset_registry = intern ("x-charset-registry"); 6659 Qx_charset_registry = intern ("x-charset-registry");
6616 staticpro (&Qx_charset_registry); 6660 staticpro (&Qx_charset_registry);