diff options
| author | Federico Tedin | 2019-01-15 22:08:15 -0300 |
|---|---|---|
| committer | Eli Zaretskii | 2019-03-01 10:36:59 +0200 |
| commit | 63d0dc7937bddd803145f2df23a600597c4fd8e7 (patch) | |
| tree | 688dec6e5162e5d6ee4fbd6b346e96014a41e9b4 | |
| parent | 44b7436d4408ddfb72c1758d60395872791ae00d (diff) | |
| download | emacs-63d0dc7937bddd803145f2df23a600597c4fd8e7.tar.gz emacs-63d0dc7937bddd803145f2df23a600597c4fd8e7.zip | |
Allow control on the threshold for using 'distant-foreground'
* src/xfaces.c (NEAR_SAME_COLOR_THRESHOLD): Macro deleted.
(load_face_colors): Compare against
face_near_same_color_threshold instead of
NEAR_SAME_COLOR_THRESHOLD.
(syms_of_xfaces) <face-near-same-color-threshold>: New
variable. (Bug#34001)
* etc/NEWS: Announce the change.
| -rw-r--r-- | etc/NEWS | 7 | ||||
| -rw-r--r-- | src/xfaces.c | 15 |
2 files changed, 19 insertions, 3 deletions
| @@ -145,6 +145,13 @@ EMACS_SOCKET_NAME environment variable to an appropriate value. | |||
| 145 | *** When run by root, emacsclient no longer connects to non-root sockets. | 145 | *** When run by root, emacsclient no longer connects to non-root sockets. |
| 146 | (Instead you can use Tramp methods to run root commands in a non-root Emacs.) | 146 | (Instead you can use Tramp methods to run root commands in a non-root Emacs.) |
| 147 | 147 | ||
| 148 | --- | ||
| 149 | ** Control of the threshold for using the 'distant-foreground' color. | ||
| 150 | The threshold for color distance below which the 'distant-foreground' | ||
| 151 | color of the face will be used instead of the foreground color can now | ||
| 152 | be controlled via the new variable 'face-near-same-color-threshold'. | ||
| 153 | The default value is 30000, as the previously hard-coded threshold. | ||
| 154 | |||
| 148 | +++ | 155 | +++ |
| 149 | ** The function 'read-passwd' uses '*' as default character to hide passwords. | 156 | ** The function 'read-passwd' uses '*' as default character to hide passwords. |
| 150 | 157 | ||
diff --git a/src/xfaces.c b/src/xfaces.c index 3ba824b6517..69e73e8c0dd 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -1157,8 +1157,6 @@ load_color (struct frame *f, struct face *face, Lisp_Object name, | |||
| 1157 | 1157 | ||
| 1158 | #ifdef HAVE_WINDOW_SYSTEM | 1158 | #ifdef HAVE_WINDOW_SYSTEM |
| 1159 | 1159 | ||
| 1160 | #define NEAR_SAME_COLOR_THRESHOLD 30000 | ||
| 1161 | |||
| 1162 | /* Load colors for face FACE which is used on frame F. Colors are | 1160 | /* Load colors for face FACE which is used on frame F. Colors are |
| 1163 | specified by slots LFACE_BACKGROUND_INDEX and LFACE_FOREGROUND_INDEX | 1161 | specified by slots LFACE_BACKGROUND_INDEX and LFACE_FOREGROUND_INDEX |
| 1164 | of ATTRS. If the background color specified is not supported on F, | 1162 | of ATTRS. If the background color specified is not supported on F, |
| @@ -1199,7 +1197,7 @@ load_face_colors (struct frame *f, struct face *face, | |||
| 1199 | 1197 | ||
| 1200 | dfg = attrs[LFACE_DISTANT_FOREGROUND_INDEX]; | 1198 | dfg = attrs[LFACE_DISTANT_FOREGROUND_INDEX]; |
| 1201 | if (!NILP (dfg) && !UNSPECIFIEDP (dfg) | 1199 | if (!NILP (dfg) && !UNSPECIFIEDP (dfg) |
| 1202 | && color_distance (&xbg, &xfg) < NEAR_SAME_COLOR_THRESHOLD) | 1200 | && color_distance (&xbg, &xfg) < face_near_same_color_threshold) |
| 1203 | { | 1201 | { |
| 1204 | if (EQ (attrs[LFACE_INVERSE_INDEX], Qt)) | 1202 | if (EQ (attrs[LFACE_INVERSE_INDEX], Qt)) |
| 1205 | face->background = load_color (f, face, dfg, LFACE_BACKGROUND_INDEX); | 1203 | face->background = load_color (f, face, dfg, LFACE_BACKGROUND_INDEX); |
| @@ -6799,6 +6797,17 @@ RESCALE-RATIO is a floating point number to specify how much larger | |||
| 6799 | a font of 10 point, we actually use a font of 10 * RESCALE-RATIO point. */); | 6797 | a font of 10 point, we actually use a font of 10 * RESCALE-RATIO point. */); |
| 6800 | Vface_font_rescale_alist = Qnil; | 6798 | Vface_font_rescale_alist = Qnil; |
| 6801 | 6799 | ||
| 6800 | DEFVAR_INT ("face-near-same-color-threshold", face_near_same_color_threshold, | ||
| 6801 | doc: /* Threshold for using distant-foreground color instead of foreground. | ||
| 6802 | |||
| 6803 | The value should be an integer number providing the minimum distance | ||
| 6804 | between two colors that will still qualify them to be used as foreground | ||
| 6805 | and background. If the value of `color-distance', invoked with a nil | ||
| 6806 | METRIC argument, for the foreground and background colors of a face is | ||
| 6807 | less than this threshold, the distant-foreground color, if defined, | ||
| 6808 | will be used for the face instead of the foreground color. */); | ||
| 6809 | face_near_same_color_threshold = 30000; | ||
| 6810 | |||
| 6802 | #ifdef HAVE_WINDOW_SYSTEM | 6811 | #ifdef HAVE_WINDOW_SYSTEM |
| 6803 | defsubr (&Sbitmap_spec_p); | 6812 | defsubr (&Sbitmap_spec_p); |
| 6804 | defsubr (&Sx_list_fonts); | 6813 | defsubr (&Sx_list_fonts); |